Commit Graph

184 Commits

Author SHA1 Message Date
Ferdinando Ametrano
44dabcfa80 Avoided bare expect 2020-08-25 11:23:27 +02: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
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
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
Ferdinando Ametrano
56f38aae8d avoided 'unused variables' namespace pollution 2020-08-08 16:35:52 +02:00
benk10
67a9d7a322 Fix descriptor fingerprint parsing when no derivation used 2020-08-07 23:59:48 +03:00
Marko Bencun
6ad1f8924f
fix CI issues 2020-07-22 00:54:31 +02:00
Andrew Chow
b7f3fa67c4 Remove psbt segwit fixes patch to bitcoind
This was merged into bitcoind, so no need to patch it ourselves.
2020-07-02 17:00:36 -04:00
Andrew Chow
d0de7b1326 Update bitcoind patch 2020-07-02 13:06:16 -04:00
Andrew Chow
55f9c7f61d Update speculos patch 2020-07-02 13:03:10 -04:00
Andrew Chow
2b8102e06a
Merge #324: Multisig display address
967138c2db Add test for multisig `displayaddress` (benk10)
a25baf858d Support multisig descriptors in `displayaddress` (benk10)
59f8c1d56a Support multisig `displayaddress` (ColdCard) (benk10)
5083bf4e6b Support multisig `displayaddress` (Trezor) (benk10)

Pull request description:

  Added support for multisig addresses in the `displayaddress` command for Coldcard, Trezor, and Keepkey.

  This PR is based on #279 and should replace it.
  For now, I mostly preserved justinmoon's API as he described it in [this message](https://github.com/bitcoin-core/HWI/pull/279#issue-341248821). I'll just add a few notes on that:
  - To prevent Coldcard format of sending all paths from being inconsistent with that of Trezor I allowed sending multiple paths to the Trezor too and it will simply find the correct one. That shouldn't be necessary but I just chose to add that to maintain consistency. That's not mandatory on Trezor though, so it still works just fine with either a single or multiple paths.
  - I also left the `--sh_wpkh` and `--wpkh` flags for now. I think it will be best to rename them to something like `--wrapped-segwit` and `bech32` or `--native-segwit`, but wanted to raise that up here too before changing.
  - ~~As for descriptor support, I did not add it yet since I didn't want this PR to be too big. I plan to add that support in a separate PR after this one is done, but if you think I should have it all in this PR that's possible too.~~
  **Edit:** I also added descriptor support for multisig, [see this comment](https://github.com/bitcoin-core/HWI/pull/324#issuecomment-621926077).

  The tests should cover Coldcard, Trezor, and Keepkey with 2-3 multi-sig. The setup for the test is borrowed mostly from the `sign_tx` tests code.

ACKs for top commit:
  achow101:
    ACK 967138c2db

Tree-SHA512: ddc9336581998507a88e4da6a4a028ba520a19e9a4df2a85733865efc6f0857c1cde8ffbdd84980867e06cf7e7d14a89e4cc5531fd2920c522268a91dc82df9d
2020-06-22 23:14:17 -04:00
benk10
967138c2db Add test for multisig displayaddress 2020-06-23 05:27:24 +03:00
Andrew Chow
da9e2e0435 tests: update bitcoind segwit fixes patch 2020-06-22 21:11:47 -04:00
Andrew Chow
5862228b18 Update Coldcard simulator patches
These got out of date and seem to be causing travis failures.
2020-06-22 19:41:42 -04:00
Andrew Chow
c08507737e tests: increase signtx keypool 2020-06-08 19:14:52 -04:00
Andrew Chow
a264d84422 test: Do legacy, then segwit, then mixed 2020-06-08 19:14:52 -04:00
Andrew Chow
f862135519 trezor: Set coin name as testnet when --testnet
Also update displayaddress test to use --testnet
2020-06-05 22:14:38 -04:00
Andrew Chow
3b6131c84a test: Patch bitcoind to give out PSBTs with both UTXOs 2020-06-05 22:14:38 -04:00
Andrew Chow
d85be9edde serialization: put missing final_scriptwitness length
The length of a final_scriptwitness value was missing. Put it back in.
2020-05-15 20:54:34 -04:00
Andrew Chow
2c5ad6310b
Merge #319: Trezors: Update to work with firmware 2.3 and 1.9
32989bb03a tests, trezor: Go back to using the master branch of trezor-firmware (Andrew Chow)
2862be4800 trezor: Update passphrase workflow and messages (Andrew Chow)
c3c6963b00 trezorlib: Initialize needs to be sent if there is no active session (Andrew Chow)
48498105e9 trezor: use GetPublicNode instead of Ping for promptpin (Andrew Chow)

Pull request description:

  Trezor firmware versions 2.3 and 1.9 changed a couple of things that were causing HWI to not work with them. This PR fixes those things.

  * Changed `promptpin` to use `GetPublicKey` message. The `Ping` message used previously no longer has a pin prompt option.
  * Updated messages and passphrase callback to match new passphrase workflow
  * Check for a session being initialized by doing a `GetPublicKey` and seeing if a `FirmwareError` is returned. If so, send an `Initialize` to start a session.

Top commit has no ACKs.

Tree-SHA512: f31a780d5ad447f6a5af3d54ceda78042c1fdeec09b6b7d6d9acae512d9a22286b809e42a95778a2d128edec677ef156c8327584eb4fc75aa21b4a39975a747a
2020-04-20 13:01:41 -04:00
Andrew Chow
baf9090ce7 tests: Update speculos patch 2020-04-17 21:40:05 -04:00
Andrew Chow
32989bb03a tests, trezor: Go back to using the master branch of trezor-firmware 2020-04-17 20:59:11 -04:00
Andrew Chow
3eff0da451
Merge #316: getkeypool: --all option for descriptor wallets
15b213a6dc add test for getkeypool --all (Gregory Sanders)
a232005e73 getkeypool: --all option for descriptor wallets (Gregory Sanders)

Pull request description:

  needs tests, putting this up for concept ACKs first. Seems to work(TM).

  resolves https://github.com/bitcoin-core/HWI/issues/315

ACKs for top commit:
  achow101:
    ACK 15b213a6dc

Tree-SHA512: 5c9cd747d231af5a37020e894c8ff46d8d39906fa86533b8c53b8191054bfd764daa18cd7a58ab449d5824298e908535c4b552d93289f49e298918fb0124b098
2020-04-16 13:52:05 -04:00
Gregory Sanders
15b213a6dc add test for getkeypool --all 2020-04-16 11:46:25 -04:00
Gregory Sanders
a232005e73 getkeypool: --all option for descriptor wallets 2020-04-16 11:46:25 -04:00
benk10
c8d9db693b Support Trezor and KeepKey toggle passphrase
Add `togglepassphrase` command which toggles the passphrase protection functionality for Trezor and KeepKey devices.
2020-04-15 11:33:26 +03:00
Andrew Chow
ab86822ea9 tests, ledger: enable signtx tests for ledger 2020-03-25 15:51:52 -04:00
Andrew Chow
124918cff8 tests: Update the speculos patch 2020-03-25 15:51:52 -04:00
Andrew Chow
93778ebd2c tests: redirect emulator output to logfiles 2020-03-24 12:53:43 -04:00
Andrew Chow
0373bf9856 tests: exit early if previous device fails 2020-03-24 12:53:20 -04:00
Andrew Chow
f719449b4e tests: Add missing self.seen_msg_hash to speculos patch 2020-03-20 12:13:51 -04:00
Andrew Chow
9b31a96f13 tests: Only send kill signal if process isn't already dead 2020-03-19 18:27:42 -04:00
Andrew Chow
9ab7373f07 tests: Run each device's test suite individually
Instead of adding all the device tests to a single overall
test suite that is run, do each device test as its own test suite
with its own test runner. The change allows us to not have too
many extra emulators/simulators running at once. Previously, when
the tests were being loaded, if that device had a global emulator,
it was started. These emulators were also left running during other
device tests. By splitting up the tests per device, we can ensure
that the emulators are only being run for their tests.
2020-03-19 18:27:42 -04:00
Andrew Chow
3f82e60f55 test, trezor: report model T in tests correctly
report the correct device name for the trezor specific tests
2020-03-19 18:27:42 -04:00
Andrew Chow
a741211819 tests: move setUp and tearDown to DeviceTestCase
Instead of defining the same function multiple times, just do it
once in the parent class.
2020-03-19 18:27:42 -04:00
Andrew Chow
e5808ac276 tests, ledger: Have speculos do button presses internally
Instead of having multiple threads and sockets to deal with
sending button presses, patch speculos to do that itself.
2020-03-19 18:27:42 -04:00
Andrew Chow
4a4bf70fcb tests: Use new speculos cli args
Speculos changed -b to --button-port and -n to --display, so we
need to use those.
2020-03-12 19:16:56 -04:00
Andrew Chow
cb13862378 tests: checkout Trezor T v2.2.0
The master branch seems to be incompatible with us right now, so
use the current latest, 2.2.0, for now.
2020-03-12 19:16:56 -04:00