refactor(keyring-eth-hd)!: move seed generation to deserialization#100
Merged
refactor(keyring-eth-hd)!: move seed generation to deserialization#100
Conversation
Contributor
|
I haven't reviewed all the changes in detail, but the idea makes sense to me. I’d like to get @mikesposito’s opinion as well, as my main concern is the potential impact on the interface, other keyrings, and the KeyringController. |
mikesposito
approved these changes
Nov 25, 2024
Member
Author
|
@mikesposito We will have to update the KeyringController to await |
ccharly
reviewed
Nov 25, 2024
ccharly
approved these changes
Nov 25, 2024
7 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 26, 2024
…raphy (#102) <!-- 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 issues or other links reviewers should consult to understand this pull request better? For instance: * Fixes #12345 * See: #67890 --> Uses the latest version of `@metamask/keytree`, which allows passing `cryptographicFunctions` for derivation of the mnemonic seed. Also reintroduces constructor arguments to allow passing of `cryptographicFunctions` to `HdKeyring`. Follow-up PR to #100 --------- Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
mikesposito
added a commit
to MetaMask/utils
that referenced
this pull request
Nov 26, 2024
<!-- 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 issues or other links reviewers should consult to understand this pull request better? For instance: * Fixes #12345 * See: #67890 --> Our HD keyring [has been updated](MetaMask/accounts#100) to support different kinds of cryptographic functions to randomly generate a mnemonic, which may be an asynchronous operation in some cases. This PR updates the `generateRandomMnemonic` on the `Keyring` type accordingly, even though `eth-hd-keyring` does not implement the type yet, because `KeyringController` uses it as keyring interface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the
eth-hd-keyringconstructor to remove the deserialization step directly in the constructor. This lets us turndeserializeinto a proper async function and use an async version ofmnemonicToSeed(which should be swapped out for something faster in the future).This is a breaking change and requires that all usage of
eth-hd-keyringcallsdeserializewith the arguments previously passed into the constructor. This seems to already be the case in theKeyringController, but may deserve a more thorough look.This PR also changes the function signature of
generateRandomMnemonic, making this an async function as well.Appreciate any feedback and/or sanity checks on this!