-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
Output Descriptors #1363
Output Descriptors #1363
Conversation
bf0ed99
to
9af06e7
Compare
what is the reason for |
We need to show the same xpub on the display, without that flag the trezor shows |
I'm wondering whether there should be a OTOH I can see uses for the xpub display other than the descriptor, so 🤷♀️ |
python/src/trezorlib/btc.py
Outdated
) | ||
|
||
fingerprint = pub.root_fingerprint if pub.root_fingerprint is not None else 0 | ||
external = "[{:08x}{}]{}/0/*".format(fingerprint, path[1:], pub.xpub) |
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.
please use f-strings
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.
Addressed in 15c3753
python/src/trezorlib/btc.py
Outdated
external = "[{:08x}{}]{}/0/*".format(fingerprint, path[1:], pub.xpub) | ||
internal = "[{:08x}{}]{}/1/*".format(fingerprint, path[1:], pub.xpub) | ||
|
||
return (fmt.format(external), fmt.format(internal)) |
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.
please don't use outer parens
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.
Addressed in 15c3753
python/src/trezorlib/btc.py
Outdated
) | ||
) | ||
|
||
|
||
def get_descriptor( |
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.
this function should move to trezorlib.cli.btc
as it's too high-level for this file
it should also probably accept address_n
, and the get-descriptor
command should also accept -n/--address
, plus possibly -a/--account
as a convenience shortcut
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 prefer this won't accept address_n
- I don't see a good reason why it should.
Will move this to trezorlib.cli.btc
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.
If I moved this to trezorlib.cli.btc
, where should I move the test from 9af06e7?
I really want to have this feature properly covered by tests.
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.
well the reason to accept address_n
is to allow use by coins other than Bitcoin, but i don't care that much so eh
re tests, we can keep them where they are, importing from trezorlib.cli
namespace is not discouraged or anything
i'm thinking that the bulk of the functionality should be tested in python/tests
presumably by mocking out the btc.get_public_node
call?
(i don't think it is super important though)
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.
python/src/trezorlib/btc.py
Outdated
else: | ||
raise exceptions.TrezorException("Unsupported account type") | ||
|
||
# TODO: correctly lookup SLIP44 for coin provided |
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.
In context of accepting address_n
, it's not important that we don't have the full SLIP44 lookup here. (fwiw we don't bundle the data for this anymore)
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.
Let's drop the SLIP44 lookup completely and accept only Bitcoin/Testnet in the func
left some comments on python part LGTM on core side did not review legacy, i might look at it later if nobody else does |
reviewed legacy as well, looks good |
I updated the tests to test the cli module in ec4d3c3, but now they fail with:
Can you please advise? |
92f4dd1
to
f5b8161
Compare
This is now ready for review. One things I am unsure about: There are two ways how to obtain the root fingerprint:
I used method 1 in Legacy and method 2 in Core. My reasoning is that using method 2 in Core would introduce lots of code/typing changes, but I do agree that method 2 is quite a hack. We might consider using method 2 for Legacy as well. Let me know what you think. |
Method 2 is cleaner, but I don't have a problem with either of the two approaches. It's no big deal if this is implemented slightly differently in core and legacy, so I'd say it's OK as is. |
I'm a little confused here, ISTM both core and legacy are using the same method? |
I reworked it to use the same method and force-pushed. |
Can you please @andrewkozlik have one last look at reworked legacy change (that uses the same method as core, i.e. deriving m/0'): c76145a |
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 for the root_fingerprint derivation.
However, note that the UI test are failing.
Hm, about the tests: for some strange reason I'm getting different hashes each time I run |
I suppose it could be the pulsating swipe arrow, but we have the same thing in test_msg_backup_device.py, so the UI tests should be accustomed to it. |
Yes, the pulsing should disabled as the tests are run against emulator with disabled animations. I'll double check though. |
I confirm I have reproducible hashes using Let's wait for the CI. |
Yes and it is in the Makefile so we should be all good. |
Fixes #1362
In order to fully support Output Descriptors we need to change things on couple of places:
GetPublicKey.ignore_xpub_magic
andPublicKey.root_fingerprint
fieldstrezorctl btc get-descriptor
commandtrezorctl btc get-descriptor
command`get-descriptor
test to include correctroot_fingerprint
ignore_xpub_magic
root_fingerprint
ignore_xpub_magic
testsroot_fingerprint
testsignore_xpub_magic
root_fingerprint
ignore_xpub_magic
testsroot_fingerprint
tests