feat: add multi-SRP EVM Account Syncing#32951
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. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
✨ Files requiring CODEOWNER review ✨🧩 @MetaMask/extension-devs (3 files, +0 -3)
🪪 @MetaMask/identity (14 files, +340 -14)
📜 @MetaMask/policy-reviewers (3 files, +0 -3)
🔗 @MetaMask/supply-chain (3 files, +0 -3)
|
Builds ready [3640442]
UI Startup Metrics (1207 ± 68 ms)
Benchmark value 1185 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 21 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 944 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 12 exceeds gate value 11 for firefox browserify home mean getState Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Sum of mean exceeds: 2ms | Sum of p95 exceeds: 16ms Sum of all benchmark exceeds: 18ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [344b959]
UI Startup Metrics (1185 ± 61 ms)
Benchmark value 20 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 40 exceeds gate value 33 for chrome browserify home p95 getState Benchmark value 11 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 36 exceeds gate value 27 for firefox browserify home p95 setupStore Sum of mean exceeds: 3ms | Sum of p95 exceeds: 18ms Sum of all benchmark exceeds: 21ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
@metamaskbot update-policies |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
Builds ready [48e60b8]
UI Startup Metrics (1180 ± 57 ms)
Benchmark value 29 exceeds gate value 24 for firefox browserify home p95 getState Benchmark value 1381 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1381 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 1361 exceeds gate value 1360 for firefox webpack home mean loadScripts Sum of mean exceeds: 4ms | Sum of p95 exceeds: 5ms Sum of all benchmark exceeds: 9ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…amask-extension into test/core-PR-5753-testdrive
Builds ready [2d5db7e]
UI Startup Metrics (1224 ± 54 ms)
Benchmark value 24 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Sum of mean exceeds: 1ms | Sum of p95 exceeds: 6ms Sum of all benchmark exceeds: 7ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
@metamaskbot update-policies |
|
No policy changes |
Builds ready [7a938a9]
UI Startup Metrics (1198 ± 60 ms)
Benchmark value 15 exceeds gate value 11 for firefox browserify home mean getState Benchmark value 11 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 36 exceeds gate value 24 for firefox browserify home p95 getState Benchmark value 34 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 1642 exceeds gate value 1615 for firefox webpack home mean uiStartup Benchmark value 1400 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1400 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 1378 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 1988 exceeds gate value 1935 for firefox webpack home p95 uiStartup Benchmark value 1702 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1701 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 1687 exceeds gate value 1630 for firefox webpack home p95 loadScripts Sum of mean exceeds: 91ms | Sum of p95 exceeds: 216ms Sum of all benchmark exceeds: 307ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
@MetaMask/policy-reviewers the policy changes are coming from |
Builds ready [877ce0c]
UI Startup Metrics (1214 ± 57 ms)
Benchmark value 1444 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1444 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 1423 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 2064 exceeds gate value 1935 for firefox webpack home p95 uiStartup Benchmark value 1729 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1727 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 55 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 1708 exceeds gate value 1630 for firefox webpack home p95 loadScripts Sum of mean exceeds: 244ms | Sum of p95 exceeds: 348ms Sum of all benchmark exceeds: 592ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [69d884f]
UI Startup Metrics (1194 ± 59 ms)
Benchmark value 263 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 12 exceeds gate value 11 for firefox browserify home mean getState Benchmark value 26 exceeds gate value 24 for firefox browserify home p95 getState Benchmark value 41 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 1663 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1663 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 1640 exceeds gate value 1630 for firefox webpack home p95 loadScripts Sum of mean exceeds: 4ms | Sum of p95 exceeds: 244ms Sum of all benchmark exceeds: 248ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [591d616]
UI Startup Metrics (1205 ± 71 ms)
Benchmark value 1283 exceeds gate value 1245 for firefox browserify home mean load Benchmark value 1283 exceeds gate value 1239 for firefox browserify home mean domContentLoaded Benchmark value 26 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 1262 exceeds gate value 1230 for firefox browserify home mean loadScripts Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 1772 exceeds gate value 1660 for firefox browserify home p95 uiStartup Benchmark value 1534 exceeds gate value 1495 for firefox browserify home p95 load Benchmark value 1534 exceeds gate value 1495 for firefox browserify home p95 domContentLoaded Benchmark value 1515 exceeds gate value 1475 for firefox browserify home p95 loadScripts Benchmark value 1381 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1381 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 42 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 1363 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 1966 exceeds gate value 1935 for firefox webpack home p95 uiStartup Benchmark value 1770 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1769 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 1751 exceeds gate value 1630 for firefox webpack home p95 loadScripts Sum of mean exceeds: 175ms | Sum of p95 exceeds: 601ms Sum of all benchmark exceeds: 776ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds multi-SRP support to EVM account syncing by updating controllers and storage logic to handle parallel sessions based on each SRP’s entropySource. Key changes include the introduction of SRP-specific identifiers in mocks and encrypted data, modifications to test cases and helper utilities to support multi-SRP flows, and updates to controller state and messaging to replace the legacy sessionData with srpSessionData.
Reviewed Changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/tests/identity/mocks.ts | Added SRP identifier generation logic for multi-SRP support |
| test/e2e/tests/identity/constants.ts | Added new constants for the second SRP |
| test/e2e/tests/identity/account-syncing/*.spec.ts | Updated end-to-end tests to cover multi-SRP scenarios |
| test/e2e/tests/identity/account-syncing/helpers.ts | Adjusted waiting condition in event counter helper |
| test/e2e/helpers/identity/user-storage/*.ts | Updated user storage controller tests to handle SrpIdentifier |
| shared/types/background.ts, app/scripts/controllers/.ts, app/scripts/ | Replaced legacy sessionData with srpSessionData to support multi-SRP |
| package.json, lavamoat/browserify/, app/scripts/migrations/ | Upgraded dependencies and updated policies/migrations for new design |
Comments suppressed due to low confidence (4)
app/scripts/controllers/metametrics-controller.ts:1207
- Extracting the profileId from the first entry of srpSessionData may be ambiguous when multiple SRP sessions are present. Consider explicitly selecting the intended SRP session.
[MetaMetricsUserTrait.ProfileId]: Object.entries(metamaskState.srpSessionData || {})?.[0]?.[1]?.profile?.profileId,
app/scripts/metamask-controller.js:4648
- If syncInternalAccountsWithUserStorage is asynchronous, consider awaiting its completion before releasing the lock to ensure data consistency.
this.userStorageController.syncInternalAccountsWithUserStorage();
test/e2e/tests/identity/account-syncing/sync-after-adding-account.spec.ts:108
- The expected event count has changed from 2 to 1; please ensure that this adjustment aligns with the intended behavior for multi-SRP event emissions.
await waitUntilEventsEmittedNumberEquals(1);
test/e2e/tests/identity/account-syncing/helpers.ts:45
- [nitpick] Using '>=' instead of '===' relaxes the wait condition, which may mask unexpected extra events; please verify that this behavior is intentional.
await driver.waitUntil(async () => counter >= expectedNumber, {
Builds ready [070e647]
UI Startup Metrics (1239 ± 77 ms)
Benchmark value 1075 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1068 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 836 exceeds gate value 800 for chrome browserify home mean firstPaint Benchmark value 1366 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1215 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1204 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1209 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 22 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 961 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 40 exceeds gate value 32 for chrome webpack home mean setupStore Benchmark value 2557 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 320 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 28 exceeds gate value 24 for firefox browserify home p95 getState Benchmark value 41 exceeds gate value 38 for firefox webpack home mean firstReactRender Sum of mean exceeds: 65ms | Sum of p95 exceeds: 466ms Sum of all benchmark exceeds: 531ms Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [e54a147]
UI Startup Metrics (1202 ± 55 ms)
Benchmark value 50 exceeds gate value 32 for chrome webpack home mean setupStore Benchmark value 308 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 26 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 43 exceeds gate value 38 for firefox webpack home mean firstReactRender Sum of mean exceeds: 25ms | Sum of p95 exceeds: 247ms Sum of all benchmark exceeds: 272ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [896f188]
UI Startup Metrics (1238 ± 83 ms)
Benchmark value 1063 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 23 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 39 exceeds gate value 32 for chrome webpack home mean setupStore Benchmark value 2462 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 314 exceeds gate value 65 for chrome webpack home p95 setupStore Benchmark value 41 exceeds gate value 38 for firefox webpack home mean firstReactRender Sum of mean exceeds: 16ms | Sum of p95 exceeds: 262ms Sum of all benchmark exceeds: 278ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR implements the core changes seen in this PR.
In short, this changes the implementation of
AuthenticationControllerso that it can manage parallel sessions based onentropySource.In turn, this addition permits
UserStorageControllerto scope user storage requests to a specificentropySource.Using all those changes, account syncing now iterates over each
entropySourcepresent in the client and syncs accounts in consequence. This will ensure that each SRP has its own data, that can be synced independently of the context (e.g Device 1 (SRP 1 + SRP 2), Device 2 (SRP 2 only) will bi-directionally sync).Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist