Skip to content

feat: add multi-SRP EVM Account Syncing#32951

Merged
mathieuartu merged 32 commits into
mainfrom
test/core-PR-5753-testdrive
Jun 11, 2025
Merged

feat: add multi-SRP EVM Account Syncing#32951
mathieuartu merged 32 commits into
mainfrom
test/core-PR-5753-testdrive

Conversation

@mathieuartu

@mathieuartu mathieuartu commented May 15, 2025

Copy link
Copy Markdown
Contributor

Description

This PR implements the core changes seen in this PR.
In short, this changes the implementation of AuthenticationController so that it can manage parallel sessions based on entropySource.
In turn, this addition permits UserStorageController to scope user storage requests to a specific entropySource.

Using all those changes, account syncing now iterates over each entropySource present 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).

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Import or create an SRP, complete onboarding, add and rename an EVM account
  2. Import a second SRP, add and rename an EVM account
  3. Uninstall and reinstall extension, onboard with one or both previous SRPs
  4. Verify that EVM accounts are restored

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

@mathieuartu mathieuartu self-assigned this May 15, 2025
@mathieuartu mathieuartu added the team-identity-deprecated DEPRECATED: team no longer exists label May 15, 2025
@github-actions

Copy link
Copy Markdown
Contributor

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.

@socket-security

socket-security Bot commented May 15, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​profile-sync-controller@​16.0.0 ⏵ 17.1.095 +310086 +1100 +1100

View full report

@metamaskbot

metamaskbot commented May 15, 2025

Copy link
Copy Markdown
Collaborator

✨ Files requiring CODEOWNER review ✨

🧩 @MetaMask/extension-devs (3 files, +0 -3)
  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +0 -1
      • 📁 flask/
        • 📄 policy.json +0 -1
      • 📁 main/
        • 📄 policy.json +0 -1

🪪 @MetaMask/identity (14 files, +340 -14)
  • 📁 app/
    • 📁 scripts/
      • 📁 controller-init/
        • 📁 messengers/
          • 📁 identity/
            • 📄 user-storage-controller-messenger.ts +3 -0
  • 📁 test/
    • 📁 e2e/
      • 📁 helpers/
        • 📁 identity/
          • 📁 user-storage/
            • 📄 generateEncryptedData.ts +6 -1
            • 📄 userStorageMockttpController.test.ts +66 -0
            • 📄 userStorageMockttpController.ts +31 -4
      • 📁 tests/
        • 📁 identity/
          • 📁 account-syncing/
            • 📄 helpers.ts +1 -1
            • 📄 new-user-sync.spec.ts +6 -2
            • 📄 sync-after-adding-account.spec.ts +1 -1
            • 📄 sync-with-multi-srp.spec.ts +170 -0
            • 📄 constants.ts +5 -1
            • 📄 mocks.ts +47 -4
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 identity/
          • 📁 backup-and-sync-features-toggles/
            • 📄 backup-and-sync-features-toggles.test.tsx +1 -0
          • 📁 backup-and-sync-toggle/
            • 📄 backup-and-sync-toggle.test.tsx +1 -0
        • 📁 modals/
          • 📁 identity/
            • 📁 turn-on-backup-and-sync-modal/
              • 📄 turn-on-backup-and-sync-modal.test.tsx +1 -0
    • 📁 hooks/
      • 📁 identity/
        • 📁 useAccountSyncing/
          • 📄 useAccountSyncing.test.tsx +1 -0

📜 @MetaMask/policy-reviewers (3 files, +0 -3)

[!TIP]
Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers.

  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +0 -1
      • 📁 flask/
        • 📄 policy.json +0 -1
      • 📁 main/
        • 📄 policy.json +0 -1

🔗 @MetaMask/supply-chain (3 files, +0 -3)
  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +0 -1
      • 📁 flask/
        • 📄 policy.json +0 -1
      • 📁 main/
        • 📄 policy.json +0 -1

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [3640442]
UI Startup Metrics (1207 ± 68 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1207110313866812551348
load104991712116710891193
domContentLoaded104391112046710831184
domInteractive16132831625
firstPaint712138119041310511146
backgroundConnect84244820
firstReactRender21154462138
getState15591111928
initialActions001000
loadScripts80167496566837944
setupStore85273817
WebpackHomeuiStartup21141713248716522312328
load16451328208813317301829
domContentLoaded16381324208313217241818
domInteractive15115391341
firstPaint1606633756185293
backgroundConnect2710295292952
firstReactRender1485335292251338
getState154317351228
initialActions317135
loadScripts16341323208113317231815
setupStore176301291826
FirefoxBrowserifyHomeuiStartup13401179201313113781582
load11911045167511012361408
domContentLoaded11911045167511012351408
domInteractive1043649649110160
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2113103132134
firstReactRender23196162230
getState11421427818
initialActions001001
loadScripts11731029158010612171391
setupStore10421623625
WebpackHomeuiStartup15091341195111515761727
load12901150165510513591502
domContentLoaded12901150165410513591502
domInteractive78522763077121
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect231582102444
firstReactRender35285553745
getState94386926
initialActions001011
loadScripts12701133163810513411473
setupStore11522923825
Benchmark value 1194 exceeds gate value 1190 for chrome browserify home p95 load
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!]
  • background: 708 Bytes (0.01%)
  • ui: 6.04 KiB (0.08%)
  • common: 3.14 KiB (0.03%)

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [344b959]
UI Startup Metrics (1185 ± 61 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1185107814186112231296
load103594912555810851123
domContentLoaded102892712475910781118
domInteractive16134041623
firstPaint721135117440110551122
backgroundConnect84375820
firstReactRender20165662134
getState16579122140
initialActions001000
loadScripts790694100159843892
setupStore74172812
WebpackHomeuiStartup21891696254616222942397
load16961298200811817761837
domContentLoaded16891293198011717671832
domInteractive161167111352
firstPaint1576431456177283
backgroundConnect299118183660
firstReactRender19855358109306348
getState144161161633
initialActions318145
loadScripts16841290195511917621830
setupStore1774172230
FirefoxBrowserifyHomeuiStartup13201123183413713671602
load11791004168412512251429
domContentLoaded11791004168412512241429
domInteractive963741443102161
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2113118132130
firstReactRender22193222227
getState74222811
initialActions001001
loadScripts1161990157012112111410
setupStore11422129636
WebpackHomeuiStartup15421359206814015891849
load13221156177911713771557
domContentLoaded13211156177911713761556
domInteractive80391401889119
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2514222232343
firstReactRender34294643743
getState95879923
initialActions102112
loadScripts12991140176011413511536
setupStore12522230818
Benchmark value 16 exceeds gate value 15 for chrome browserify home mean getState
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!]
  • background: 708 Bytes (0.01%)
  • ui: 6.13 KiB (0.09%)
  • common: 4.16 KiB (0.04%)

@mathieuartu

Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot

Copy link
Copy Markdown
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [48e60b8]
UI Startup Metrics (1180 ± 57 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1180108813765712051295
load102694011685110541129
domContentLoaded102093311625110491122
domInteractive16134241624
firstPaint735145116839610381110
backgroundConnect74264714
firstReactRender19143542130
getState1454891833
initialActions001001
loadScripts78268391949813879
setupStore84172814
WebpackHomeuiStartup21601763264317422962372
load16721357204512617611847
domContentLoaded16641353203912517541844
domInteractive15114681338
firstPaint1697239364197314
backgroundConnect3010175253477
firstReactRender18554365111302354
getState184321401530
initialActions316135
loadScripts16591352201512617511842
setupStore1674072032
FirefoxBrowserifyHomeuiStartup13311126181912413931585
load11851004163511412341410
domContentLoaded11841004163411412341410
domInteractive1003723230111158
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect20136582130
firstReactRender22193122227
getState11418425829
initialActions001001
loadScripts1167990161311312171389
setupStore8419119622
WebpackHomeuiStartup16121437211113716591888
load13811211186413314441642
domContentLoaded13801211186413314441641
domInteractive81361471891113
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23166172442
firstReactRender37295454049
getState95476920
initialActions002111
loadScripts13601197184113314221626
setupStore95303912
Benchmark value 12 exceeds gate value 11 for firefox browserify home mean getState
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!]
  • background: 789 Bytes (0.01%)
  • ui: 6.16 KiB (0.09%)
  • common: 4.16 KiB (0.04%)

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [2d5db7e]
UI Startup Metrics (1224 ± 54 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1224112313645412621324
load106897711785010981157
domContentLoaded106195811695110931149
domInteractive17142731726
firstPaint722138117143010871155
backgroundConnect84335723
firstReactRender20154342028
getState1453482031
initialActions001001
loadScripts81972892450851905
setupStore85192814
WebpackHomeuiStartup21611771240715222782345
load16941400189511717731878
domContentLoaded16871396188511717661871
domInteractive15125481339
firstPaint1626536761191275
backgroundConnect279109143252
firstReactRender1354235394250306
getState1244281429
initialActions316134
loadScripts16821373188412017621857
setupStore227324392035
FirefoxBrowserifyHomeuiStartup12981102227315013471566
load1160988209514212171396
domContentLoaded1160988209414212171396
domInteractive107381082104104164
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect18124951927
firstReactRender22195262228
getState10419120821
initialActions001001
loadScripts1144976207614212021379
setupStore73345613
WebpackHomeuiStartup15731371218317116421921
load13441183193514614161595
domContentLoaded13441183193414614161595
domInteractive81362892986134
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect231583102341
firstReactRender35294943643
getState11521821922
initialActions102111
loadScripts13251168191114513991576
setupStore12524031818
Benchmark value 1062 exceeds gate value 1061 for chrome browserify home mean domContentLoaded
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!]
  • background: 681 Bytes (0.01%)
  • ui: 346 Bytes (0%)
  • common: 1.25 KiB (0.01%)

@mathieuartu

Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot

Copy link
Copy Markdown
Collaborator

No policy changes

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [7a938a9]
UI Startup Metrics (1198 ± 60 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1198108413786012391306
load103694111665310701133
domContentLoaded102993711565310611128
domInteractive15132531624
firstPaint67894116741710561129
backgroundConnect84345822
firstReactRender18152621923
getState1453582029
initialActions001001
loadScripts79270292152825891
setupStore75152811
WebpackHomeuiStartup21661776243815922822377
load16871377202811917431887
domContentLoaded16791373202411917371862
domInteractive15115291340
firstPaint1726467577186269
backgroundConnect319277363257
firstReactRender14143353101248338
getState154170231432
initialActions317146
loadScripts16741371200111917351857
setupStore187269262029
FirefoxBrowserifyHomeuiStartup13461154177513213911642
load11871039159711512431444
domContentLoaded11871039159711512421444
domInteractive994018327116143
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2213191202137
firstReactRender23205472250
getState15420738836
initialActions001001
loadScripts11671021158211212301402
setupStore10419527634
WebpackHomeuiStartup16421446222415316901988
load14001225192814014631702
domContentLoaded14001225192814014631701
domInteractive83382152590125
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2516229212534
firstReactRender37315353946
getState1053361029
initialActions102111
loadScripts13781205191013814441687
setupStore86374911
Benchmark value 22 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
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!]
  • background: 681 Bytes (0.01%)
  • ui: 3.27 KiB (0.05%)
  • common: 1.29 KiB (0.01%)

Comment thread test/e2e/tests/identity/mocks.ts Fixed
@mathieuartu

Copy link
Copy Markdown
Contributor Author

