-
-
Notifications
You must be signed in to change notification settings - Fork 246
feat: add backup & sync capabilities to AccountTreeController
#6344
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
Conversation
packages/account-tree-controller/src/backup-and-sync/service/index.ts
Outdated
Show resolved
Hide resolved
packages/account-tree-controller/src/backup-and-sync/service/index.ts
Outdated
Show resolved
Hide resolved
packages/account-tree-controller/src/backup-and-sync/service/index.ts
Outdated
Show resolved
Hide resolved
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
packages/account-tree-controller/src/backup-and-sync/service/atomic-sync-queue.ts
Outdated
Show resolved
Hide resolved
packages/account-tree-controller/src/backup-and-sync/service/index.ts
Outdated
Show resolved
Hide resolved
packages/account-tree-controller/src/backup-and-sync/user-storage/network-operations.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (thanks a ton for addressing all this, we finally made it 💪)
(small remark though, I haven't reviewed the tests entirely, but we have good coverage and have run multiple real-case manual scenarios with preview builds, so we're good) |
Explanation
This PR introduces comprehensive backup and synchronization capabilities to
AccountTreeController
, adding account tree data persistence and cross-device synchronization through user storage.It adds one new public method to
AccountTreeController
,syncWithUserStorage
, that is intended to replace every current occurence ofUserStorageController:syncInternalAccountsWithUserStorage
in the clients.Legacy account syncing is still performed as a migration to multichain account syncing step, and is encompassed in this new
syncWithUserStorage
public method.The implementation features a new
BackupAndSyncService
with atomic sync queues, bidirectional metadata synchronization, and rollback mechanisms for failed operations.The service automatically triggers sync operations when users add and rename wallets/groups, change visibility states, or perform other metadata modifications. Analytics tracking and performance tracing provide observability into sync operations, while debug logging assists with troubleshooting sync issues.
It is worth noting that this PR also removes all account syncing code from
UserStorageController
.References
Checklist