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

[composable-controller] perf: Optimize expensive reduce operations, fix metadata instantiation #4968

Conversation

MajorLift
Copy link
Contributor

@MajorLift MajorLift commented Nov 25, 2024

Motivation

Expensive operations during ComposableController instantiation contribute to downstream performance issues in our client apps' initialization times. Optimizing these operations may be especially impactful since ComposableController takes large inputs consisting of all of the controllers used by a given client.

Explanation

  • Remove wasteful reduce operations that create temporary objects on each iteration and replace with implementations that re-use their output objects.
  • Refactor ComposableController to accept an object instead of an array. Now that the mobile Engine creates a controllers object, this saves us an extra operation for converting the object into an array.
    • For downstream application, see MetaMask/metamask-mobile@5ceb81c
    • An auxiliary benefit of this is slightly improved type safety. Since we were previously using a type array instead of a type tuple, we were vulnerable to duplicate entries in the controllers input. This is now resolved by using a type object.
  • Fixes issues with 'state', 'metadata' field instantiation (see changelogs).

References

Changelog

@metamask/composable-controller

Changed

  • BREAKING: ComposableController constructor option controllers and generic type argument ChildControllers are re-defined from an array of controller instances to an object that maps controller names to controller instances.
  • BREAKING: ComposableController class field objects state and metadata exclude child controllers that do not extend from BaseController or BaseControllerV1. Any non-controller entries that are passed into the constructor will be removed automatically.

Fixed

  • BREAKING: ComposableController class field object metadata now assigns the StateMetadataProperty-type object { persist: true, anonymous: true } to each child controller name.
    • Previously, V2 child controllers were erroneously assigned their own metadata object. This issue was introduced in @metamask/base-controller@6.0.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

@MajorLift MajorLift self-assigned this Nov 25, 2024
@MajorLift MajorLift added team-wallet-framework team-tiger Tiger team (for tech debt reduction + performance improvements) area-performance Issues relating to slowness of app, cpu usage, and/or blank screens. labels Nov 25, 2024
@MajorLift
Copy link
Contributor Author

@metamaskbot publish-preview

@MajorLift MajorLift marked this pull request as ready for review November 25, 2024 11:30
@MajorLift MajorLift requested a review from a team as a code owner November 25, 2024 11:30
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": "20.0.0-preview-9d476a5",
  "@metamask-previews/address-book-controller": "6.0.1-preview-9d476a5",
  "@metamask-previews/announcement-controller": "7.0.1-preview-9d476a5",
  "@metamask-previews/approval-controller": "7.1.1-preview-9d476a5",
  "@metamask-previews/assets-controllers": "45.1.0-preview-9d476a5",
  "@metamask-previews/base-controller": "7.0.2-preview-9d476a5",
  "@metamask-previews/build-utils": "3.0.1-preview-9d476a5",
  "@metamask-previews/chain-controller": "0.2.0-preview-9d476a5",
  "@metamask-previews/composable-controller": "9.0.1-preview-9d476a5",
  "@metamask-previews/controller-utils": "11.4.3-preview-9d476a5",
  "@metamask-previews/ens-controller": "15.0.0-preview-9d476a5",
  "@metamask-previews/eth-json-rpc-provider": "4.1.6-preview-9d476a5",
  "@metamask-previews/gas-fee-controller": "22.0.1-preview-9d476a5",
  "@metamask-previews/json-rpc-engine": "10.0.1-preview-9d476a5",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.5-preview-9d476a5",
  "@metamask-previews/keyring-controller": "19.0.0-preview-9d476a5",
  "@metamask-previews/logging-controller": "6.0.2-preview-9d476a5",
  "@metamask-previews/message-manager": "11.0.1-preview-9d476a5",
  "@metamask-previews/multichain": "1.0.0-preview-9d476a5",
  "@metamask-previews/name-controller": "8.0.1-preview-9d476a5",
  "@metamask-previews/network-controller": "22.0.2-preview-9d476a5",
  "@metamask-previews/notification-controller": "7.0.0-preview-9d476a5",
  "@metamask-previews/notification-services-controller": "0.14.0-preview-9d476a5",
  "@metamask-previews/permission-controller": "11.0.3-preview-9d476a5",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-9d476a5",
  "@metamask-previews/phishing-controller": "12.3.0-preview-9d476a5",
  "@metamask-previews/polling-controller": "12.0.1-preview-9d476a5",
  "@metamask-previews/preferences-controller": "15.0.0-preview-9d476a5",
  "@metamask-previews/profile-sync-controller": "2.0.0-preview-9d476a5",
  "@metamask-previews/queued-request-controller": "7.0.1-preview-9d476a5",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-9d476a5",
  "@metamask-previews/selected-network-controller": "19.0.0-preview-9d476a5",
  "@metamask-previews/signature-controller": "23.0.0-preview-9d476a5",
  "@metamask-previews/transaction-controller": "40.0.0-preview-9d476a5",
  "@metamask-previews/user-operation-controller": "19.0.0-preview-9d476a5"
}

@MajorLift MajorLift requested a review from Gudahtt November 25, 2024 12:01
@MajorLift MajorLift marked this pull request as draft November 25, 2024 17:09
@MajorLift
Copy link
Contributor 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": "20.0.0-preview-aefb09ff",
  "@metamask-previews/address-book-controller": "6.0.1-preview-aefb09ff",
  "@metamask-previews/announcement-controller": "7.0.1-preview-aefb09ff",
  "@metamask-previews/approval-controller": "7.1.1-preview-aefb09ff",
  "@metamask-previews/assets-controllers": "45.1.0-preview-aefb09ff",
  "@metamask-previews/base-controller": "7.0.2-preview-aefb09ff",
  "@metamask-previews/build-utils": "3.0.1-preview-aefb09ff",
  "@metamask-previews/chain-controller": "0.2.0-preview-aefb09ff",
  "@metamask-previews/composable-controller": "9.0.1-preview-aefb09ff",
  "@metamask-previews/controller-utils": "11.4.3-preview-aefb09ff",
  "@metamask-previews/ens-controller": "15.0.0-preview-aefb09ff",
  "@metamask-previews/eth-json-rpc-provider": "4.1.6-preview-aefb09ff",
  "@metamask-previews/gas-fee-controller": "22.0.1-preview-aefb09ff",
  "@metamask-previews/json-rpc-engine": "10.0.1-preview-aefb09ff",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.5-preview-aefb09ff",
  "@metamask-previews/keyring-controller": "19.0.0-preview-aefb09ff",
  "@metamask-previews/logging-controller": "6.0.2-preview-aefb09ff",
  "@metamask-previews/message-manager": "11.0.1-preview-aefb09ff",
  "@metamask-previews/multichain": "1.0.0-preview-aefb09ff",
  "@metamask-previews/name-controller": "8.0.1-preview-aefb09ff",
  "@metamask-previews/network-controller": "22.0.2-preview-aefb09ff",
  "@metamask-previews/notification-controller": "7.0.0-preview-aefb09ff",
  "@metamask-previews/notification-services-controller": "0.14.0-preview-aefb09ff",
  "@metamask-previews/permission-controller": "11.0.3-preview-aefb09ff",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-aefb09ff",
  "@metamask-previews/phishing-controller": "12.3.0-preview-aefb09ff",
  "@metamask-previews/polling-controller": "12.0.1-preview-aefb09ff",
  "@metamask-previews/preferences-controller": "15.0.0-preview-aefb09ff",
  "@metamask-previews/profile-sync-controller": "2.0.0-preview-aefb09ff",
  "@metamask-previews/queued-request-controller": "7.0.1-preview-aefb09ff",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-aefb09ff",
  "@metamask-previews/selected-network-controller": "19.0.0-preview-aefb09ff",
  "@metamask-previews/signature-controller": "23.0.0-preview-aefb09ff",
  "@metamask-previews/transaction-controller": "40.0.0-preview-aefb09ff",
  "@metamask-previews/user-operation-controller": "19.0.0-preview-aefb09ff"
}

@MajorLift
Copy link
Contributor 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": "20.0.0-preview-9959ebb6",
  "@metamask-previews/address-book-controller": "6.0.1-preview-9959ebb6",
  "@metamask-previews/announcement-controller": "7.0.1-preview-9959ebb6",
  "@metamask-previews/approval-controller": "7.1.1-preview-9959ebb6",
  "@metamask-previews/assets-controllers": "45.1.0-preview-9959ebb6",
  "@metamask-previews/base-controller": "7.0.2-preview-9959ebb6",
  "@metamask-previews/build-utils": "3.0.1-preview-9959ebb6",
  "@metamask-previews/chain-controller": "0.2.0-preview-9959ebb6",
  "@metamask-previews/composable-controller": "9.0.1-preview-9959ebb6",
  "@metamask-previews/controller-utils": "11.4.3-preview-9959ebb6",
  "@metamask-previews/ens-controller": "15.0.0-preview-9959ebb6",
  "@metamask-previews/eth-json-rpc-provider": "4.1.6-preview-9959ebb6",
  "@metamask-previews/gas-fee-controller": "22.0.1-preview-9959ebb6",
  "@metamask-previews/json-rpc-engine": "10.0.1-preview-9959ebb6",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.5-preview-9959ebb6",
  "@metamask-previews/keyring-controller": "19.0.0-preview-9959ebb6",
  "@metamask-previews/logging-controller": "6.0.2-preview-9959ebb6",
  "@metamask-previews/message-manager": "11.0.1-preview-9959ebb6",
  "@metamask-previews/multichain": "1.0.0-preview-9959ebb6",
  "@metamask-previews/name-controller": "8.0.1-preview-9959ebb6",
  "@metamask-previews/network-controller": "22.0.2-preview-9959ebb6",
  "@metamask-previews/notification-controller": "7.0.0-preview-9959ebb6",
  "@metamask-previews/notification-services-controller": "0.14.0-preview-9959ebb6",
  "@metamask-previews/permission-controller": "11.0.3-preview-9959ebb6",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-9959ebb6",
  "@metamask-previews/phishing-controller": "12.3.0-preview-9959ebb6",
  "@metamask-previews/polling-controller": "12.0.1-preview-9959ebb6",
  "@metamask-previews/preferences-controller": "15.0.0-preview-9959ebb6",
  "@metamask-previews/profile-sync-controller": "2.0.0-preview-9959ebb6",
  "@metamask-previews/queued-request-controller": "7.0.1-preview-9959ebb6",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-9959ebb6",
  "@metamask-previews/selected-network-controller": "19.0.0-preview-9959ebb6",
  "@metamask-previews/signature-controller": "23.0.0-preview-9959ebb6",
  "@metamask-previews/transaction-controller": "40.0.0-preview-9959ebb6",
  "@metamask-previews/user-operation-controller": "19.0.0-preview-9959ebb6"
}

@MajorLift
Copy link
Contributor 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": "20.0.0-preview-ebca6967",
  "@metamask-previews/address-book-controller": "6.0.1-preview-ebca6967",
  "@metamask-previews/announcement-controller": "7.0.1-preview-ebca6967",
  "@metamask-previews/approval-controller": "7.1.1-preview-ebca6967",
  "@metamask-previews/assets-controllers": "45.1.0-preview-ebca6967",
  "@metamask-previews/base-controller": "7.0.2-preview-ebca6967",
  "@metamask-previews/build-utils": "3.0.1-preview-ebca6967",
  "@metamask-previews/chain-controller": "0.2.0-preview-ebca6967",
  "@metamask-previews/composable-controller": "9.0.1-preview-ebca6967",
  "@metamask-previews/controller-utils": "11.4.3-preview-ebca6967",
  "@metamask-previews/ens-controller": "15.0.0-preview-ebca6967",
  "@metamask-previews/eth-json-rpc-provider": "4.1.6-preview-ebca6967",
  "@metamask-previews/gas-fee-controller": "22.0.1-preview-ebca6967",
  "@metamask-previews/json-rpc-engine": "10.0.1-preview-ebca6967",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.5-preview-ebca6967",
  "@metamask-previews/keyring-controller": "19.0.0-preview-ebca6967",
  "@metamask-previews/logging-controller": "6.0.2-preview-ebca6967",
  "@metamask-previews/message-manager": "11.0.1-preview-ebca6967",
  "@metamask-previews/multichain": "1.0.0-preview-ebca6967",
  "@metamask-previews/name-controller": "8.0.1-preview-ebca6967",
  "@metamask-previews/network-controller": "22.0.2-preview-ebca6967",
  "@metamask-previews/notification-controller": "7.0.0-preview-ebca6967",
  "@metamask-previews/notification-services-controller": "0.14.0-preview-ebca6967",
  "@metamask-previews/permission-controller": "11.0.3-preview-ebca6967",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-ebca6967",
  "@metamask-previews/phishing-controller": "12.3.0-preview-ebca6967",
  "@metamask-previews/polling-controller": "12.0.1-preview-ebca6967",
  "@metamask-previews/preferences-controller": "15.0.0-preview-ebca6967",
  "@metamask-previews/profile-sync-controller": "2.0.0-preview-ebca6967",
  "@metamask-previews/queued-request-controller": "7.0.1-preview-ebca6967",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-ebca6967",
  "@metamask-previews/selected-network-controller": "19.0.0-preview-ebca6967",
  "@metamask-previews/signature-controller": "23.0.0-preview-ebca6967",
  "@metamask-previews/transaction-controller": "40.0.0-preview-ebca6967",
  "@metamask-previews/user-operation-controller": "19.0.0-preview-ebca6967"
}

@MajorLift MajorLift force-pushed the jongsun/perf/composable-controller/241124-remove-expensive-reduce branch 3 times, most recently from c09346e to 2b9717c Compare November 26, 2024 12:46
@MajorLift
Copy link
Contributor 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": "20.0.0-preview-2b9717c",
  "@metamask-previews/address-book-controller": "6.0.1-preview-2b9717c",
  "@metamask-previews/announcement-controller": "7.0.1-preview-2b9717c",
  "@metamask-previews/approval-controller": "7.1.1-preview-2b9717c",
  "@metamask-previews/assets-controllers": "45.1.0-preview-2b9717c",
  "@metamask-previews/base-controller": "7.0.2-preview-2b9717c",
  "@metamask-previews/build-utils": "3.0.1-preview-2b9717c",
  "@metamask-previews/chain-controller": "0.2.0-preview-2b9717c",
  "@metamask-previews/composable-controller": "9.0.1-preview-2b9717c",
  "@metamask-previews/controller-utils": "11.4.3-preview-2b9717c",
  "@metamask-previews/ens-controller": "15.0.0-preview-2b9717c",
  "@metamask-previews/eth-json-rpc-provider": "4.1.6-preview-2b9717c",
  "@metamask-previews/gas-fee-controller": "22.0.1-preview-2b9717c",
  "@metamask-previews/json-rpc-engine": "10.0.1-preview-2b9717c",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.5-preview-2b9717c",
  "@metamask-previews/keyring-controller": "19.0.0-preview-2b9717c",
  "@metamask-previews/logging-controller": "6.0.2-preview-2b9717c",
  "@metamask-previews/message-manager": "11.0.1-preview-2b9717c",
  "@metamask-previews/multichain": "1.0.0-preview-2b9717c",
  "@metamask-previews/name-controller": "8.0.1-preview-2b9717c",
  "@metamask-previews/network-controller": "22.0.2-preview-2b9717c",
  "@metamask-previews/notification-controller": "7.0.0-preview-2b9717c",
  "@metamask-previews/notification-services-controller": "0.14.0-preview-2b9717c",
  "@metamask-previews/permission-controller": "11.0.3-preview-2b9717c",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-2b9717c",
  "@metamask-previews/phishing-controller": "12.3.0-preview-2b9717c",
  "@metamask-previews/polling-controller": "12.0.1-preview-2b9717c",
  "@metamask-previews/preferences-controller": "15.0.0-preview-2b9717c",
  "@metamask-previews/profile-sync-controller": "2.0.0-preview-2b9717c",
  "@metamask-previews/queued-request-controller": "7.0.1-preview-2b9717c",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-2b9717c",
  "@metamask-previews/selected-network-controller": "19.0.0-preview-2b9717c",
  "@metamask-previews/signature-controller": "23.0.0-preview-2b9717c",
  "@metamask-previews/transaction-controller": "40.1.0-preview-2b9717c",
  "@metamask-previews/user-operation-controller": "19.0.0-preview-2b9717c"
}

