spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.33k stars 3.05k forks source link

trezor v0.13.9 breaks the plugin #9116

Closed PiRK closed 3 weeks ago

PiRK commented 2 months ago

Just a heads up that trezor v0.13.9 breaks the plugin for Electrum ABC, and I would guess Electrum is affected too.

Here is where I expect it to fail (import RecoveryDeviceType ) https://github.com/spesmilo/electrum/blob/master/electrum/plugins/trezor/trezor.py#L32

  File "/work/electrum/electrumabc_plugins/trezor/trezor.py", line 28, in <module>
[Step 1/1]     from trezorlib.messages import (
[Step 1/1] ImportError: cannot import name 'RecoveryDeviceType' from 'trezorlib.messages' (/usr/local/lib/python3.9/dist-packages/trezorlib/messages.py)
[Step 1/1] .....................................................................................................................s...................
[Step 1/1] ...s........................[trezor] Library version for 'trezor' is incompatible.
[08:14:38]
[Step 1/1] Installed: 0.13.9, Needed: 0.13.8 <= x < 0.14
[08:14:38]
[Step 1/1] ...................................................................................................................s.........sss.............................s.s...[dummy name] Library version for 'dummy name' is incompatible.
[Step 1/1] Installed: 0.13.9, Needed: 0.13.8 <= x < 0.14
[Step 1/1] ======================================================================
[Step 1/1] ERROR: test_electrum_tx_to_txtype (electrumabc_plugins.trezor.tests.test_trezor.TestTrezorPlugin)
[Step 1/1] ----------------------------------------------------------------------
[Step 1/1] Traceback (most recent call last):
[Step 1/1]   File "/work/electrum/electrumabc_plugins/trezor/tests/test_trezor.py", line 53, in test_electrum_tx_to_txtype
[Step 1/1]     self.assertEqual(plugin.electrum_tx_to_txtype(tx, xpub_path), expected_txtype)
[Step 1/1]   File "/work/electrum/electrumabc_plugins/trezor/trezor.py", line 597, in electrum_tx_to_txtype
[Step 1/1]     t = TransactionType()
[Step 1/1] NameError: name 'TransactionType' is not defined
[Step 1/1] ----------------------------------------------------------------------
[Step 1/1] Ran 330 tests in 110.698s
[Step 1/1] FAILED (errors=1, skipped=8)
PiRK commented 2 months ago

The breaking change: https://github.com/trezor/trezor-firmware/pull/3743/commits/792c719342a4c3632b3bce194a30bf9145a3437e

The potential fix: https://reviews.bitcoinabc.org/D16406

Note that I only tested basic features such as signing a transaction with a Ledger device. I didn't try the recovery feature.

accumulator commented 2 months ago

@PiRK thanks

hMsats commented 2 months ago

Can confirm for Electrum with the Trezor after upgrading to Ubuntu 23.10. Couldn't get it to work and kept getting this message from Electrum (4.5.5) when it was trying to connect to my Trezor:

  6.10 | W | plugins.jade.jadepy.jade | No module named 'electrum.plugins.jade.jadepy.jade_ble'
  6.10 | W | plugins.jade.jadepy.jade | BLE scanning/connectivity will not be available
  6.18 | E | plugins.trezor.trezor | error importing trezor plugin deps
Traceback (most recent call last):
  File "/home/user/Electrum-4.5.5/electrum/plugins/trezor/trezor.py", line 29, in <module>
    from .clientbase import TrezorClientBase
  File "/home/user/Electrum-4.5.5/electrum/plugins/trezor/clientbase.py", line 15, in <module>
    from trezorlib.messages import WordRequestType, FailureType, RecoveryDeviceType, ButtonRequestType
ImportError: cannot import name 'RecoveryDeviceType' from 'trezorlib.messages' (/usr/local/lib/python3.11/dist-packages/trezorlib/messages.py)
  6.19 | W | plugins.trezor.qt.Plugin | Library version for 'trezor' is incompatible.
Installed: 0.13.9, Needed: 0.13.0 <= x < 0.14
  6.19 | W | gui.qt.wizard.wallet.WCChooseHWDevice | error getting device infos for trezor: Library version for 'trezor' is incompatible. // Installed: 0.13.9, Needed: 0.13.0 <= x < 0.14 // Make sure you install it with python3

I just tried Trezor version 0.13.0 and everything worked again:

pip3 install trezor==0.13.0 or in my case on Ubuntu 23.10 pip3 install trezor==0.13.0 --break-system-packages

SomberNight commented 3 weeks ago

closed by https://github.com/spesmilo/electrum/pull/9141 (more discussion in https://github.com/spesmilo/electrum/pull/9118)