Commit Graph

830 Commits

Author SHA1 Message Date
Craig Raw
f988d4fffc Merge branch 'master' of github.com:sparrowwallet/HWI 2020-11-26 07:42:20 +02:00
Andrew Chow
d86368ff7d release: Bump to version 1.2.1 2020-11-25 20:37:51 -05:00
Andrew Chow
def565b5ac release: Bump to 1.2.1-rc.1 2020-11-24 17:30:23 -05:00
Andrew Chow
1b65d782e2
Merge #406: [1.2.x] Backports for 1.2.1
b45607c1cf bitbox02: unlock during enumerate() (Marko Bencun)
070d5eafbf bitbox02: fix enumerate regression (Marko Bencun)
087bc691f2 Add back support for Ledger legacy USB product IDs (TamtamHero)
b8f0901752 Upgrade USB enumeration logic for Ledger products (TamtamHero)

Pull request description:

  Backports #403 #399 #404 to the 1.x branch for a 1.2.1 release.

Top commit has no ACKs.

Tree-SHA512: 98803ebe742b0277762f7ae008dc70bddfcc98c72ff0eedbe265637ae8e117e0585a9a7df617cb03e078fcbf9b3a31a2e12f6827a975d9042994a4f616e52048
2020-11-24 17:28:55 -05:00
Marko Bencun
b45607c1cf
bitbox02: unlock during enumerate()
Make it consistent with other HW wallets. Nunchuk relies on having an
unlocked device after enumerate() finishes.

Github-Pull: #404
Rebased-From: e1cc1937179a7fdb8e9807a0ef9e6f9b8ece8df0
2020-11-24 14:46:23 -05:00
Marko Bencun
070d5eafbf
bitbox02: fix enumerate regression
6a6c46f6834b4dac5e67d0c92a9ef791619e9dce checks that a password must
exist instead of that a password must not exist.

That commit does not describe the reason for the change. Password
cannot be None anyway, as the type of password is `str`, not `Optional[str]`.

Github-Pull: #399
Rebased-From: b8cf8578836cf92918c619f6f763c69697926810
2020-11-24 14:46:17 -05:00
TamtamHero
087bc691f2
Add back support for Ledger legacy USB product IDs
Github-Pull: #403
Rebased-From: 1080756258477b15c4e61025635e5b7b2dc947d4
2020-11-24 14:44:59 -05:00
TamtamHero
b8f0901752
Upgrade USB enumeration logic for Ledger products
Github-Pull: #403
Rebased-From: a7407e268b817515fd78b1c2225753538410070a
2020-11-24 14:44:55 -05:00
Craig Raw
663169d754 Merge branch 'master' of https://github.com/sparrowwallet/HWI 2020-10-16 11:54:31 +02:00
Andrew Chow
afec2cd8fc release: Bump to 1.2.0 2020-10-09 14:16:08 -04:00
Andrew Chow
7dbcc9ad79 release: Bump to 1.2.0-rc.1 2020-10-02 14:41:55 -04:00
Andrew Chow
085817746b
Merge #380: ignored .vscode folder
2f56cd3839 ignored .vscode folder (fametrano)

Pull request description:

  This is to ignore the folder where Visual Studio Code save its own stuff

ACKs for top commit:
  instagibbs:
    ACK 2f56cd3839
  achow101:
    ACK 2f56cd3839

Tree-SHA512: 1f8e22febe5cc3ab5d6a5937b0df51c56569335cc0382ef463539784fd6d12db699b3449c2f332850080e6880ad718828ea43d9f05578ca494d46b89b17c3e6c
2020-09-01 16:05:11 -04:00
Andrew Chow
f83c966012
Merge #383: Fix README features table rendering
0683dc246a Fix README features table rendering (benk10)

Pull request description:

  The HWW features table seems to have been broken with #363 due to a small issue (needed to add another `:---:|` at the table separator list), so just a small PR to fix that (and remove duplicated spaces).

ACKs for top commit:
  achow101:
    ACK 0683dc246a
  instagibbs:
    utACK 0683dc246a

Tree-SHA512: 36a7b9e039d397bb2a48ac34841727f4c2bfe67aaaabd5fd651f3b058eb52a50a2a395f404e86ae8ab31042d89e5ceb3bb0f3b9ceb16d13e147995262ba38bf3
2020-08-31 23:22:03 -04:00
benk10
0683dc246a
Fix README features table rendering 2020-09-01 05:15:38 +02:00
Gregory Sanders
17b8c8bf3c
Merge #363: add BitBox02 support
b24f2aaa2d hwilib/gui: make sure the bb02 pairing window is painted (Marko Bencun)
5010844a27 hwwclient: fix send_pin signature (Marko Bencun)
6169788aa7 bitbox02: consistent errs when the device is (not) initialized (Marko Bencun)
d255229639 commands/find_device: only get the device fingerprint if required (Marko Bencun)
4df060d0c6 bitbox02: use local copy of parse_path (Marko Bencun)
ed1125115f typecheck bitbox02.py (Marko Bencun)
4e4455d2b2 add BitBox02 support (Marko Bencun)
1d0bbb6281 add bitbox02 dependency (Marko Bencun)

Pull request description:

  This adds cli and gui support for the BitBox02. For now, only single sig support is added, with the plan to add multisig support soon after this is merged.

  This PR has had an internal review over here before: https://github.com/benma/hwi/pull/1, and I tested it quite extensively.

ACKs for top commit:
  achow101:
    ACK b24f2aaa2d
  instagibbs:
    utACK b24f2aaa2d

Tree-SHA512: 0dd7c48f0381c4f72c0ea033dd9e64212f6c44c4c9c2711441500d7816b7327379dfb314494bbf8301a87f05601c1ed78a4c1d4397fa2d309ccb613faa847946
2020-08-31 21:44:55 -04:00
Marko Bencun
b24f2aaa2d
hwilib/gui: make sure the bb02 pairing window is painted
Sometimes, one processEvents() was not enough to have Qt5 finish
painting the window before proceeding onto the blocking call to show
the pairing code on the bitbox02 screen.

This is an attempt at making this more robust.
2020-08-31 13:02:07 +02:00
fametrano
2f56cd3839 ignored .vscode folder 2020-08-27 11:23:54 +02:00
Marko Bencun
5010844a27
hwwclient: fix send_pin signature
Was missing the pin argument.
2020-08-26 17:55:31 +02:00
Marko Bencun
6169788aa7
bitbox02: consistent errs when the device is (not) initialized
Running e.g. getxpub when the device is not initialized results in the
device returning with 'BAD_STATE', which is not so user friendly.
2020-08-26 17:55:31 +02:00
Marko Bencun
d255229639
commands/find_device: only get the device fingerprint if required
If the fingerprint is not specified on the CLI, the fingerprint does
not need to be queried from the device.

This is helpful for uninitialized devices, to invoke the 'setup' or
'restore' commands, at which point the device does not have a keystore
and fingerprint yet.
2020-08-26 17:55:03 +02:00
Marko Bencun
4df060d0c6
bitbox02: use local copy of parse_path
Device libraries should not cross-reference each other and stay
independent.
2020-08-26 17:55:02 +02:00
Marko Bencun
ed1125115f
typecheck bitbox02.py
Since trezorlib is imported also by bitbox02, it would be type-checked
by mypy. Since it contains no types, it is easiest to ignore trezorlib
in mypy.

--implicit-reexport is disabled by --strict, but that is a bit too
strict. The bitbox02 package relies on implicit reexports.
2020-08-26 17:54:54 +02:00
Marko Bencun
4e4455d2b2
add BitBox02 support 2020-08-26 17:54:52 +02:00
Marko Bencun
1d0bbb6281
add bitbox02 dependency 2020-08-26 16:38:51 +02:00
Andrew Chow
db672d048b
Merge #373: Avoided bare except
44dabcfa80 Avoided bare expect (Ferdinando Ametrano)

Pull request description:

  Using a bare `except:` is not a good coding practice: it catches all exceptions inheriting from `BaseException`, including `SystemExit`, `KeyboardInterrupt`, and `GeneratorExit` (which is not an error and should not normally be caught by user code).
  ```
  BaseException
    - Exception
    - GeneratorExit
    - KeyboardInterrupt
    - SystemExit
  ```
  This patch is sub-optimal because only specific exceptions should be catched... anyway, in situations where one wants to catch all “normal” exceptions, at least restrict to explicitly catch the `Exception` base class, instead of implicitly catching any `BaseException`.

ACKs for top commit:
  achow101:
    ACK 44dabcfa80

Tree-SHA512: 220dc4be1c47958e3727205d9cbb03069a49108ce697983c1967cf04f980cf3f607399e9a2c9e511d270f13154aa85a1cf9c92cfd0681f7ba56622134f663dd1
2020-08-25 13:36:05 -04:00
Ferdinando Ametrano
44dabcfa80 Avoided bare expect 2020-08-25 11:23:27 +02:00
Andrew Chow
550161b937
Merge #378: tests: Descriptor wallets, multisig fixes, and general cleanups
2c381fa2dc tests: Add trezor t back to mixed and external signing tests (Andrew Chow)
2ea932ed78 tests: Use m/48' for multisig tests (Andrew Chow)
4791841d63 tests: Use descriptor wallets (Andrew Chow)
c5a64885bc tests: Refactor multisig signtx to be able to use a separate path (Andrew Chow)
f0cef6ea39 tests: Combine multisig displayaddress path and descriptor tests (Andrew Chow)
10f094a0b0 tests: move xpub multisig displayaddress to separate test case (Andrew Chow)
84eacd63e1 tests: Properly skip multisig displayaddress for unsupported devices (Andrew Chow)
c6038cbbd9 tests: Use a unique wallet name for each test case (Andrew Chow)
e8316657a5 test: Remove wallet setup from displayaddress tests (Andrew Chow)
b9931556b1 tests: Refactor multisig setup in multisig displayaddress (Andrew Chow)
66182f0ca7 tests: Refactor wallet creation to parent class function (Andrew Chow)
4498c3f347 tests: Use parent class setUp and don't re-set self.rpc (Andrew Chow)
79f74a78fc tests: refactor --testnet in self.dev_args to __init__ (Andrew Chow)

Pull request description:

  * Refactor and cleanup wallet, RPC, and `--testnet` argument setup
    * A new wallet is made for each individual test case for now. Funds still provided by the default wallet.
  * Multisig setups are refactored and updated to not use the wallet
    * Common functionality is refactored into a separate function to deduplicate a bunch of code.
    * The setup itself is simplified to not require the use of the wallet.
  * The multisig descriptor with xpub test added in #353 is moved to its own function
  * The multisig `displayaddress` tests for descriptor and paths have been combined as they are basically the same
  * The wallet we import stuff into is now a descriptor wallet and we use `importdescriptors` now. This is necessary to fix the Trezor 1 test failure.
  * Change multisigs to use the `m/48'` path that is supposedly a standard but not really documented anywhere. This is necessary to fix the Trezor 1 test failure.

ACKs for top commit:
  instagibbs:
    reACK 2c381fa2dc

Tree-SHA512: 035c369fba908ba2836ad6af9e5d50b15d89ea23210be6d97a9bf5dd47d7f21a581ab6f2a59d9eb46d3732ac568c07b77e35962b48daf1bc26925edf7b9f9e49
2020-08-20 16:42:16 -04:00
Andrew Chow
2c381fa2dc tests: Add trezor t back to mixed and external signing tests 2020-08-20 15:27:26 -04:00
Andrew Chow
2ea932ed78 tests: Use m/48' for multisig tests
Apparently m/48' (where 48 is the purpose number in a BIP 44 path) is
the standard path for use with multisigs. This is mistakenly called BIP
48 in many places, but no such BIP 48 actually exists. Anyways, Trezor
requires multisigs use m/48' for multisigs, so we need to use them in
our tests.
2020-08-20 15:27:26 -04:00
Andrew Chow
4791841d63 tests: Use descriptor wallets
We are really targeting descriptor wallets, so we should be testing
those.

Because descriptor wallets also change how the imports will work w.r.t
rescans and the next address to give out, the getkeypool path checks are
changed to just check that the begin with the correct path prefix.
2020-08-20 15:27:26 -04:00
Andrew Chow
22f6d7d62e
Merge #379: Update docs regarding Trezor T mixed input support
991a14473d Update docs wrt Trezor T mixed input support (Martin Milata)

Pull request description:

  AFAICT Trezor T does support mixed segwit and non-segwit inputs, there's couple of tests for that: https://github.com/trezor/trezor-firmware/blob/core/v2.3.2/tests/device_tests/test_msg_signtx_mixed_inputs.py

ACKs for top commit:
  achow101:
    ACK 991a14473d

Tree-SHA512: 78549007f0bfa2075e5f37a47d5b5a06910e776827a2193f59dbd969718430964544e0f57e178e197d76df3adec2ae28c0a0a722c67be69a003841b58ce6e0da
2020-08-20 13:03:35 -04:00
Martin Milata
991a14473d Update docs wrt Trezor T mixed input support 2020-08-20 12:55:23 +02:00
Andrew Chow
c5a64885bc tests: Refactor multisig signtx to be able to use a separate path 2020-08-19 17:40:10 -04:00
Andrew Chow
f0cef6ea39 tests: Combine multisig displayaddress path and descriptor tests
Combine these because they're basically the same. Also uses subtests.
2020-08-19 16:30:19 -04:00
Andrew Chow
10f094a0b0 tests: move xpub multisig displayaddress to separate test case 2020-08-19 16:30:19 -04:00
Andrew Chow
84eacd63e1 tests: Properly skip multisig displayaddress for unsupported devices 2020-08-19 16:30:19 -04:00
Andrew Chow
c6038cbbd9 tests: Use a unique wallet name for each test case
Instead of a single wallet for all tests, make a wallet for each
individual test case (i.e. test function).
2020-08-19 16:30:19 -04:00
Andrew Chow
e8316657a5 test: Remove wallet setup from displayaddress tests
This is no longer needed.
2020-08-19 16:30:19 -04:00
Andrew Chow
b9931556b1 tests: Refactor multisig setup in multisig displayaddress
The path and descriptor tests do basically the same thing to setup the
multisig. Refactor that out to be separate and to not rely on the
wallet.
2020-08-19 16:30:19 -04:00
Andrew Chow
66182f0ca7 tests: Refactor wallet creation to parent class function 2020-08-19 14:00:40 -04:00
Andrew Chow
4498c3f347 tests: Use parent class setUp and don't re-set self.rpc
self.rpc is already setup when the test starts, no need to set it again.
Additionally, use the parent class setUp so we aren't duplicating as
much code.
2020-08-19 13:31:48 -04:00
Andrew Chow
79f74a78fc tests: refactor --testnet in self.dev_args to __init__ 2020-08-19 13:22:49 -04:00
Andrew Chow
8751d1c725
Merge #372: Cleaned up log messages
5e296ca4dc Cleaned up log messages (Ferdinando M. Ametrano)

Pull request description:

  In my team, we comment out that line to avoid Trezor writing to our LOG.info

  As they say "your mileage may vary", but a final user's LOG.info should not be polluted by third party library.

ACKs for top commit:
  achow101:
    ACK 5e296ca4dc

Tree-SHA512: bfde661893c2cd966f8656964b782d16a8190008c4a74d8c3bc2a4491cd5248062f8ed0e5ea022d440cb1f2674b1724011858c6431c67f643fae21ec22cd7922
2020-08-18 11:34:50 -04:00
Ferdinando M. Ametrano
5e296ca4dc Cleaned up log messages 2020-08-18 08:48:34 +02:00
Andrew Chow
f7776fcfb3
Merge #371: added gitignore directives for virtual environments
7a896e792b added gitignore directives for virtual environments (Ferdinando M. Ametrano)

Pull request description:

  virtual environments are routinely created in the root project (sub)folder(s) and should be ignored by Git

ACKs for top commit:
  achow101:
    ACK 7a896e792b

Tree-SHA512: fd5ae7cc430871a96d4db8336dad9f2206005fa9b05911445bc72363603b13fee97ef55c5fe3a65520d3a9203814014e71511b20d2c4cbd8eeff7fde85d14ca5
2020-08-17 12:08:17 -04:00
Andrew Chow
3adaa3c483
Merge #369: added py.typed so that static type checkers use type hints (PEP 561)
287bce9894 added py.typed so that static type checkers use package stubs (PEP 561) (Ferdinando Ametrano)

Pull request description:

  - Problem: mypy can't find type hints when importing from hwi
  - Solution: add a py.typed file to make hwi PEP-561-compatible

  At the moment hwi has type hints, but they are useless to packages importing from hwi because there is no py.typed file to tell mypy they're there.

  PEP 561 specifies that packages which contain either inline type hints or type stubs should indicate their support for type hints via including a blank file named py.typed in the root of the package. Package maintainers who wish to support type checking of their code MUST add it to their package supporting typing.

ACKs for top commit:
  achow101:
    ACK 287bce9894

Tree-SHA512: 536c3022a0ab71673c542eaf238f231e812dd8beda92269e61647ec8e22762de720f89a83c9711e648d687fc67bf8fcee627db80ade8f4b0829ea6bbba081f98
2020-08-17 12:04:23 -04:00
Ferdinando M. Ametrano
7a896e792b
added gitignore directives for virtual environments
virtual environments are routinely created in the root project (sub)folder(s) and should be ignored by Git
2020-08-17 15:03:22 +02:00
Ferdinando Ametrano
287bce9894 added py.typed so that static type checkers use package stubs (PEP 561) 2020-08-17 10:52:51 +02:00
Andrew Chow
914ad3ea66
Merge #353: Support multisig xpub descriptors on Trezor
78a8801f94 Support multisig xpub descriptors (benk10)

Pull request description:

  Trezor Model T has an option when displaying a multisig address to also show all xpubs used as cosigners of the multisig. Currently, the display address function did not support using xpubs, so here I added support in Trezor for such descriptors, which will make xpubs show up correctly.

ACKs for top commit:
  achow101:
    ACK 78a8801f94

Tree-SHA512: 707e56b3cbac5f21ccdaeba912e751f23fe5fff637c18366cbe76b618840d4ba38fd2442919e2ff61f770c8381e59a6147d385a44d2def5dad07d89a09730eed
2020-08-15 17:50:25 -04:00
benk10
78a8801f94 Support multisig xpub descriptors 2020-08-15 21:21:45 +02:00