Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
New and updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
6edd2a6 to
593186a
Compare
|
👍 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. |
|
@metamaskbot update-policies |
|
Policy update failed. You can review the logs or retry the policy update here |
|
@metamaskbot update-policies |
|
Policies updated |
|
@metamaskbot update-policies |
…ask/metamask-extension into feat/accounts-controller-2
Builds ready [1060e98]
Page Load Metrics (649 ± 271 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [9184101]
Page Load Metrics (279 ± 187 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [d9f20a9]
Page Load Metrics (465 ± 251 ms)
|
|
Tested commit d9f20a9 with Mac Sonoma 14.0 and primarily in chrome 117.0.5938.92 with some additional test on Firefox 119.0.1 and 120.0.0 Accounts tested: Signing, sending, deploying contracts, changing account names, removing individual accounts, forgetting devices, re-adding and signing some more all functioned as expected. Testing with throttled 3G network speeds was conducted. Migration testing confirms that user edited account names persist and migrated accounts can sign and send post-migration with no issue. |
Description
Currently, MetaMask faces tight coupling between its UI and the keyring-controller. The UI heavily relies on the keyring-controller's state while also amalgamating information from various sources, such as preferences and balances.
However, this approach presents some challenges. The keyring-controller must be aware of the UI's limitations, like the need for instant account list provision to avoid lag. Moreover, it takes on the responsibility of adding metadata to accounts, such as the associated keyring type, required for displaying account details.
To address these issues, the introduction of the accounts-controller comes into play as a new abstraction layer between the UI and the keyring-controller. This separation of responsibilities allows the keyring-controller to focus on two main tasks:
This PR introduces
@metamask/accounts-controllerand InternalAccounts to the background script. It is one of several PRs that will be switching the usage of identities to internal accounts.Changes:
getCaveatSpecificationsandgetPermissionSpecificationsusesgetInternalAccountsinstead ofgetIdentitiescaptureKeyringTypesWithMissingIdentitiesuses theInternalAccountmodel instead of anidentitygetAccountnow returns an InternalAccount, and uses the AccountsController'sgetSelectedAccountselectedAccountChangefrom the AccountsControllerselectedAddressfrom the PreferencesControllerselectedAccountChangefrom the AccountsControllerselectedAddressfrom the PreferencesControllerselectedAccountChangefrom the AccountsControlleronPreferencesStateChangeto subscribe toselectedAccountChangefrom the AccountsControllergetSelectedAddresstogetSelectedAccountsetupControllerEventSubscriptionsto subscribe toselectedAccountChangefrom the accounts controller and removes subscribing toselectedAddressfrom the PreferencesControllersetAccountLabelto use setAccountName from the AccountsControllercreateNewVaultAndKeychain- awaits forupdateAccountsand usessetSelectedAccountfrom the AccountsControllerAdditions:
setSelectedInternalAccountandsetAccountNameto the apiselectFirstIdentitytoselectFirstAccountresetAccountto use getSelectedAccountselectedAccountChangeto change accounts insetupControllerEventSubscriptionRelated issues
Resolves https://github.com/MetaMask/accounts-planning/issues/133
Manual testing steps
Screenshots/Recordings
No UI changes
Pre-merge author checklist
Pre-merge reviewer checklist