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

Configurable Bip44 CoinType & HdPath for SDK users #4300

Merged
merged 5 commits into from
May 30, 2019
Merged

Configurable Bip44 CoinType & HdPath for SDK users #4300

merged 5 commits into from
May 30, 2019

Conversation

yangyanqing
Copy link
Contributor

close: #4144

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote tests
  • Updated relevant documentation (docs/)
  • Added a relevant changelog entry: clog add [section] [stanza] [message]
  • rereviewed Files changed in the github PR explorer

For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented May 8, 2019

Codecov Report

Merging #4300 into master will decrease coverage by 0.02%.
The diff coverage is 52.63%.

@@            Coverage Diff             @@
##           master    #4300      +/-   ##
==========================================
- Coverage   59.12%   59.09%   -0.03%     
==========================================
  Files         217      217              
  Lines       14605    14618      +13     
==========================================
+ Hits         8635     8639       +4     
- Misses       5332     5341       +9     
  Partials      638      638

@codecov
Copy link

codecov bot commented May 8, 2019

Codecov Report

Merging #4300 into master will decrease coverage by 0.03%.
The diff coverage is 47.36%.

@@            Coverage Diff             @@
##           master    #4300      +/-   ##
==========================================
- Coverage   54.58%   54.54%   -0.04%     
==========================================
  Files         248      248              
  Lines       15967    15980      +13     
==========================================
+ Hits         8716     8717       +1     
- Misses       6617     6629      +12     
  Partials      634      634

@alessio alessio requested a review from jleni May 8, 2019 02:40
@alessio
Copy link
Contributor

alessio commented May 8, 2019

Any thoughts on this @jleni?

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, I believe it is advisable to support varying BIP32 HD paths and not have it hard-coded in a SDK. Left some general feedback.

types/config.go Show resolved Hide resolved
cmd/gaia/lcd_test/helpers_test.go Outdated Show resolved Hide resolved
.pending/features/sdk/4144-Configurable-Be Outdated Show resolved Hide resolved
@jleni
Copy link
Member

jleni commented May 8, 2019

Any thoughts on this @jleni?

This will break Ledger app compatibility. Ledger enforces BIP44 registrations and apps are signed and restricted to paths that start with 44'/118'. Atoms are registered at 118: https://github.com/satoshilabs/slips/blob/master/slip-0044.md

If derivation paths do not start with 44'/118' any cryptography operation will be rejected by the secure element. A new app will need to be published for a different coinType

types/address.go Show resolved Hide resolved
@yangyanqing
Copy link
Contributor Author

This will break Ledger app compatibility. Ledger enforces BIP44 registrations and apps are signed and restricted to paths that start with 44'/118'. Atoms are registered at 118: https://github.com/satoshilabs/slips/blob/master/slip-0044.md

Any project based on cosmos-sdk should publish their own ledger app, if they want to singed by ledger.

If derivation paths do not start with 44'/118' any cryptography operation will be rejected by the secure element. A new app will need to be published for a different coinType

Yes

@jleni

@jackzampolin
Copy link
Member

What is blocking merge here?

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@alexanderbez alexanderbez added C:Keys Keybase, KMS and HSMs ready-for-review labels May 28, 2019
@alexanderbez
Copy link
Contributor

Sorry for the delay on this. This get an ACK from me. It needs to have merge conflicts resolved (sorry @yangyanqing).

@jleni
Copy link
Member

jleni commented May 28, 2019

This will break Ledger app compatibility. Ledger enforces BIP44 registrations and apps are signed and restricted to paths that start with 44'/118'. Atoms are registered at 118: https://github.com/satoshilabs/slips/blob/master/slip-0044.md

Any project based on cosmos-sdk should publish their own ledger app, if they want to singed by ledger.

If derivation paths do not start with 44'/118' any cryptography operation will be rejected by the secure element. A new app will need to be published for a different coinType

Yes

A few comments:
1- I think these restrictions/assumptions should be included in the docs or at least the changelog.
Ledger support in the SDK will only work with 44'/118'/.. and the Cosmos App (CLA=0x55). This is because Ledger requires a SLIP-0044 registrating and cryptographically restricts apps to certain paths.

2- Also should this change trigger an issue in gaia in case we need updates there?
Assuming custom bip44 paths are the way forward, what is the purpose of a default value in the SDK if every project is supposed to specify their own hrp/bip44 path? Maybe gaia should behave as any SDK user and set 118/cosmos via the API?

3- About HSM integration, should part of this functionality move to gaia? If people plan to develop their own apps for each specific case, this will definitely require some rework. On the other hand,

These points are probably part of a longer discussion and not a reason to block the PR at all, but I think it would be something to take into account in future work.

@jackzampolin
Copy link
Member

Interesting question, do we even need paths other than 44'/118'/*'/*/*? Wouldn't it be nice for users to be able to use the same Cosmos app all throughout the Cosmos?

Ignoring ☝️, I do think we need the docs updates in this PR to point users at the correct way to enable ledger integration for their apps if we are removing it.

@yangyanqing
Copy link
Contributor Author

All conflicts were resolved. @alexanderbez @jackzampolin @jleni

BTW: Your new avatar is so cool ! 👍 @alexanderbez

@jleni
Copy link
Member

jleni commented May 29, 2019

Any news about some new tests that check this new functionality?

@alexanderbez
Copy link
Contributor

Thanks @yangyanqing :)

.pending/features/sdk/4144-Configurable-Be Outdated Show resolved Hide resolved
Co-Authored-By: Juan Leni <juan.leni@zondax.ch>
@alessio alessio merged commit 1db10b0 into cosmos:master May 30, 2019
@yangyanqing yangyanqing deleted the frank/4144-configurable-coin-type branch May 30, 2019 12:48
@jackzampolin
Copy link
Member

Do we have a tracking issue for the docs update here?

@alessio
Copy link
Contributor

alessio commented May 31, 2019

I'm afraid no - @yangyanqing feel like writing some little docs about this change?

@yangyanqing
Copy link
Contributor Author

Which doc should be add to for this change ? @jackzampolin @alessio

@alessio
Copy link
Contributor

alessio commented May 31, 2019

Let's start with godoc comments:

https://github.com/cosmos/cosmos-sdk/pull/4300/files#diff-239369c90dd98b7585b77a44eb24a9a5R128

coint type is no longer static, to start with.

I'd love to see some documentation written (somehow, somewhere) with the users of this change (namely developers) in mind.

@yangyanqing
Copy link
Contributor Author

Add comments in #4474 .

yun-yeo pushed a commit to yun-yeo/cosmos-sdk that referenced this pull request Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Keys Keybase, KMS and HSMs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable Bech32 prefix for SDK users
5 participants