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

fix: Migrate AbstractMessageManager from BaseControllerV1 to BaseControllerV2 #5103

Merged
merged 15 commits into from
Jan 14, 2025

Conversation

OGPoyraz
Copy link
Member

@OGPoyraz OGPoyraz commented Jan 6, 2025

Explanation

This PR aims to remove BaseControllerV1 usage from AbstractMessageManager. As expected this change affected both DecryptMessageManager (DMM) and EncryptionPublicKeyManager(EPKM).

Since extension already have wrapper classes for both DMM & EPKM in the extension code, we want to keep changes minimal and make these both classes in the core work like controller but let wrappers sync the state in their classes as we currently do. You can find the extension PR in the references below.

References

Changelog

@metamask/message-manager

  • BREAKING: Base class of DecryptMessageManager and EncryptionPublicKeyManager(AbstractMessageManager) now expects new options to initialise
  • BREAKING: Removed internal event emitter (hub property) from AbstractMessageManager
  • BREAKING: unapprovedMessage and updateBadge removed from internal events. These events are now emitted from messaging system
    • Controllers should now listen to DerivedManagerName:X event instead of using internal event emitter.

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

@OGPoyraz OGPoyraz requested a review from a team as a code owner January 6, 2025 13:25
@OGPoyraz
Copy link
Member Author

OGPoyraz commented Jan 6, 2025

@metamaskbot publish-preview

Copy link
Contributor

github-actions bot commented Jan 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": "20.0.2-preview-03f094b7",
  "@metamask-previews/address-book-controller": "6.0.2-preview-03f094b7",
  "@metamask-previews/announcement-controller": "7.0.2-preview-03f094b7",
  "@metamask-previews/approval-controller": "7.1.1-preview-03f094b7",
  "@metamask-previews/assets-controllers": "45.1.2-preview-03f094b7",
  "@metamask-previews/base-controller": "7.1.0-preview-03f094b7",
  "@metamask-previews/build-utils": "3.0.2-preview-03f094b7",
  "@metamask-previews/chain-controller": "0.2.2-preview-03f094b7",
  "@metamask-previews/composable-controller": "10.0.0-preview-03f094b7",
  "@metamask-previews/controller-utils": "11.4.4-preview-03f094b7",
  "@metamask-previews/ens-controller": "15.0.1-preview-03f094b7",
  "@metamask-previews/eth-json-rpc-provider": "4.1.7-preview-03f094b7",
  "@metamask-previews/gas-fee-controller": "22.0.2-preview-03f094b7",
  "@metamask-previews/json-rpc-engine": "10.0.2-preview-03f094b7",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.6-preview-03f094b7",
  "@metamask-previews/keyring-controller": "19.0.2-preview-03f094b7",
  "@metamask-previews/logging-controller": "6.0.3-preview-03f094b7",
  "@metamask-previews/message-manager": "11.0.3-preview-03f094b7",
  "@metamask-previews/multichain": "2.0.0-preview-03f094b7",
  "@metamask-previews/name-controller": "8.0.2-preview-03f094b7",
  "@metamask-previews/network-controller": "22.1.1-preview-03f094b7",
  "@metamask-previews/notification-services-controller": "0.15.0-preview-03f094b7",
  "@metamask-previews/permission-controller": "11.0.4-preview-03f094b7",
  "@metamask-previews/permission-log-controller": "3.0.2-preview-03f094b7",
  "@metamask-previews/phishing-controller": "12.3.1-preview-03f094b7",
  "@metamask-previews/polling-controller": "12.0.2-preview-03f094b7",
  "@metamask-previews/preferences-controller": "15.0.1-preview-03f094b7",
  "@metamask-previews/profile-sync-controller": "3.1.1-preview-03f094b7",
  "@metamask-previews/queued-request-controller": "8.0.2-preview-03f094b7",
  "@metamask-previews/rate-limit-controller": "6.0.2-preview-03f094b7",
  "@metamask-previews/remote-feature-flag-controller": "1.2.0-preview-03f094b7",
  "@metamask-previews/selected-network-controller": "20.0.2-preview-03f094b7",
  "@metamask-previews/signature-controller": "23.1.0-preview-03f094b7",
  "@metamask-previews/transaction-controller": "42.1.0-preview-03f094b7",
  "@metamask-previews/user-operation-controller": "21.0.0-preview-03f094b7"
}

@OGPoyraz
Copy link
Member Author

OGPoyraz commented Jan 6, 2025

@metamaskbot publish-preview

Copy link
Contributor

github-actions bot commented Jan 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": "20.0.2-preview-544f13b4",
  "@metamask-previews/address-book-controller": "6.0.2-preview-544f13b4",
  "@metamask-previews/announcement-controller": "7.0.2-preview-544f13b4",
  "@metamask-previews/approval-controller": "7.1.1-preview-544f13b4",
  "@metamask-previews/assets-controllers": "45.1.2-preview-544f13b4",
  "@metamask-previews/base-controller": "7.1.0-preview-544f13b4",
  "@metamask-previews/build-utils": "3.0.2-preview-544f13b4",
  "@metamask-previews/chain-controller": "0.2.2-preview-544f13b4",
  "@metamask-previews/composable-controller": "10.0.0-preview-544f13b4",
  "@metamask-previews/controller-utils": "11.4.4-preview-544f13b4",
  "@metamask-previews/ens-controller": "15.0.1-preview-544f13b4",
  "@metamask-previews/eth-json-rpc-provider": "4.1.7-preview-544f13b4",
  "@metamask-previews/gas-fee-controller": "22.0.2-preview-544f13b4",
  "@metamask-previews/json-rpc-engine": "10.0.2-preview-544f13b4",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.6-preview-544f13b4",
  "@metamask-previews/keyring-controller": "19.0.2-preview-544f13b4",
  "@metamask-previews/logging-controller": "6.0.3-preview-544f13b4",
  "@metamask-previews/message-manager": "11.0.3-preview-544f13b4",
  "@metamask-previews/multichain": "2.0.0-preview-544f13b4",
  "@metamask-previews/name-controller": "8.0.2-preview-544f13b4",
  "@metamask-previews/network-controller": "22.1.1-preview-544f13b4",
  "@metamask-previews/notification-services-controller": "0.15.0-preview-544f13b4",
  "@metamask-previews/permission-controller": "11.0.4-preview-544f13b4",
  "@metamask-previews/permission-log-controller": "3.0.2-preview-544f13b4",
  "@metamask-previews/phishing-controller": "12.3.1-preview-544f13b4",
  "@metamask-previews/polling-controller": "12.0.2-preview-544f13b4",
  "@metamask-previews/preferences-controller": "15.0.1-preview-544f13b4",
  "@metamask-previews/profile-sync-controller": "3.1.1-preview-544f13b4",
  "@metamask-previews/queued-request-controller": "8.0.2-preview-544f13b4",
  "@metamask-previews/rate-limit-controller": "6.0.2-preview-544f13b4",
  "@metamask-previews/remote-feature-flag-controller": "1.2.0-preview-544f13b4",
  "@metamask-previews/selected-network-controller": "20.0.2-preview-544f13b4",
  "@metamask-previews/signature-controller": "23.1.0-preview-544f13b4",
  "@metamask-previews/transaction-controller": "42.1.0-preview-544f13b4",
  "@metamask-previews/user-operation-controller": "21.0.0-preview-544f13b4"
}

@OGPoyraz OGPoyraz requested a review from a team as a code owner January 7, 2025 10:09
@OGPoyraz OGPoyraz force-pushed the 3747-update-abstractmessagemanager-to-basecontrollerv2 branch from fb4b210 to b901514 Compare January 7, 2025 10:16
@MetaMask MetaMask deleted a comment from github-actions bot Jan 7, 2025
@OGPoyraz
Copy link
Member Author

OGPoyraz commented Jan 7, 2025

@metamaskbot publish-preview

Copy link
Contributor

github-actions bot commented Jan 7, 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": "20.0.2-preview-77ba063e",
  "@metamask-previews/address-book-controller": "6.0.2-preview-77ba063e",
  "@metamask-previews/announcement-controller": "7.0.2-preview-77ba063e",
  "@metamask-previews/approval-controller": "7.1.1-preview-77ba063e",
  "@metamask-previews/assets-controllers": "45.1.2-preview-77ba063e",
  "@metamask-previews/base-controller": "7.1.0-preview-77ba063e",
  "@metamask-previews/build-utils": "3.0.2-preview-77ba063e",
  "@metamask-previews/chain-controller": "0.2.2-preview-77ba063e",
  "@metamask-previews/composable-controller": "10.0.0-preview-77ba063e",
  "@metamask-previews/controller-utils": "11.4.4-preview-77ba063e",
  "@metamask-previews/ens-controller": "15.0.1-preview-77ba063e",
  "@metamask-previews/eth-json-rpc-provider": "4.1.7-preview-77ba063e",
  "@metamask-previews/gas-fee-controller": "22.0.2-preview-77ba063e",
  "@metamask-previews/json-rpc-engine": "10.0.2-preview-77ba063e",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.6-preview-77ba063e",
  "@metamask-previews/keyring-controller": "19.0.2-preview-77ba063e",
  "@metamask-previews/logging-controller": "6.0.3-preview-77ba063e",
  "@metamask-previews/message-manager": "11.0.3-preview-77ba063e",
  "@metamask-previews/multichain": "2.0.0-preview-77ba063e",
  "@metamask-previews/name-controller": "8.0.2-preview-77ba063e",
  "@metamask-previews/network-controller": "22.1.1-preview-77ba063e",
  "@metamask-previews/notification-services-controller": "0.15.0-preview-77ba063e",
  "@metamask-previews/permission-controller": "11.0.4-preview-77ba063e",
  "@metamask-previews/permission-log-controller": "3.0.2-preview-77ba063e",
  "@metamask-previews/phishing-controller": "12.3.1-preview-77ba063e",
  "@metamask-previews/polling-controller": "12.0.2-preview-77ba063e",
  "@metamask-previews/preferences-controller": "15.0.1-preview-77ba063e",
  "@metamask-previews/profile-sync-controller": "3.1.1-preview-77ba063e",
  "@metamask-previews/queued-request-controller": "8.0.2-preview-77ba063e",
  "@metamask-previews/rate-limit-controller": "6.0.2-preview-77ba063e",
  "@metamask-previews/remote-feature-flag-controller": "1.2.0-preview-77ba063e",
  "@metamask-previews/selected-network-controller": "20.0.2-preview-77ba063e",
  "@metamask-previews/signature-controller": "23.1.0-preview-77ba063e",
  "@metamask-previews/transaction-controller": "42.1.0-preview-77ba063e",
  "@metamask-previews/user-operation-controller": "21.0.0-preview-77ba063e"
}

@OGPoyraz
Copy link
Member Author

OGPoyraz commented Jan 7, 2025

@metamaskbot publish-preview

Copy link
Contributor

github-actions bot commented Jan 7, 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": "20.0.2-preview-e5e6db48",
  "@metamask-previews/address-book-controller": "6.0.2-preview-e5e6db48",
  "@metamask-previews/announcement-controller": "7.0.2-preview-e5e6db48",
  "@metamask-previews/approval-controller": "7.1.1-preview-e5e6db48",
  "@metamask-previews/assets-controllers": "45.1.2-preview-e5e6db48",
  "@metamask-previews/base-controller": "7.1.0-preview-e5e6db48",
  "@metamask-previews/build-utils": "3.0.2-preview-e5e6db48",
  "@metamask-previews/chain-controller": "0.2.2-preview-e5e6db48",
  "@metamask-previews/composable-controller": "10.0.0-preview-e5e6db48",
  "@metamask-previews/controller-utils": "11.4.4-preview-e5e6db48",
  "@metamask-previews/ens-controller": "15.0.1-preview-e5e6db48",
  "@metamask-previews/eth-json-rpc-provider": "4.1.7-preview-e5e6db48",
  "@metamask-previews/gas-fee-controller": "22.0.2-preview-e5e6db48",
  "@metamask-previews/json-rpc-engine": "10.0.2-preview-e5e6db48",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.6-preview-e5e6db48",
  "@metamask-previews/keyring-controller": "19.0.2-preview-e5e6db48",
  "@metamask-previews/logging-controller": "6.0.3-preview-e5e6db48",
  "@metamask-previews/message-manager": "11.0.3-preview-e5e6db48",
  "@metamask-previews/multichain": "2.0.0-preview-e5e6db48",
  "@metamask-previews/name-controller": "8.0.2-preview-e5e6db48",
  "@metamask-previews/network-controller": "22.1.1-preview-e5e6db48",
  "@metamask-previews/notification-services-controller": "0.15.0-preview-e5e6db48",
  "@metamask-previews/permission-controller": "11.0.4-preview-e5e6db48",
  "@metamask-previews/permission-log-controller": "3.0.2-preview-e5e6db48",
  "@metamask-previews/phishing-controller": "12.3.1-preview-e5e6db48",
  "@metamask-previews/polling-controller": "12.0.2-preview-e5e6db48",
  "@metamask-previews/preferences-controller": "15.0.1-preview-e5e6db48",
  "@metamask-previews/profile-sync-controller": "3.1.1-preview-e5e6db48",
  "@metamask-previews/queued-request-controller": "8.0.2-preview-e5e6db48",
  "@metamask-previews/rate-limit-controller": "6.0.2-preview-e5e6db48",
  "@metamask-previews/remote-feature-flag-controller": "1.2.0-preview-e5e6db48",
  "@metamask-previews/selected-network-controller": "20.0.2-preview-e5e6db48",
  "@metamask-previews/signature-controller": "23.1.0-preview-e5e6db48",
  "@metamask-previews/transaction-controller": "42.1.0-preview-e5e6db48",
  "@metamask-previews/user-operation-controller": "21.0.0-preview-e5e6db48"
}

@OGPoyraz OGPoyraz enabled auto-merge (squash) January 9, 2025 12:19
@OGPoyraz OGPoyraz merged commit c5d49d7 into main Jan 14, 2025
117 checks passed
@OGPoyraz OGPoyraz deleted the 3747-update-abstractmessagemanager-to-basecontrollerv2 branch January 14, 2025 18:15
@mcmire
Copy link
Contributor

mcmire commented Jan 15, 2025

This also closes one of the items in #1509.

@OGPoyraz OGPoyraz mentioned this pull request Jan 17, 2025
4 tasks
OGPoyraz added a commit that referenced this pull request Jan 17, 2025
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

New RC for the `284.0.0`

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/[email protected]`

#### Changed

- **BREAKING:** Base class of `DecryptMessageManager` and
`EncryptionPublicKeyManager`(`AbstractMessageManager`) now expects new
options to initialise
([#5103](#5103))
- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0`
([#5079](#5079))

#### Removed

- **BREAKING:** Removed internal event emitter (`hub` property) from
`AbstractMessageManager`
([#5103](#5103))
- **BREAKING:** `unapprovedMessage` and `updateBadge` removed from
internal events. These events are now emitted from messaging system
([#5103](#5103))
- Controllers should now listen to `DerivedManagerName:X` event instead
of using internal event emitter.

### `@metamask/[email protected]`

#### Changed

- Bump `@metamask/eth-snap-keyring` from `^8.0.0` to `^8.1.0`
([#5167](#5167))

## 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

---------

Co-authored-by: Charly Chevalier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants