8000 feat: add `EventQueue` class util to guarantee the order of user-storage updates by mathieuartu · Pull Request #5937 · MetaMask/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add EventQueue class util to guarantee the order of user-storage updates #5937

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

Merged
merged 5 commits into from
Jun 10, 2025

Conversation

mathieuartu
Copy link
Contributor
@mathieuartu mathieuartu commented Jun 6, 2025

Explanation

This PR add a new EventQueue shared class util to the @metamask/profile-sync-controller package.
We are using this to ensure user-storage updates are executed and fulfilled in the actual order they were called.
For now, this is used for account syncing when reacting to AccountsController accountRenamed and accountAdded events.

This addition has been made in reaction to a recent change to extension code that made it so that when a user adds a new account, without changing the default name, both accountAdded and accountRenamed were fired.
This induced race conditions where we weren't in control of which user-storage request would land first.
With this change, we raise back our confidence to 100%.

References

Changelog

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 communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@mathieuartu mathieuartu self-assigned this Jun 6, 2025
@mathieuartu mathieuartu added the team-identity Identity Team changes. https://github.com/orgs/MetaMask/teams/identity label Jun 6, 2025
@mathieuartu mathieuartu marked this pull request as ready for review June 6, 2025 17:05
@mathieuartu mathieuartu requested review from a team as code owners June 6, 2025 17:05
@mathieuartu mathieuartu changed the title feat: add EventQueue class to guarantee sequential user-storage updates feat: add EventQueue class util to guarantee the order of user-storage updates Jun 6, 2025
@mathieuartu
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/account-tree-controller": "0.1.0-preview-1a1e4b40",
  "@metamask-previews/accounts-controller": "30.0.0-preview-1a1e4b40",
  "@metamask-previews/address-book-controller": "6.1.0-preview-1a1e4b40",
  "@metamask-previews/announcement-controller": "7.0.3-preview-1a1e4b40",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-1a1e4b40",
  "@metamask-previews/approval-controller": "7.1.3-preview-1a1e4b40",
  "@metamask-previews/assets-controllers": "68.0.0-preview-1a1e4b40",
  "@metamask-previews/base-controller": "8.0.1-preview-1a1e4b40",
  "@metamask-previews/bridge-controller": "32.1.1-preview-1a1e4b40",
  "@metamask-previews/bridge-status-controller": "29.1.0-preview-1a1e4b40",
  "@metamask-previews/build-utils": "3.0.3-preview-1a1e4b40",
  "@metamask-previews/chain-agnostic-permission": "0.7.0-preview-1a1e4b40",
  "@metamask-previews/composable-controller": "11.0.0-preview-1a1e4b40",
  "@metamask-previews/controller-utils": "11.9.0-preview-1a1e4b40",
  "@metamask-previews/delegation-controller": "0.4.0-preview-1a1e4b40",
  "@metamask-previews/earn-controller": "1.0.0-preview-1a1e4b40",
  "@metamask-previews/eip1193-permission-middleware": "0.1.0-preview-1a1e4b40",
  "@metamask-previews/ens-controller": "16.0.0-preview-1a1e4b40",
  "@metamask-previews/error-reporting-service": "1.0.0-preview-1a1e4b40",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-1a1e4b40",
  "@metamask-previews/foundryup": "1.0.0-preview-1a1e4b40",
  "@metamask-previews/gas-fee-controller": "23.0.0-preview-1a1e4b40",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-1a1e4b40",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-1a1e4b40",
  "@metamask-previews/keyring-controller": "22.0.2-preview-1a1e4b40",
  "@metamask-previews/logging-controller": "6.0.4-preview-1a1e4b40",
  "@metamask-previews/message-manager": "12.0.1-preview-1a1e4b40",
  "@metamask-previews/multichain": "4.1.0-preview-1a1e4b40",
  "@metamask-previews/multichain-api-middleware": "0.4.0-preview-1a1e4b40",
  "@metamask-previews/multichain-network-controller": "0.8.0-preview-1a1e4b40",
  "@metamask-previews/multichain-transactions-controller": "2.0.0-preview-1a1e4b40",
  "@metamask-previews/name-controller": "8.0.3-preview-1a1e4b40",
  "@metamask-previews/network-controller": "23.5.1-preview-1a1e4b40",
  "@metamask-previews/notification-services-controller": "10.0.0-preview-1a1e4b40",
  "@metamask-previews/permission-controller": "11.0.6-preview-1a1e4b40",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-1a1e4b40",
  "@metamask-previews/phishing-controller": "12.5.0-preview-1a1e4b40",
  "@metamask-previews/polling-controller": "13.0.0-preview-1a1e4b40",
  "@metamask-previews/preferences-controller": "18.1.0-preview-1a1e4b40",
  "@metamask-previews/profile-sync-controller": "17.0.0-preview-1a1e4b40",
  "@metamask-previews/queued-request-controller": "10.0.0-preview-1a1e4b40",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-1a1e4b40",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-1a1e4b40",
  "@metamask-previews/sample-controllers": "0.1.0-preview-1a1e4b40",
  "@metamask-previews/seedless-onboarding-controller": "1.0.0-preview-1a1e4b40",
  "@metamask-previews/selected-network-controller": "22.1.0-preview-1a1e4b40",
  "@metamask-previews/signature-controller": "30.0.0-preview-1a1e4b40",
  "@metamask-previews/token-search-discovery-controller": "3.2.0-preview-1a1e4b40",
  "@metamask-previews/transaction-controller": "57.1.0-preview-1a1e4b40",
  "@metamask-previews/user-operation-controller": "36.0.0-preview-1a1e4b40"
}

@mathieuartu mathieuartu enabled auto-merge (squash) June 10, 2025 10:24
@mathieuartu mathieuartu merged commit e03d8bc into main Jun 10, 2025
218 checks passed
@mathieuartu mathieuartu deleted the fix/account-sync-events branch June 10, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog team-identity Identity Team changes. https://github.com/orgs/MetaMask/teams/identity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0