-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix(29917): Trezor accounts not able to add multiple HD path accounts into the account list #187
base: main
Are you sure you want to change the base?
Conversation
… into the account list
@metamaskbot publish-preview |
Preview builds have been published. See these instructions (from the Expand for full list of packages and versions.
|
this.accounts = []; | ||
this.page = 0; | ||
this.perPage = 5; | ||
this.unlockedAccount = 0; | ||
this.paths = {}; |
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.
Will the keyring still be able to sign transactions with the accounts previously derived with a different path? Since this.hdk
is specific to a path, after changing path we won't have the original public key used to derive the first accounts
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.
Indeed, previously derived accounts are not able to sign or send tx. I guess i need to check what we're doing with Ledger keyring as it's working there.
Thanks for catching this 🙂
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.
I think it's warranted to add a test case for this scenario as well
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.
the LedgerKeyring stores a map of AccountDetails
for each derived address, so even if the path is switched it can be retrieved again when signing:
const { hdPath } = accountDetails; |
expect(keyring.accounts).toStrictEqual([]); | ||
expect(keyring.page).toBe(0); | ||
expect(keyring.perPage).toBe(5); | ||
expect(keyring.hdk.publicKey).toBeNull(); | ||
expect(keyring.unlockedAccount).toBe(0); | ||
expect(keyring.paths).toStrictEqual({}); |
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.
should we test that these ones are unchanged instead?
Currently it's not possible to add accounts from different HDPaths with Trezor related devices. For some reason, on a path change we do the exact same operations than when we "forget" a device. This is not something that we do for ledger devices so it appears useless (and then creates bugs).
Fixes MetaMask/metamask-extension#29917