1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-24 00:18:26 +00:00
Commit Graph

241 Commits

Author SHA1 Message Date
matejcik
db1a5adee7 device_tests: style 2018-11-26 17:02:00 +01:00
Tomas Susanka
0d01298f71 tests/eth: add invalid signature test for verify 2018-11-26 16:30:34 +01:00
matejcik
11e56a7e1b client: clean up constants 2018-11-26 15:30:42 +01:00
Tomas Susanka
786bccfa34 tests/lisk: all all all seed 2018-11-21 17:08:18 +01:00
Tomas Susanka
29d3a21d84 tests/eth: all all all seed 2018-11-21 17:08:18 +01:00
Tomas Susanka
f5af12c043 paths: compatibility for derivation paths checks 2018-11-21 17:08:18 +01:00
Pavol Rusnak
da3223d703
tests: change flags for test_msg_signtx_capricoin.py 2018-11-14 17:36:19 +01:00
strmci
252f946f40 Add a test case for segwit inputs/outputs with very high amounts (#337)
Add a test case for segwit inputs/outputs with very high amount, fixes #332
2018-11-12 16:27:56 +01:00
matejcik
ed473e2e42 trezorlib: add licence headers where missing 2018-11-12 12:22:32 +01:00
matejcik
85b85c67b3 trezorlib: reentrant session handling
This fixes the breakage introduced by transport reshuffles.
It's still not great and I'd love to see context manager based sessions.
But it's good enough for now.
2018-11-12 12:22:32 +01:00
matejcik
aac7726824 trezorlib: transport/protocol reshuffle
This commit breaks session handling (which matters with Bridge) and
regresses Bridge to an older code state. Both of these issues will be
rectified in subsequent commits.

Explanation of this big API reshuffle follows:

* protocols are moved to trezorlib.transport, and to a single common file.
* there is a cleaner definition of Transport and Protocol API (see below)
* fully valid mypy type hinting
* session handle counters and open handle counters mostly went away. Transports
  and Protocols are meant to be "raw" APIs; TrezorClient will implement
  context-handler-based sessions, session tracking, etc.

I'm calling this a "reshuffle" because it involved very small number of
code changes. Most of it is moving things around where they sit better.

The API changes are as follows.

Transport is now a thing that can:
* open and close sessions
* read and write protobuf messages
* enumerate and find devices

Some transports (all except bridge) are technically bytes-based and need
a separate protocol implementation (because we have two existing protocols,
although only the first one is actually used). Hence a protocol superclass.

Protocol is a thing that *also* can:
* open and close sessions
* read and write protobuf messages
For that, it requires a `handle`.

Handle is a physical layer for a protocol. It can:
* open and close some sort of device connection
  (this is distinct from session! Connection is a channel over which you can
  send data. Session is a logical arrangement on top of that; you can have
  multiple sessions on a single connection.)
* read and write 64-byte chunks of data

With that, we introduce ProtocolBasedTransport, which simply delegates
the appropriate Transport functionality to respective Protocol methods.

hid and webusb transports are ProtocolBasedTransport-s that provide separate
device handles. HidHandle and WebUsbHandle existed before, but the distinction
of functionality between a Transport and its Handle was unclear. Some methods
were moved and now the handles implement the Handle API, while the transports
provide the enumeration parts of the Transport API, as well as glue between
the respective Protocols and Handles.

udp transport is also a ProtocolBasedTransport, but it acts as its own handle.
(That might be changed. For now, I went with the pre-existing structure.)

In addition, session_begin/end is renamed to begin/end_session to keep
consistent verb_noun naming.
2018-11-12 12:22:26 +01:00
matejcik
ca345e9766 cardano: clean up test case 2018-11-06 13:38:13 +01:00
matejcik
81c55c1c5f device_tests: fix remaining use of btc.sign_tx 2018-11-06 13:38:09 +01:00
matejcik
1233feb358 style: fix imports 2018-11-06 13:36:25 +01:00
matejcik
620e48e4d0 tests: adapt tests to new APIs 2018-11-06 13:36:25 +01:00
Pavol Rusnak
b4e34b98fc
trezorlib: add monero getaddress/getwatchkey + tests 2018-11-04 15:27:45 +01:00
Tibor Arpas
e9b540e6b6 altcoin: Capricoin support tests and minor trezorctl addition. (#325) 2018-10-24 15:05:59 +02:00
Pavol Rusnak
57f1dddc2f
fix style 2018-10-23 15:30:31 +02:00
Pavol Rusnak
45265cdcb7
tests: enable Stellar tests for T1 2018-10-23 14:13:55 +02:00
Pavol Rusnak
7e9501e816
tests: fix test_protection_levels (add buttonrequest to reset workflow) 2018-10-23 12:26:10 +02:00
Pavol Rusnak
ac0731300e
fix style 2018-10-23 12:24:10 +02:00
Pavol Rusnak
0aa6e45eec
tests: add tests for missing multisig 2018-10-22 15:59:07 +02:00
Pavol Rusnak
43b7ca4fd6
tests: fix style 2018-10-22 15:41:27 +02:00
Pavol Rusnak
1397c3b4d9
tests: update T1+T2 reset+recovery tests to reflect new Confirm dialog 2018-10-22 14:44:36 +02:00
Pavol Rusnak
5e259ab2c3
tests: fix test for Zcash Sapling test 2018-10-17 16:59:11 +02:00
matejcik
00a3f24731 device_tests: raise timeout in TestMsgResetDeviceT2
because swipe_down action is slow and it might not finish
in time for reading reset_words, so you read the same reset_words twice
2018-10-16 17:17:08 +02:00
Pavol Rusnak
685f24b454
tests: add test for Zcash Sapling 2018-10-16 10:58:12 +02:00
Pavol Rusnak
837781eb55
vendor: update trezor-common, use Tx.version_group_id where possible 2018-10-15 17:52:11 +02:00
Pavol Rusnak
3d5fa7a2f6
tests: refactor test_msg_resetdevice_skipbackup 2018-10-11 17:26:20 +02:00
Pavol Rusnak
16d9d58ee1
tests: add test in resetdevice for combination of display_random and skip_backup 2018-10-11 15:29:30 +02:00
Pavol Rusnak
a1ba9db744
tests: re-enable Decred test for T2 2018-10-10 13:44:36 +02:00
Matheus Degiovani
688e885903 decred: Add sign message tests (#318) 2018-10-10 13:35:31 +02:00
matejcik
8618f44272 tests: fix signature of device.recover in expect-to-fail tests 2018-10-10 13:15:28 +02:00
matejcik
ffff11a462 style: isort & autopep 2018-10-10 13:15:28 +02:00
matejcik
886d4f18f4 device_tests: sample usage of input_flow 2018-10-10 13:15:28 +02:00
matejcik
0f7f694914 debug: fix test_msg_applysettings 2018-10-10 13:15:28 +02:00
matejcik
c37bc9c38e debug: improve infrastructure and expected message reporting 2018-10-10 13:15:28 +02:00
matejcik
06927e003e trezorlib: get rid of TextUIMixin
This also moves DebugLinkMixin to debuglink.py and converts the mixin to
a subclass of TrezorClient (which is finally becoming a
reasonable-looking class). This takes advantage of the new UI protocol
and is ready for further improvements, namely, queuing input for tests
that require swipes.

The ui.py module contains a Click-based implementation of the UI
protocol. Use of callback_* methods has been limited and will probably
be cleaned up further (The contract has changed so we'll try to make
third party code fail noisily. It is unclear whether a backwards
compatible approach will be possible).

Furthermore, device.recovery() now takes a callback as an argument. This
way we can get rid of WordRequest callbacks, which are only used in the
recovery flow.
2018-10-10 13:15:28 +02:00
Pavol Rusnak
00ebbbb1f3
tests: add test in resetdevice for combination of display_random and no_backup 2018-10-08 15:54:28 +02:00
Pavol Rusnak
cd006026dd
Revert "tests: enable Decred tests for T2"
This reverts commit d49a38d80f.
2018-10-08 14:34:26 +02:00
Pavol Rusnak
d49a38d80f
tests: enable Decred tests for T2 2018-10-06 13:50:37 +02:00
Pavol Rusnak
0f62c817d5
tests: fix warnings in test_msg_resetdevice_nobackup.py 2018-10-04 18:04:37 +02:00
Pavol Rusnak
3424f01ae7
tests: nitpicks in resetdevice_skipbackup, add resetdevice_nobackup 2018-10-04 17:40:53 +02:00
matejcik
dbcc903e52 cardano: fix tests broken after binascii removal 2018-10-02 16:51:53 +02:00
matejcik
4fb3acb029 style: uppercase hex constants to conform with black 18.9b0 style 2018-10-01 14:01:33 +02:00
Pavol Rusnak
7f55847ab1 tests: remove usage of binascii 2018-09-27 16:52:28 +02:00
Tomas Susanka
7e35dfa51e tests: style fix 2018-09-18 10:36:31 +02:00
ZuluCrypto
0d5fc9bddd
Stellar - failing test when an asset type of native is explicitly specified (instead of just left blank) 2018-09-17 19:13:24 -06:00
Pavol Rusnak
73c8a1c11f
tests: cleanup lisk tests 2018-09-14 12:23:38 +02:00
Pavol Rusnak
3831ddd5a9
tests: fix missing import in lisk tests 2018-09-14 11:37:42 +02:00