accounts: switch Ledger derivation path to canonical one#19438
Merged
Conversation
gballet
reviewed
Apr 11, 2019
Member
That is incorrect, it only derives |
Member
Author
|
@gballet I've already given you an example yesterday on chat that your code was wrong: |
Member
Author
|
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. |
gballet
approved these changes
Apr 18, 2019
Member
gballet
left a comment
There was a problem hiding this comment.
Checked that the derivation still works with the smartcard, LGTM.
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Jan 24, 2025
MariusVanDerWijden
pushed a commit
to MariusVanDerWijden/go-ethereum
that referenced
this pull request
Feb 2, 2026
…-path accounts: switch Ledger derivation path to canonical one
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.
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:
Derivemethod that Clef already uses, so the feature it not necessary.DefaultBaseDerivationPathinstead of creating a copy when deriving accounts.