-
Notifications
You must be signed in to change notification settings - Fork 20.9k
accounts: switch Ledger derivation path to canonical one #19438
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
accounts: switch Ledger derivation path to canonical one #19438
Conversation
That is incorrect, it only derives |
@gballet I've already given you an example yesterday on chat that your code was wrong:
|
Self derivation runs periodically when certain events hit. It's not a one-shot method. You will derive new empty accounts every time it's run an the last one is not empty. |
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.
Checked that the derivation still works with the smartcard, LGTM.
The crux of this PR is adding support for the new Ledger derivation path (standardised), opposed to the old one they used.
This could have been done trivially (#17387), at the expense of dropping support for the old paths. That's not really an option, because it would result in people losing default access to those accounts and freaking out (even though they could be recovered manually).
An alternative approach proposed was in #19358, which introduced a CLI flag to switch between the old and new paths. That doesn't fly either because the use all of a sudden needs to be aware of deterministic wallet internals just to use a HW wallet.
This PR takes a more complex approach that keeps the dirty details hidden. It extends self derivation to support multiple base paths. This ensures that HW wallets can discover non-zero accounts from both the legacy derivation path as well as the standardized one. One special case added is that the auto-derived last empty account is only done for the last derivation path (i.e. the standard one). This ensures that in time, people will switch over to new paths even if the old ones are currently used.
Beside the above feature, this PR does 2 changes:
Derive
method that Clef already uses, so the feature it not necessary.DefaultBaseDerivationPath
instead of creating a copy when deriving accounts.