Skip to content

Commit

Permalink
feat: account sync - primary SRP filtering, bulk accounts creation an…
Browse files Browse the repository at this point in the history
…d synced accounts limit removal #30317 (#30529)

## **Description**

This PR bumps:

- `@metamask/profile-sync-controller` from `^7.0.1` to `^8.1.0`

This package bump alongside the files changed will ensure that:
- Account syncing will only "care" about primary SRP HD keyring accounts
- This doesn't change the current implementation of account syncing, it
will only ensure that if multi-SRP releases before account syncing fully
supports it, nothing will break and account sync will still work at
least the same as of right now
- During account syncing, new accounts will be added in bulk
- This will vastly improve client performance by being able to batch RPC
calls that previously happened sequentially when we added accounts one
by one
    - We are then removing the maximum accounts to sync limit

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30529?quickstart=1)

## **Related issues**

Related to:
- https://consensyssoftware.atlassian.net/browse/IDENTITY-28
- https://consensyssoftware.atlassian.net/browse/IDENTITY-6

## **Manual testing steps**

1. Import an SRP with a lot of accounts synced
2. Verify that every account is added
3. Verify that you can sync more than 100 accounts

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

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

- [x] 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.
  • Loading branch information
mathieuartu authored Feb 24, 2025
1 parent 5a44781 commit cfa0467
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
4 changes: 3 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ import {
BridgeUserAction,
BridgeBackgroundAction,
} from '../../shared/types/bridge';
import { isProduction } from '../../shared/modules/environment';
import {
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
handleMMITransactionUpdate,
Expand Down Expand Up @@ -1267,6 +1268,7 @@ export default class MetamaskController extends EventEmitter {
state: initState.UserStorageController,
config: {
accountSyncing: {
maxNumberOfAccountsToAdd: isProduction() ? undefined : 100,
onAccountAdded: (profileId) => {
this.metaMetricsController.trackEvent({
category: MetaMetricsEventCategory.ProfileSyncing,
Expand Down Expand Up @@ -1312,7 +1314,7 @@ export default class MetamaskController extends EventEmitter {
name: 'UserStorageController',
allowedActions: [
'KeyringController:getState',
'KeyringController:addNewAccount',
'KeyringController:withKeyring',
'SnapController:handleRequest',
'AuthenticationController:getBearerToken',
'AuthenticationController:getSessionProfile',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
"@metamask/post-message-stream": "^9.0.0",
"@metamask/ppom-validator": "0.36.0",
"@metamask/preinstalled-example-snap": "^0.3.0",
"@metamask/profile-sync-controller": "^7.0.1",
"@metamask/profile-sync-controller": "^8.1.1",
"@metamask/providers": "^20.0.0",
"@metamask/queued-request-controller": "^7.0.1",
"@metamask/rate-limit-controller": "^6.0.3",
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5564,9 +5564,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/keyring-controller@npm:^19.0.7, @metamask/keyring-controller@npm:^19.2.0":
version: 19.2.0
resolution: "@metamask/keyring-controller@npm:19.2.0"
"@metamask/keyring-controller@npm:^19.2.0, @metamask/keyring-controller@npm:^19.2.1":
version: 19.2.1
resolution: "@metamask/keyring-controller@npm:19.2.1"
dependencies:
"@ethereumjs/util": "npm:^8.1.0"
"@keystonehq/metamask-airgapped-keyring": "npm:^0.14.1"
Expand All @@ -5575,18 +5575,18 @@ __metadata:
"@metamask/eth-hd-keyring": "npm:^10.0.0"
"@metamask/eth-sig-util": "npm:^8.2.0"
"@metamask/eth-simple-keyring": "npm:^8.1.0"
"@metamask/keyring-api": "npm:^17.0.0"
"@metamask/keyring-internal-api": "npm:^4.0.1"
"@metamask/keyring-api": "npm:^17.2.0"
"@metamask/keyring-internal-api": "npm:^4.0.3"
"@metamask/utils": "npm:^11.2.0"
async-mutex: "npm:^0.5.0"
ethereumjs-wallet: "npm:^1.0.1"
immer: "npm:^9.0.6"
ulid: "npm:^2.3.0"
checksum: 10/ba8e874ef37cf2dda112aa7265c01c21291d9143d72a2748fcf1e056a3734c4ca1712ffe8d026889bbcea5ccbdfe1bc8e71a40c5ffb1ef618e472d009135a5a7
checksum: 10/e9715a0743689c54843fd68f58ba1a577fd2f1a3ff104bd2e3d592c9246c56098f90288fab6c0d511e4a7115d2e9b835862885f37c3495aa2dd12db7df673326
languageName: node
linkType: hard

"@metamask/keyring-internal-api@npm:^4.0.1, @metamask/keyring-internal-api@npm:^4.0.3":
"@metamask/keyring-internal-api@npm:^4.0.3":
version: 4.0.3
resolution: "@metamask/keyring-internal-api@npm:4.0.3"
dependencies:
Expand Down Expand Up @@ -6032,13 +6032,13 @@ __metadata:
languageName: node
linkType: hard

"@metamask/profile-sync-controller@npm:^7.0.1":
version: 7.0.1
resolution: "@metamask/profile-sync-controller@npm:7.0.1"
"@metamask/profile-sync-controller@npm:^8.1.1":
version: 8.1.1
resolution: "@metamask/profile-sync-controller@npm:8.1.1"
dependencies:
"@metamask/base-controller": "npm:^8.0.0"
"@metamask/keyring-api": "npm:^17.0.0"
"@metamask/keyring-controller": "npm:^19.0.7"
"@metamask/keyring-api": "npm:^17.2.0"
"@metamask/keyring-controller": "npm:^19.2.1"
"@metamask/network-controller": "npm:^22.2.1"
"@metamask/snaps-sdk": "npm:^6.17.1"
"@metamask/snaps-utils": "npm:^8.10.0"
Expand All @@ -6048,13 +6048,13 @@ __metadata:
loglevel: "npm:^1.8.1"
siwe: "npm:^2.3.2"
peerDependencies:
"@metamask/accounts-controller": ^23.0.0
"@metamask/accounts-controller": ^24.0.0
"@metamask/keyring-controller": ^19.0.0
"@metamask/network-controller": ^22.0.0
"@metamask/providers": ^18.1.0
"@metamask/snaps-controllers": ^9.19.0
webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0
checksum: 10/752a3ccf9ccc498ca05ba0272dbf7995a28a005749c7dd33b4b927d23f415150ea505fe76883311a38121df196f40dc771df63e3ba2239e0b3108e98a1836fdf
checksum: 10/4b18a546c0d78f010fbf1cf16644001ba0139c60941ceb70b83c7850e2fafcd5d17b8148f8020dcfe0e8c3f897259480077fa6b4402f4d270ed68e248d628369
languageName: node
linkType: hard

Expand Down Expand Up @@ -26988,7 +26988,7 @@ __metadata:
"@metamask/ppom-validator": "npm:0.36.0"
"@metamask/preferences-controller": "npm:^15.0.2"
"@metamask/preinstalled-example-snap": "npm:^0.3.0"
"@metamask/profile-sync-controller": "npm:^7.0.1"
"@metamask/profile-sync-controller": "npm:^8.1.1"
"@metamask/providers": "npm:^20.0.0"
"@metamask/queued-request-controller": "npm:^7.0.1"
"@metamask/rate-limit-controller": "npm:^6.0.3"
Expand Down

0 comments on commit cfa0467

Please sign in to comment.