@MetaMask/policy-reviewers the policy changes are coming from @metamask/profile-sync-controller.
We moved @metamask/keyring-api from being a dependency to a devDependency.

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [877ce0c]
UI Startup Metrics (1214 ± 57 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1214110913765712551323
load105195111765310861137
domContentLoaded104594511715210811132
domInteractive16133741628
firstPaint789167118739510781137
backgroundConnect74324712
firstReactRender20153542129
getState1464081928
initialActions001001
loadScripts79670392350828875
setupStore85212811
WebpackHomeuiStartup20691615261021622122422
load16351277201417917601926
domContentLoaded16291273200017917561921
domInteractive15114891344
firstPaint1615940264189303
backgroundConnect2510324402238
firstReactRender105433538195330
getState1044051117
initialActions318135
loadScripts16271272198917817551910
setupStore226311501539
FirefoxBrowserifyHomeuiStartup13511158179011614031624
load1196103415189912591411
domContentLoaded1196103415189912581410
domInteractive983724631108163
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect20138392128
firstReactRender24205352329
getState9423122811
initialActions001001
loadScripts1178102015039812331393
setupStore74828612
WebpackHomeuiStartup16621429217216717612064
load14441237197115915401729
domContentLoaded14431237197015915401727
domInteractive80381521884122
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23166462434
firstReactRender44306164755
getState12589101031
initialActions001011
loadScripts14231222195015915171708
setupStore95686812
Benchmark value 1662 exceeds gate value 1615 for firefox webpack home mean uiStartup
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!]
  • background: 188 Bytes (0%)
  • ui: 346 Bytes (0%)
  • common: 1.17 KiB (0.01%)

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [69d884f]
UI Startup Metrics (1194 ± 59 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1194109513435912421296
load103695011725410681144
domContentLoaded103094311675410591138
domInteractive16133951531
firstPaint705131118240610351125
backgroundConnect84284818
firstReactRender20164542028
getState1358091828
initialActions001000
loadScripts78370192153809893
setupStore75182811
WebpackHomeuiStartup20941581265022922292482
load16291251204717117481885
domContentLoaded16231247203417017431875
domInteractive15115381338
firstPaint1576140765175275
backgroundConnect2310261252336
firstReactRender14343352110299343
getState1145371231
initialActions315134
loadScripts16201245202316817411864
setupStore2863166217263
FirefoxBrowserifyHomeuiStartup13791210182612314311648
load12191056161510312781428
domContentLoaded12191055161410312781428
domInteractive943717726107134
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect231394122243
firstReactRender24215042431
getState12418725926
initialActions001001
loadScripts12001031157610212591403
setupStore847610712
WebpackHomeuiStartup15661351213216316731910
load13591169195614714541663
domContentLoaded13581168195614714541663
domInteractive77382462382116
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect22157782237
firstReactRender40295144349
getState125201201030
initialActions002111
loadScripts13391151194014614291640
setupStore11527427811
Benchmark value 2482 exceeds gate value 2454 for chrome webpack home p95 uiStartup
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!]
  • background: 513 Bytes (0.01%)
  • ui: 346 Bytes (0%)
  • common: 1.17 KiB (0.01%)

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [591d616]
UI Startup Metrics (1205 ± 71 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1205107714257112481332
load104493212386510871152
domContentLoaded103892712286510811144
domInteractive16133351629
firstPaint760133123439910621144
backgroundConnect74264813
firstReactRender20174042129
getState1454582028
initialActions001000
loadScripts79268596063829905
setupStore75162811
WebpackHomeuiStartup20941621258121422472440
load16311281199316417501864
domContentLoaded16221277198116217321851
domInteractive161170111249
firstPaint1685932252201275
backgroundConnect2511259252642
firstReactRender14843357109279348
getState1143561226
initialActions317135
loadScripts16191276197016017301840
setupStore206307411731
FirefoxBrowserifyHomeuiStartup14551255191713915231772
load12831090174613013451534
domContentLoaded12821090174613013451534
domInteractive1023924827116143
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect241497122452
firstReactRender26226352634
getState10519419914
initialActions001001
loadScripts12611073171812913261515
setupStore10419119716
WebpackHomeuiStartup15841356210116016511966
load13811173188115714521770
domContentLoaded13801173188115714521769
domInteractive76361922182116
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect22157792242
firstReactRender41295444447
getState94325924
initialActions002111
loadScripts13621158186315714351751
setupStore85284819
Benchmark value 1455 exceeds gate value 1405 for firefox browserify home mean uiStartup
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!]
  • background: 182 Bytes (0%)
  • ui: 346 Bytes (0%)
  • common: 1.17 KiB (0.01%)

