Commit Graph

511 Commits

Author SHA1 Message Date
Sander van Grieken
0a2a22b822 qt: use selected_key instead of selected_item[0] for ChoiceWidgets 2024-02-05 14:39:03 +01:00
SomberNight
87214c004e trezor: don't try to sign non-ismine inputs
progress towards coinjoin

related https://github.com/spesmilo/electrum/issues/8868
2024-02-05 07:21:28 +00:00
SomberNight
3e81cd1f1d trezor: fix regression in sign_transaction for trezor one for multisig
fixes https://github.com/spesmilo/electrum/issues/8813
regression from eef9680743

We started setting the witness field in above commit to be able to provide the witnesses for already pre-signed
external inputs to the device, e.g. for a coinjoin.

Trezor One fw has pretty strict limits on the witness field: max 109 bytes,
probably because that's a ~tight upper bound for a p2wpkh witness:
  <num_witness_items> <len(sig)> <sig> <len(pubkey)> <pubkey>, it comes out to 3+73(high-S and high-R)+33.
ed1785a985/legacy/firmware/protob/messages-bitcoin.options (L35)

Trezor model T seems to have higher limits.

tx_inputs is called for the tx being signed (for_sig=True), and for its parents/prev_txes (for_sig=False).
The witness is only useful for the tx being signed, I think.

Users reported seeing a "DataError: bytes overflow" exception when using a Trezor One to sign 2of3 p2wsh multisig txs.
There were no external inputs involved so for the tx being signed all witnesses were None, however we were also
setting the witness for the inputs of prev_txes.
The witness for a 2of3 pw2sh multisig input is around ~253 bytes.

To sidestep the problem, we now only set the witness in the for_sig=True case.
Note that this means if someone tries to do a coinjoin with a Trezor One involving non-trivial external inputs,
they will run into the same limit and exception.
2024-02-04 00:14:59 +00:00
Sander van Grieken
28042c61c1 qml: trustedcoin: remove redundant slot parameter in createKeystore 2024-01-22 13:32:59 +01:00
SomberNight
7007a0c1c9 mnemonic: add type hints 2024-01-22 03:27:17 +00:00
SomberNight
f30d81a98f swapserver plugin: fix doc 2024-01-17 01:15:14 +00:00
Sander van Grieken
d8f579ccfc Consistently use translated strings for UserFacingException raises 2024-01-16 16:25:33 +01:00
Sander van Grieken
3d9996ab8b trustedcoin: disable OTP entry after successful validation 2024-01-16 12:30:24 +01:00
Sander van Grieken
ec81f00896 trustedcoin: cannot reset OTP when seed is not available (online wallet creation continuation) 2024-01-15 17:45:29 +01:00
ThomasV
14ec36dba1 Merge pull request #8741 from accumulator/labels_update
add labels_received callback and update labels even when set for item
2024-01-11 16:05:04 +01:00
ThomasV
df1b9a223c remove qt module from swapserver plugin (unused since a300b8968a) 2024-01-10 17:32:31 +01:00
ThomasV
d6c45113e4 trustedcoin: do not db.write() from daemon thread. fixes #8791 2024-01-09 12:36:09 +01:00
SomberNight
66b8ec1833 trustedcoin: rm some dead code
used by old qt wizard
2024-01-05 15:29:21 +00:00
SomberNight
1d4a5052ef labels plugin: add FIXMEs. don't roll your own crypto...
```
 23.76 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 180
set_label. label='a1'. item='444dffaf758a1b17893cbc8dda4032f9b6e9f61115e7c1a6d486a0950de50c11'. bundle['encryptedLabel']='WzqTZD+cnoQEUrfYsBz0rg=='
 28.10 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 181
set_label. label='a1'. item='4812e9844c958a913a71a5a728ea6d73e42d0618f96a4259bad1895b4f427f8e'. bundle['encryptedLabel']='WzqTZD+cnoQEUrfYsBz0rg=='
set_label. label='a1'. item='c5daddf7972e16e25c1362d492888a8bbf3d8dcfc789342d71dc83d9a8faaa6c'. bundle['encryptedLabel']='WzqTZD+cnoQEUrfYsBz0rg=='
 36.51 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 182
set_label. label='a1'. item='be5973ddf9b6ae6949e544c3cf43a16e2a8719dcf14a1171ec94cfa25d4a3325'. bundle['encryptedLabel']='WzqTZD+cnoQEUrfYsBz0rg=='
 45.68 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 183
set_label. label=''. item='444dffaf758a1b17893cbc8dda4032f9b6e9f61115e7c1a6d486a0950de50c11'. bundle['encryptedLabel']='yErvsmjQUEt4Ry8c55S3Mg=='
 55.99 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 184
 58.69 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 185
set_label. label=''. item='4812e9844c958a913a71a5a728ea6d73e42d0618f96a4259bad1895b4f427f8e'. bundle['encryptedLabel']='yErvsmjQUEt4Ry8c55S3Mg=='
set_label. label=''. item='c5daddf7972e16e25c1362d492888a8bbf3d8dcfc789342d71dc83d9a8faaa6c'. bundle['encryptedLabel']='yErvsmjQUEt4Ry8c55S3Mg=='
 60.98 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 186
set_label. label=''. item='be5973ddf9b6ae6949e544c3cf43a16e2a8719dcf14a1171ec94cfa25d4a3325'. bundle['encryptedLabel']='yErvsmjQUEt4Ry8c55S3Mg=='
 62.80 | I | plugins.labels.qt.Plugin | set test_segwit_2 nonce to 187
```
2023-12-19 01:24:17 +00:00
ThomasV
2d954bb554 payserver plugin: remove support for qt GUI.
(This plugin is not useful without a daemon)

fixes #8748
2023-12-14 11:14:16 +01:00
Sander van Grieken
3a22cb9c48 labels: emit callback when labels received.
write labels regardless if there's already a label set for an ID.
2023-12-12 16:24:13 +01:00
Sander van Grieken
4c8287358a qt, qml: remove email entry from 2FA wallet ToS pages 2023-12-08 12:07:03 +01:00
accumulator
3f742a14b4 Merge pull request #8716 from accumulator/cosigner_pool_proxy
plugins: add proxy aware XMLRPCProxyTransport for xmlrpc.client calls…
2023-12-07 16:54:44 +01:00
xiaolou86
50e5b0efd1 electrum: fix typos 2023-12-04 14:15:39 +08:00
Sander van Grieken
134fe73f1a plugins: add proxy aware XMLRPCProxyTransport for xmlrpc.client calls in cosigner plugin 2023-12-01 14:31:10 +01:00
SomberNight
03778b6e0c add FIXMEs to instances where we don't use the network proxy
so that it at least does not get forgotten

related https://github.com/spesmilo/electrum/issues/4754
2023-11-30 19:31:14 +00:00
SomberNight
262c009c67 pyinstaller build: towards fixing missing "gui/common_qt" folder
pyinstaller tries to import electrum and its different submodules at build-time
during the "Analysis" phase. sys._GUI_QT_VERSION was not getting set there,
and the resulting exception was blocking pyinstaller from discovering that
gui/common_qt is being used.

at runtime:
```
$ ./dist/Electrum.app/Contents/MacOS/run_electrum
  1.53 | E | daemon.Daemon | GUI raised exception: Exception('Error loading trustedcoin plugin: ModuleNotFoundError("No module named \'electrum.gui.common_qt\'")'). shutting down.
  1.53 | E | __main__ | daemon.run_gui errored
Traceback (most recent call last):
  File "electrum/plugin.py", line 135, in load_plugin
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/vagrant/electrum/dist/Electrum.app/Contents/MacOS/electrum/plugins/trustedcoin/qt.py", line 51, in <module>
    from .common_qt import TrustedcoinPluginQObject
  File "/Users/vagrant/electrum/dist/Electrum.app/Contents/MacOS/electrum/plugins/trustedcoin/common_qt.py", line 16, in <module>
    from electrum.gui.common_qt.plugins import PluginQObject
ModuleNotFoundError: No module named 'electrum.gui.common_qt'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "run_electrum", line 456, in handle_cmd
    d.run_gui()
  File "electrum/daemon.py", line 617, in run_gui
    self.gui_object = gui.ElectrumGui(config=self.config, daemon=self, plugins=self._plugins)
  File "electrum/util.py", line 473, in do_profile
    o = func(*args, **kw_args)
  File "electrum/gui/qt/__init__.py", line 153, in __init__
    self.plugins.load_plugin('trustedcoin')
  File "electrum/plugin.py", line 138, in load_plugin
    raise Exception(f"Error loading {name} plugin: {repr(e)}") from e
Exception: Error loading trustedcoin plugin: ModuleNotFoundError("No module named 'electrum.gui.common_qt'")
```
2023-11-30 13:43:50 +00:00
SomberNight
9f1b8613d0 swaps: code style clean-up, add type hints, force kwargs
no intended functional changes
2023-11-22 17:50:29 +00:00
ThomasV
fb4eb86e7c submarine swaps: remove support for 'old' normal swaps,
where the user has the preimage.