@MajorLift
Copy link
Contributor Author

@metamaskbot publish-preview

@MajorLift MajorLift force-pushed the jongsun/perf/composable-controller/241124-remove-expensive-reduce branch from a0b32c1 to 244f6c8 Compare December 3, 2024 15:04
Copy link
Contributor

github-actions bot commented Dec 3, 2024

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.0-preview-a0b32c13",
  "@metamask-previews/address-book-controller": "6.0.1-preview-a0b32c13",
  "@metamask-previews/announcement-controller": "7.0.1-preview-a0b32c13",
  "@metamask-previews/approval-controller": "7.1.1-preview-a0b32c13",
  "@metamask-previews/assets-controllers": "45.1.0-preview-a0b32c13",
  "@metamask-previews/base-controller": "7.0.2-preview-a0b32c13",
  "@metamask-previews/build-utils": "3.0.1-preview-a0b32c13",
  "@metamask-previews/chain-controller": "0.2.0-preview-a0b32c13",
  "@metamask-previews/composable-controller": "9.0.1-preview-a0b32c13",
  "@metamask-previews/controller-utils": "11.4.3-preview-a0b32c13",
  "@metamask-previews/ens-controller": "15.0.0-preview-a0b32c13",
  "@metamask-previews/eth-json-rpc-provider": "4.1.6-preview-a0b32c13",
  "@metamask-previews/gas-fee-controller": "22.0.1-preview-a0b32c13",
  "@metamask-previews/json-rpc-engine": "10.0.1-preview-a0b32c13",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.5-preview-a0b32c13",
  "@metamask-previews/keyring-controller": "19.0.0-preview-a0b32c13",
  "@metamask-previews/logging-controller": "6.0.2-preview-a0b32c13",
  "@metamask-previews/message-manager": "11.0.1-preview-a0b32c13",
  "@metamask-previews/multichain": "1.0.0-preview-a0b32c13",
  "@metamask-previews/name-controller": "8.0.1-preview-a0b32c13",
  "@metamask-previews/network-controller": "22.0.2-preview-a0b32c13",
  "@metamask-previews/notification-controller": "7.0.0-preview-a0b32c13",
  "@metamask-previews/notification-services-controller": "0.14.0-preview-a0b32c13",
  "@metamask-previews/permission-controller": "11.0.3-preview-a0b32c13",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-a0b32c13",
  "@metamask-previews/phishing-controller": "12.3.0-preview-a0b32c13",
  "@metamask-previews/polling-controller": "12.0.1-preview-a0b32c13",
  "@metamask-previews/preferences-controller": "15.0.0-preview-a0b32c13",
  "@metamask-previews/profile-sync-controller": "2.0.0-preview-a0b32c13",
  "@metamask-previews/queued-request-controller": "7.0.1-preview-a0b32c13",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-a0b32c13",
  "@metamask-previews/selected-network-controller": "19.0.0-preview-a0b32c13",
  "@metamask-previews/signature-controller": "23.0.0-preview-a0b32c13",
  "@metamask-previews/transaction-controller": "40.1.0-preview-a0b32c13",
  "@metamask-previews/user-operation-controller": "19.0.0-preview-a0b32c13"
}

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few suggestions/questions.

Copy link
Contributor Author

@MajorLift MajorLift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add links to changelog entries

packages/composable-controller/CHANGELOG.md Outdated Show resolved Hide resolved
packages/composable-controller/CHANGELOG.md Outdated Show resolved Hide resolved
packages/composable-controller/CHANGELOG.md Outdated Show resolved Hide resolved
@MajorLift MajorLift requested a review from a team December 4, 2024 17:13
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MajorLift MajorLift merged commit 3a7d680 into main Dec 5, 2024
121 checks passed
@MajorLift MajorLift deleted the jongsun/perf/composable-controller/241124-remove-expensive-reduce branch December 5, 2024 02:33
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Dec 9, 2024
…`^10.0.0` (#10441)

## **Description**

This commit updates `@metamask/composable-controller` to `^10.0.0`. 

This involves fixing bugs outlined in
#10073, and applying
the major changes to the `ComposableController` API that has accumulated
between the intervening versions.

## Blocked by

- MetaMask/core#4968
- `composable-controller` v10 has been written to ensure that the effect
of this optimization is maximized.
- #12348
- #12407
- ~#11162

## Changelog

### Changed

- **BREAKING:** Bump `@metamask/composable-controller` from `^3.0.0` to
`^10.0.0`.
- **BREAKING:** Instantiate `ComposableController` class constructor
option `messenger` with a `RestrictedControllerMessenger` instance
derived from the `controllerMessenger` class field instance of `Engine`,
instead of passing in the unrestricted `controllerMessenger` instance
directly.
- **BREAKING:** Narrow external actions allowlist for `messenger`
instance passed into `ComposableController` constructor from
`GlobalActions['type']` to an empty union.
- **BREAKING:** Narrow external events allowlist for `messenger`
instance passed into `ComposableController` constructor from
`GlobalEvents['type']` to a union of the `stateChange` events of all
controllers included in the `EngineState` type.
- Convert the `EngineState` interface to use type alias syntax to ensure
compatibility with types used in MetaMask controllers.

### Fixed

- **BREAKING:** Narrow `Engine` class `datamodel` field from `any` to
`ComposableController<EngineState, StatefulControllers>`.
- **BREAKING:** The `CurrencyRatesController` constructor now normalizes
`null` into 0 for the `conversionRate` values of all native currencies
keyed in the `currencyRates` object of `CurrencyRatesControllerState`.
- Restore previously suppressed type-level validation for
`ComposableController` constructor option `controllers`.

## **Related issues**

- Closes #10073
- Applies MetaMask/core#4467
  - Blocked by `@metamask/composable-controller@8.0.0` release.
- Supersedes #10011

## **Manual testing steps**

## **Screenshots/Recordings**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/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: Salah-Eddine Saakoun <salah-eddine.saakoun@consensys.net>
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jan 27, 2025
…12509)

## **Description**

- ~Define types: `ReduxStore`, `ReduxState`~ (superseded by
#12538)
- Fix `any` types in `EngineService`.
- Optimize `EngineService` event subscriptions:
- Fix `update_bg_state_cb` callback being re-defined on every iteration.
- Consolidate `stateChange` events collections into
`BACKGROUND_STATE_CHANGE_EVENT_NAMES` constant for maintainability.

## **Related issues**

- Blocked by #10441
- Blocked by MetaMask/core#4968 and
corresponding release.

## **Manual testing steps**

## **Screenshots/Recordings**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-performance Issues relating to slowness of app, cpu usage, and/or blank screens. team-tiger Tiger team (for tech debt reduction + performance improvements) team-wallet-framework
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants