Skip to content
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

Feat/classic hd derivation path #487

Merged
merged 8 commits into from
Aug 15, 2022
Merged

Conversation

meowsbits
Copy link
Contributor

@meowsbits meowsbits commented Jul 6, 2022

This PR builds from and replaces #452 (thanks @ziogaschr) which provided the pattern for configurable HD derivation path support. This branch has been rebased on master since then.

When --usb is used in conjunction with --classic or any testnet value (eg. --sepolia), the accounts package defaults will be configured accordingly for the HD derivation path logic and defaults.

Comments are left using Ethereum Classic values as examples.

ziogaschr and others added 4 commits July 6, 2022 07:39
Date: 2022-02-23 07:38:20-08:00
Signed-off-by: meows <[email protected]>
Date: 2022-07-06 07:42:26-07:00
Signed-off-by: meows <[email protected]>
…ults

A setter SetCoinTypeConfiguration is defined
to configure global vars and defaults given some
coin type.

The default is configured for Ethereum mainnet via
an init() function call in the hd.go file.

Configuration for testnet and Ethereum Classic paths
are supported via flags.go which uses this
setter when the flag --usb is used in conjunction
with a supported chain flag, eg. --ropsten (any testnet)
or --classic.

Date: 2022-07-06 10:28:46-07:00
Signed-off-by: meows <[email protected]>
@meowsbits meowsbits requested a review from ziogaschr July 6, 2022 17:33
@ziogaschr
Copy link
Member

Great work @meowsbits. I want to give it a test with Ledger before approving it.

meowsbits added 2 commits July 6, 2022 14:20
This is intended to help avoid merge conflict issues
in the future.

Unfortunately I have to modify the TestHDPathParsing
test function, adding the SetCoinTypeConfiguration call
to (re-)establish the default values for derivation paths.

This is because
- the configurations are defined as globals,
- and we redefine them for the core-geth implementation

Date: 2022-07-06 14:20:13-07:00
Signed-off-by: meows <[email protected]>
Date: 2022-07-06 14:21:58-07:00
Signed-off-by: meows <[email protected]>
@ziogaschr
Copy link
Member

@meowsbits just tested it with Ledger and it works great.

I am wondering * if it makes sense to use the ETHClassic Slip (0x3d) for its testnets (Mordor & Kotti). That way, UX will not be confusing. I wanted to try using the Ledger's ETC app (accounts) on Mordor and it wasn't working. I am totally fine merging this PR as it is, as it is inline with the spec.

  • SLIP-0044: I checked that Slip suggests CoinType=1 for all testnets.

Nice work.

@meowsbits
Copy link
Contributor Author

What about a flag that would override (or "define with -force"?) the value?

  • --usb.coin-type-id or,
  • --usb.slip0044-id or, ...
  • --usb.pathid, --usb.path-component, ...

@ziogaschr
Copy link
Member

What about a flag that would override (or "define with -force"?) the value?

  • --usb.coin-type-id or,
  • --usb.slip0044-id or, ...
  • --usb.pathid, --usb.path-component, ...

Nice solution. I vote towards --usb.coin-type-id or --usb.pathid, but I am leaving the decision to you.

This flag can be used in conjunction with --usb
to define any path id for the global accounts package
configuration for HD wallets.

Date: 2022-07-13 10:59:15-07:00
Signed-off-by: meows <[email protected]>
Before this patch, the HD path was configured
even if the flag was set to a falsey value.
This fixes it so that if --usb is used to turn itself
off, then the path configuration cases are skipped.

Date: 2022-07-13 11:02:52-07:00
Signed-off-by: meows <[email protected]>
@meowsbits
Copy link
Contributor Author

Last two commits add --usb.pathid.

@meowsbits meowsbits self-assigned this Aug 1, 2022
@ziogaschr
Copy link
Member

Works great. Let's merge it @meowsbits.

@meowsbits meowsbits merged commit e82507a into master Aug 15, 2022
@meowsbits meowsbits deleted the feat/classic-hd-derivation-path branch August 15, 2022 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants