-
Notifications
You must be signed in to change notification settings - Fork 993
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
Added Ledger support to the wallet. #2068
Conversation
c121113
to
d78759c
Compare
d78759c
to
959933b
Compare
28b65f2
to
5a56b2e
Compare
5a56b2e
to
302db22
Compare
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.
Most of the changes look fine, but I have some minor concerns about the flow.
impl FromStr for DerivationPath { | ||
type Err = DerivationPathError; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { |
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.
Why was it introduced? Can DerivationPath::from_path_str
be used instead, which also takes the scheme into account?
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.
For SchemeType::Ed25519
scheme, all path segments must be hardened.
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 see your point. FromStr
was introduced to support the implementation of Serde::Deserialize
for DerivationPath
. And this is required in order to be able to store DerivationPath
s in the wallet's Store
, which itself is deserialized from file storage using Serde. I guess requiring scheme information to deserialize derivation paths would mean having to tag derivation paths with their scheme types. Couldn't we instead just deserialize all well-formatted (untagged) derivation paths (e.g. m/.../.../...
) and delay the hardening/validations to when the actual SLIP10/BIP32 key computations are actually computed?
On the second point: I believe that all path segments are still being hardened for SchemeType::Ed25519
. The slip10_ed25519::derive_ed25519_private_key
function hardens all indices using the statement let hardened_index = 0x80000000 | *i;
. As a separate thought: Instead of implicitly hardening Ed25519 paths, have we considered just rejecting non-hardened Ed25519 paths as is done in one of the implementations linked to from the SLIP10 specification? See https://github.com/elucidsoft/dotnetstandard-bip32/blob/master/dotnetstandard-bip32/BIP32.cs#L65 where they use the regex ^m(\/[0-9]+')+$
for derivation 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.
I guess requiring scheme information to deserialize derivation paths would mean having to tag derivation paths with their scheme types.
I would prefer this solution. I think that explicit storage of the scheme tag might be also useful from the user perspective.
3678a6d
to
e6f2716
Compare
Describe your changes
Added Ledger support to the
namadaw
command, expanded theStore
to also hold derivation paths and public keys, and attempted to simplify the wallet logic. More specifically:namadaw key list
command remains as informative even in the absence of the secret key (which may be being stored externally on a hardware wallet)store.rs
to ensure that the key derivations are always maximized and are done correctly:DerivationPath
instead ofString
ledger-namada
branch enabling SLIP10 and returns larger key byte vectors that contain the key discriminant byte: https://github.com/heliaxdev/ledger-namada/tree/murisi/fix-rs-0.24.0ledger-namada
branch fixing the hashing of signature sections involved in multisig transactions: https://github.com/heliaxdev/ledger-namada/tree/murisi/fix-rs-0.24.0Store
(de)serializationnamadaw key list
command to also print out public keys (labelled asexternal
) even when no corresponding secret key existscloses #70
Indicate on which release or other PRs this topic is based on
Checklist before merging to
draft