-
Notifications
You must be signed in to change notification settings - Fork 102
Continue with BTC address derivation using account config + derivation info #3335
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
Conversation
e35862b
to
332e692
Compare
BitBox01 support was removed (other than device management so users can check and create backups, etc) in 3d70ed2
- Type-matching is not nice - BTC address verification input params are inherently different to - ETH. ETH is basically showing the address at one keypath. BTC however is about deriving an address based on (isChange, addressIndex) from an account descriptor. So far it worked because we only use simple Bitcoin accounts and not descriptors, but it's good to be a bit more general to allow more flexible descriptor accounts in the future.
A BTC address is derived from an account using change/addressIndex. There is no "address-level" signing configuration. `signingConfig.Derive()` assumes there is one base level keypath and xpub, which is not true for a descriptor in general. For example, a multisig descriptor has multiple xpubs, each with their own keypath.
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.
Overall LGTM just a couple of questions
s.Require().Equal(uint32(index), address.Configuration.AbsoluteKeypath().ToUInt32()[1]) | ||
s.Require().Equal(getPubKey(index), address.Configuration.PublicKey()) | ||
s.Require().Equal(uint32(index), address.AbsoluteKeypath().ToUInt32()[1]) | ||
_ = getPubKey |
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.
leftover line?
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.
Thanks, yeah. Removed
VerifyAddressBTC( | ||
accountConfiguration *signing.Configuration, | ||
derivation btctypes.Derivation, | ||
coin coin.Coin) error |
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.
is there a specific reason we don't directly use btc.Coin
and eth.Coin
(below) so we don't have to cast it inside the method?
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.
Because of a circular import between the packages 😅 Maybe we can think another time of if and how to break the cycle.
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 hate import cycles :D
The previous commits moved towards using an account config plus derivation info to get to the address. This commit removes the address-level signing config for BTC. This is a simplification, as it does not make sense to derive a full "signing config" when all that is derived is the keypath, nothing else changes. This is part of moving to general descriptor support. There are still remaining issues where code assumes it's a single-sig (calls to address.AbsoluteKeypath(), and NewAddress(), etc.), but we can solve that later step by step.
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.
utACK
VerifyAddressBTC( | ||
accountConfiguration *signing.Configuration, | ||
derivation btctypes.Derivation, | ||
coin coin.Coin) error |
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 hate import cycles :D
No description provided.