@chrisleewilcox chrisleewilcox requested a review from Copilot June 5, 2025 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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, {

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [070e647]
UI Startup Metrics (1239 ± 77 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1239111915767712891366
load107495113137311111214
domContentLoaded106794613087311041204
domInteractive1813101101630
firstPaint836133134739310901209
backgroundConnect84294821
firstReactRender21167272135
getState1464071926
initialActions002001
loadScripts816698104872851960
setupStore85162812
WebpackHomeuiStartup21841696267521623202557
load17031345205017218201967
domContentLoaded16971342203717018141954
domInteractive16125591343
firstPaint1776163983219329
backgroundConnect22117092539
firstReactRender14944373112305362
getState134317311219
initialActions315134
loadScripts16941340202616918121943
setupStore3973538319320
FirefoxBrowserifyHomeuiStartup1311115916369713501542
load1162103214768612141323
domContentLoaded1162103214768612141323
domInteractive933524031101155
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect201264102047
firstReactRender22194432328
getState11417824828
initialActions001001
loadScripts1144101314628611951304
setupStore8315917613
WebpackHomeuiStartup15131364187810715811697
load13151170166010113731499
domContentLoaded13151170166010113721499
domInteractive73531381774127
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect21154962235
firstReactRender40295344346
getState95336929
initialActions102111
loadScripts12961147164310113551481
setupStore9521220810
Benchmark value 1240 exceeds gate value 1234 for chrome browserify home mean uiStartup
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!]
  • background: -105.46 KiB (-1.98%)
  • ui: 14.44 KiB (0.2%)
  • common: -4.4 KiB (-0.05%)

@mathieuartu mathieuartu marked this pull request as ready for review June 5, 2025 15:00
@mathieuartu mathieuartu requested review from a team as code owners June 5, 2025 15:00
@mathieuartu mathieuartu marked this pull request as draft June 6, 2025 11:35
@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [e54a147]
UI Startup Metrics (1202 ± 55 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1202108913175512491292
load104393511585310741134
domContentLoaded103692711525410701127
domInteractive16134051530
firstPaint78181115839610591128
backgroundConnect84325721
firstReactRender20153842029
getState1364081833
initialActions001001
loadScripts79369590753828887
setupStore85182813
WebpackHomeuiStartup20561589256423122152434
load16011197196318517481887
domContentLoaded15961190195018417431882
domInteractive15114781340
firstPaint1546649566177298
backgroundConnect21105772331
firstReactRender12241374100122343
getState194327501324
initialActions612993035
loadScripts15931186193918317411879
setupStore5073249321308
FirefoxBrowserifyHomeuiStartup13971219198211214461606
load1231105715419412981422
domContentLoaded1231105715419412971421
domInteractive1003629833115152
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2413202212354
firstReactRender25216172531
getState10424223911
initialActions001001
loadScripts1211104215279412821403
setupStore9418519715
WebpackHomeuiStartup15891359183511516871795
load13711166163311014491597
domContentLoaded13711165163311014481597
domInteractive76331401883116
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23176772439
firstReactRender42295344548
getState1053261031
initialActions002111
loadScripts13501150161011014281575
setupStore12526928919
Benchmark value 22 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
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!]
  • background: 188 Bytes (0%)
  • ui: 346 Bytes (0%)
  • common: 1.17 KiB (0.01%)

@metamaskbot

Copy link
Copy Markdown
Collaborator
Builds ready [896f188]
UI Startup Metrics (1238 ± 83 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1238111017738312821337
load106994515517911111175
domContentLoaded106292815448011041170
domInteractive181395101633
firstPaint78382156141310901175
backgroundConnect84315823
firstReactRender20163532127
getState1453472027
initialActions001000
loadScripts81569698165859924
setupStore85213913
WebpackHomeuiStartup21091594253422722872462
load16311252193316617391870
domContentLoaded16251248192416517331861
domInteractive15114481339
firstPaint1585959969182286
backgroundConnect21144262434
firstReactRender13443352103124348
getState1042541219
initialActions316135
loadScripts16221246191316417301850
setupStore3973398218314
FirefoxBrowserifyHomeuiStartup1368121216809614131562
load1212108115299412631429
domContentLoaded1212108115299412631428
domInteractive973619326110149
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2314117162350
firstReactRender24215742430
getState85405813
initialActions002001
loadScripts1190106415049312411371
setupStore7468668
WebpackHomeuiStartup15371362198613016211795
load13341165171111914311542
domContentLoaded13341165171111914301541
domInteractive76321451682109
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect20154952131
firstReactRender40264734346
getState85314917
initialActions002111
loadScripts13161144168911914131523
setupStore9522021811
Benchmark value 1238 exceeds gate value 1234 for chrome browserify home mean uiStartup
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!]
  • background: 188 Bytes (0%)
  • ui: 346 Bytes (0%)
  • common: 2.13 KiB (0.03%)

Comment thread lavamoat/browserify/beta/policy.json
@mathieuartu mathieuartu marked this pull request as ready for review June 11, 2025 10:00
@mathieuartu mathieuartu added this pull request to the merge queue Jun 11, 2025
Merged via the queue into main with commit 69ca296 Jun 11, 2025
146 checks passed
@mathieuartu mathieuartu deleted the test/core-PR-5753-testdrive branch June 11, 2025 10:30
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 11, 2025
@metamaskbot metamaskbot added the release-12.22.0 Issue or pull request that will be included in release 12.22.0 label Jun 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.22.0 Issue or pull request that will be included in release 12.22.0 team-identity-deprecated DEPRECATED: team no longer exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants