Skip to content
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

Sync stale vault on keyring store update #1384

Merged
merged 4 commits into from
May 25, 2023
Merged

Sync stale vault on keyring store update #1384

merged 4 commits into from
May 25, 2023

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented May 23, 2023

Description

Currently, KeyringController has a vault in state that is never updated after its construction, which doesn't make sense and poses the risk of clients using this stale value.

This "outer" vault should be always in sync with the "inner" vault managed by @metamask/eth-keyring-controller (this.#keyring in KeyringController).

This PR adds an EthKeyringController store subscription in the KeyringController constructor, syncing the vaults on each update.

Changes

  • FIXED: KeyringController and EthKeyingController vaults are now kept in sync

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation for new or updated code as appropriate (note: this will usually be JSDoc)
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@mikesposito mikesposito changed the title Update stale vault during fullUpdate Sync stale vault on keyring store update May 23, 2023
gantunesr
gantunesr previously approved these changes May 23, 2023
packages/keyring-controller/src/KeyringController.ts Outdated Show resolved Hide resolved
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@mikesposito mikesposito merged commit bc1d8ec into main May 25, 2023
@mikesposito mikesposito deleted the fix/stale-vault branch May 25, 2023 08:00
brad-decker pushed a commit to dragana8/core that referenced this pull request Jun 1, 2023
* fix: update vault during fullUpdate

* refactor: use event handler instead of fullUpdate

* docs: rollback fullUpdate description
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* fix: update vault during fullUpdate

* refactor: use event handler instead of fullUpdate

* docs: rollback fullUpdate description
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* fix: update vault during fullUpdate

* refactor: use event handler instead of fullUpdate

* docs: rollback fullUpdate description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants