-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Multi srp mvp #5112
base: main
Are you sure you want to change the base?
Multi srp mvp #5112
Conversation
@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.
|
1ab7570
to
407f96d
Compare
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
@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.
|
bc69ea1
to
b9ca305
Compare
<!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> The `KeyringController.verifySeedPhrase` method was not included in the mutable methods that lock the controller mutex because it doesn't change the state. Though, if another operation gets somehow overlapped (e.g. a consumer calls `addNewAccount`), the call to `verifySeedPhrase` can potentially fail. To fix this, this PR is moving verifySeedPhrase behind KeyringController's mutex. Since `addNewAccount` internally calls `verifySeedPhrase`, and having a lock on both would create a deadlock, the `verifySeedPhrase` implementation has been moved to an internal method. <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> - **FIXED**: `verifySeedPhrase` is now mutually exclusive - [ ] 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 highlighted breaking changes using the "BREAKING" category above as appropriate - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
b9ca305
to
83c8a21
Compare
@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.
|
Explanation
Currently, we assume that the only HD Keyring is the Primary Keyring. Most methods related to adding accounts or displaying the SRP assume that it refers to the first keyring, which is the Primary Keyring. To enable having more than one SRP, and consequently more than one HD Keyring, this PR adds an array called
keyringsMetadata
, which contains an id that can be used to identify all keyrings and a proper place to keep other data we might want to add to each keyring such asname
.keyringsMetadata
is a separate in order to minimize changes that we need to make to keyrings and the way we process them. We also can keep this data outside of the vault, as it's not storing any sensitive data.References
Related to ADR 0002-keyring-id-and-name.md
Blocks Extension PR
Changelog
@metamask/keyring-controller
{ id: string }
selector towithKeyring
functionkeyringId
param toaddNewAccount
functionkeyringId
param toexportSeedPhrase
functionkeyringId
param togetAccounts
functionkeyringId
param toverifySeedPhrase
function#getKeyringById
helper functionkeyringId
param to#verifySeedPhrase
functionmetadata
param to#newKeyring
functionmetadata
param to#newKeyring
functionChecklist