Uh oh!
There was an error while loading. Please reload this page.
fix: Migrate AbstractMessageManager from BaseControllerV1 to BaseControllerV2 - #5103
Conversation
OGPoyraz
commented
Jan 6, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
OGPoyraz
commented
Jan 6, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
fb4b210 to
b901514CompareOGPoyraz
commented
Jan 7, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Uh oh!
There was an error while loading. Please reload this page.
OGPoyraz
commented
Jan 7, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mcmire
commented
Jan 15, 2025
This also closes one of the items in #1509. |
## 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/message-manager@12.0.0` #### 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/accounts-controller@21.0.1` #### 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 <charly.chevalier@consensys.net>
…tend controllers (#29237) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR aims to adapt latest changes in the `@metamask/message-manager` `DecryptMessageManager` and `EncryptionPublicKeyManager` classes. The latest change in core mainly tries to adapt `BaseControllerV2`. Hence in the extension, minimum changes made in the wrapper classes to keep functionality as is. [](https://codespaces.new/MetaMask/metamask-extension/pull/29237?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#3747 Related core PR: MetaMask/core#5103 ## **Manual testing steps** 1. Go to test-dapp and `Encrypt / Decrypt` section 2. "Get Encryption Key", "Encrypt" and "Decrypt" must be functional and work without issue ## **Screenshots/Recordings** https://github.com/user-attachments/assets/3857cb34-2542-41c3-ac1e-6d95e98b0dfb ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
## Explanation Removes the deprecated `BaseControllerV1` and its associated types and methods, replacing them with the V2 `BaseController`, its derived classes, and helper methods. This is the culmination of work completed over multiple quarters, and represents a major step forward for performative and best practice-compliant state management in our clients. ## References - Closes#5041 - Blocked by #5103 ## 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/base-controller` ### Changed - Widen input parameter for type guard `isBaseController` from `ControllerInstance` to `unknown`. ### Removed - **BREAKING:** Remove class `BaseControllerV1` and type guard `isBaseControllerV1`. - **BREAKING:** Remove types `BaseConfig`, `BaseControllerV1Instance`, `BaseState`, `ConfigConstraintV1`, `Listener`, `StateConstraintV1`, `LegacyControllerStateConstraint`, `ControllerInstance`. ## `@metamask/composable-controller` ### Changed - **BREAKING:** Re-define `ComposableControllerStateConstraint` type using `StateConstraint` instead of `LegacyControllerStateConstraint`. - **BREAKING:** Constrain the `ComposableControllerState` generic argument for the `ComposableController` class using `ComposableControllerStateConstraint` instead of `LegacyComposableControllerStateConstraint`. ## `@metamask/polling-controller` ### Removed - **BREAKING:** Remove `BlockTrackerPollingControllerV1`, `StaticIntervalPollingControllerV1`. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes --------- Co-authored-by: cryptodev-2s <109512101+cryptodev-2s@users.noreply.github.com> Co-authored-by: Salah-Eddine Saakoun <salah-eddine.saakoun@consensys.net>
Explanation
This PR aims to remove
BaseControllerV1usage fromAbstractMessageManager. As expected this change affected bothDecryptMessageManager(DMM) andEncryptionPublicKeyManager(EPKM).Since extension already have wrapper classes for both
DMM&EPKMin 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
DecryptMessageManagerEncryptMessageManagerto extend controllers metamask-extension#29237Changelog
@metamask/message-managerDecryptMessageManagerandEncryptionPublicKeyManager(AbstractMessageManager) now expects new options to initialisehubproperty) fromAbstractMessageManagerunapprovedMessageandupdateBadgeremoved from internal events. These events are now emitted from messaging systemDerivedManagerName:Xevent instead of using internal event emitter.Checklist