The CLTV requirements between old and new flow are imcompatible.
With the current locktime value, the server was vulnerable to an
attack where the client does not settle the lightning payment
and claims a refund. In order to support both old and new flows,
one would need to use different locktimes.
2023-11-10 10:35:34 +01:00
Sander van Grieken
be801f30e8 gui: make common_qt compatible with both Qt5 and Qt6 2023-11-07 10:17:10 +01:00
Sander van Grieken
6270eae5c9 qml: port PyQt5 to PyQt6 2023-11-07 10:16:18 +01:00
SomberNight
0273659e6e trustedcoin: fix keystore name (2)
follow-up 56e80c20d7
2023-10-17 14:33:05 +00:00
ThomasV
0a732a0b52 trustedcoin: fix keystore name (follow-up 56e80c20d7) 2023-10-17 10:00:17 +02:00
Sander van Grieken
6222b5ad40 followup 94a6f6cd0e 2023-09-25 16:10:19 +02:00
Sander van Grieken
94a6f6cd0e coldcard: don't raise when get_soft_device_id can't get xpub.
This allows uninitialized coldcards to show up in the device list.
2023-09-25 16:07:18 +02:00
ThomasV
56e80c20d7 wallet_db upgrade: do not use '/' in StoredDict keys 2023-09-23 11:05:36 +02:00
SomberNight
0a3dd8e5e5 keepkey: fix TIM_RECOVER restore method
follow-up 8be3c4dadd
related: https://github.com/spesmilo/electrum/pull/8560#discussion_r1329127300
2023-09-22 16:23:10 +00:00
Sander van Grieken
78fbc27ec0 qt: remove potentially confusing reference to 'install wizard' in trezor, keepkey, safe_t hww settings dialogs 2023-09-22 12:13:21 +02:00
Sander van Grieken
81089a1ef9 wizard: keepkey scope pin lineedit to instance 2023-09-20 14:34:31 +02:00
Sander van Grieken
22d3a5edbb wizard: fix trezor initialisation/recover not setting page valid to True
add auto-proceed to next page after init to trezor, safe_t, keepkey
2023-09-20 14:34:31 +02:00
Sander van Grieken
ec0dbc78c2 wizard: fix assumption 'keystore_type' is present in wizard_data, fix unexpected keystore type msg 2023-09-20 14:34:31 +02:00
SomberNight
1a91da67ea coldcard: factor out manipulate_keystore_dict_during_wizard_setup 2023-09-20 14:34:31 +02:00
Sander van Grieken
a1dea837a7 plugins: make HW_PluginBase an abstract baseclass 2023-09-20 14:34:31 +02:00
Sander van Grieken
f69316d1a6 trustedcoin: remove old wizard code 2023-09-20 14:34:31 +02:00
Sander van Grieken
4101946ff5 wizard: add non-hardened derivation path check for digital bitbox, re-add rescan button in choose hw device,
clear clipboard before confirming seed.
2023-09-20 14:34:31 +02:00
Sander van Grieken
7313259815 wizard: keepkey and safe_t set valid on init, handle xprv validation, report error when exception 2023-09-20 14:34:31 +02:00
Sander van Grieken
60d1d1e599 wizard: add missing keepkey porting, fix password focus for default and picked wallets,
add abstract method decl HW_PluginBase.wizard_entry_for_device
2023-09-20 14:34:31 +02:00
Sander van Grieken
dd64b5c628 wizard: add bitbox02 new wallet init and checks to new wizard 2023-09-20 14:34:31 +02:00
Sander van Grieken
50d2cdb1b5 wizard: improve hww uninitialized default msg. attempt fix flake issue w.r.t ABC 2023-09-20 14:34:31 +02:00
Sander van Grieken
b7612605c5 wizard: add Digital Bitbox initialization to new wizard, remove rescan button
Note: the option to load a backup from SD card when the device already has a seed
has been removed. The device always returns an error when attempting this.
2023-09-20 14:34:31 +02:00
Sander van Grieken
03435ebdbe hw_wallet: inherit from ABC and use @abstractmethod decorators instead of raise NotImplementedError 2023-09-20 14:34:31 +02:00
Sander van Grieken
f7b34003cc plugin: device_model_name defaults to plugin name if not overridden. 2023-09-20 14:34:31 +02:00
Sander van Grieken
087718f3a7 hww: mark device_model_name(self) as @abstractmethod and override in hww clients that did not define it. 2023-09-20 14:34:31 +02:00
Sander van Grieken
d68e6a69c1 qt: wizardcomponents all use Logger mixin. Fix missing self.plugins init in WCTrezorInitMethod 2023-09-20 14:34:31 +02:00
Sander van Grieken
5f27777301 qt: trezor firmware checks on xpub and initial setup 2023-09-20 14:34:31 +02:00