Skip to content

Update trezor to 0.20.1#641

Open
Uxio0 wants to merge 1 commit into
mainfrom
update-trezor-0.20.1
Open

Update trezor to 0.20.1#641
Uxio0 wants to merge 1 commit into
mainfrom
update-trezor-0.20.1

Conversation

@Uxio0

@Uxio0 Uxio0 commented Jun 29, 2026

Copy link
Copy Markdown
Member

What

Update trezor from 0.13.10 to 0.20.1 (latest).

Why

This is not a plain version bump — trezorlib 0.20.x moved to a session-based API, so the integration had to be migrated:

  • Ethereum ops (get_address, sign_tx, sign_tx_eip1559, sign_typed_data_hash, sign_message) now take a Session instead of a TrezorClient.
  • ClickUI moved from trezorlib.ui to trezorlib.cli.ui and no longer takes passphrase_on_host; it now just supplies the button/pin callbacks.
  • Client creation is get_default_client(app_name, button_callback=..., pin_callback=..., code_entry_callback=...), and the session comes from get_default_session(client, passphrase_callback=...).

Changes

  • get_trezor_client()get_trezor_session(): builds the client and opens a session via the library helpers. Passphrase is entered on the host unless the device requires on-device entry (get_default_session handles the on-device vs host choice, which avoids the PassphraseError that a forced host passphrase raises on devices set to "always enter passphrase on device").
  • Wire code_entry_callback=get_code_entry_code so unpaired THP devices get an interactive prompt instead of an uncaught TrezorException.
  • Handle DeviceLockedError in raise_trezor_exception_as_hw_wallet_exceptionHardwareWalletException("Trezor device is locked").
  • Update tests for the session-based API (mock get_trezor_session, drop the removed TrezorClient(..., ui=..., _init_device=False) construction).
  • Relock uv.lock (drops ecdsa/six, adds noiseprotocol).

Migrate trezorlib usage to the new session-based API: ethereum calls now
take a Session instead of a TrezorClient, ClickUI moved to trezorlib.cli.ui,
and the client is built with get_default_client + get_default_session.

- Wire button/pin/code-entry callbacks and host passphrase entry
- Handle DeviceLockedError in the exception translation decorator
- Update tests for the session-based API
@Uxio0 Uxio0 requested a review from a team as a code owner June 29, 2026 14:53
@datadog-official

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 1 Pipeline job failed

Python CI | finish   View in Datadog   GitHub Actions

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: febed5c | Docs | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: febed5c790

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

pin_callback=ui.get_pin,
code_entry_callback=get_code_entry_code,
)
return get_default_session(client, passphrase_callback=get_passphrase)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve host passphrase prompts for capable devices

For passphrase-enabled devices that advertise PassphraseEntry (for example the Trezor T/Safe family), trezorlib.get_default_session() chooses on-device passphrase entry before it ever calls the supplied passphrase_callback, so this line ignores get_passphrase in exactly the common devices where host entry used to be forced by ClickUI(passphrase_on_host=True). Users who rely on entering the passphrase in the CLI will be pushed to device entry instead; prompt on the host and pass that value to client.get_session() unless the device's passphrase_always_on_device setting requires otherwise.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant