-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
trezorlib API improvements #4490
Open
matejcik
wants to merge
14
commits into
main
Choose a base branch
from
matejcik/entropy-check-python
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+1,273
−838
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matejcik
added
the
translations
Put this label on a PR to run tests in all languages
label
Jan 10, 2025
|
matejcik
force-pushed
the
matejcik/entropy-check-python
branch
from
January 13, 2025 11:16
6450448
to
de9174a
Compare
[no changelog]
it's a Python class that emits a DeprecationWarning if you try to use it for almost anything (two exceptions that can't be overriden from the wrapper: * isinstance(depr, SomeOtherClass) * depr is None) we will return instances of this class to indicate that a return value of something will be going away
this deprecates `device.reset()`, and moves the new arguments to `device.setup()`. Also it changes default backup type on core devices to SLIP39-single, same as Suite, and randomizes the number of entropy check rounds, if not provided from outside.
matejcik
force-pushed
the
matejcik/entropy-check-python
branch
from
January 13, 2025 14:27
de9174a
to
f787013
Compare
romanz
approved these changes
Jan 14, 2025
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.
Looks good, added some questions and suggestions:
romanz
reviewed
Jan 14, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #4464
the following have been implemented in trezorlib:
UnexpectedMessageError
to raise when Trezor sends a, well, unexpected messageclient.call(msg, expect=SomeType)
will raiseUnexpectedMessageError
wheneverexpect
is not met, analogous tocontext.call()
in core@expect
decorator, so that has been deprecated & all usages removed from trezorlibtrezorlib.device
, which were returning the string fromSuccess(message="...")
have been changed to returnstr | None
, and emit a deprecation warning when someone so much as peeks at the resulting str. We'll change them to-> None
in v0.14 or maybe v0.15.trezorlib.device.recover
was returning aSuccess
instance!! 🙄 got the same treatment, still returns an object that kind of looks like aSuccess
but emits deprecation warnings if you touch it.required
device.reset
to a deprecated kind-of-like-an-alias to newly introduceddevice.setup
.reset
andreset_entropy_check
: the entropy check is an integral part ofdevice.setup
, and by default the function will pick a random number of entropy check roundsdevice.setup
accepts a private argument_get_entropy()
which makes it easier to supply external entropy when needed (such as in tests)expected_responses
for the entropy check flow