1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 09:58:27 +00:00
Commit Graph

874 Commits

Author SHA1 Message Date
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
matejcik
3f92683bc6 firmware: update forgotten comment 2018-10-12 16:05:50 +02:00
matejcik
e1efd493fd trezorctl: updated firmware update flow
We can now locally verify firmware signatures and hashes. We also
recognize min_firmware_version, so this resolves #308

This also helps with #273, as trezorlib is now mostly usable for signing
firmware images.
2018-10-12 15:58:55 +02:00
matejcik
3e7b26b454 exceptions: smarter, nicer exceptions from Failures 2018-10-12 15:49:17 +02:00
matejcik
eb2b58e1f4 cosi: tests for new verify_m_of_n method 2018-10-12 12:58:49 +02:00
matejcik
ba365b5486 cosi: replace slow djb implementation of ed25519 with an optimized one
from https://github.com/pyca/ed25519

This makes the calculations several orders of magnitude faster, which
allows us to run the CoSi test in Travis. It also doesn't stop firmware
update for several seconds while we validate the CoSi signatures.

It's still essentially the same insecure implementation, fallible to all
the same timing attacks, and it shouldn't be used for anything except
validating public signatures of public data. But now it also takes about
as much time as it should on modern hardware.
2018-10-12 12:58:44 +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
88988172b9 bridge: perform HTTP request in read, not write
This allows us to return early from a `write`, which we need in cases
where we want to perform an operation inbetween `read` and `write` -
namely, callback for ButtonRequest should technically be invoked after
returning ButtonAck but before waiting for device's response.

Of course that doesn't really work. The callback will actually be
invoked _before_ ButtonAck, so there's still the condition that it must
return immediately or the device gets stuck with a black screen.

But doing this allows us to write code *as if* it worked, which lets the
other transports run free and wild, by which I mean, do the Right Thing
2018-10-10 13:15:28 +02:00
matejcik
2d7c74c535 switch to click 7.0 2018-10-10 13:15:28 +02:00
matejcik
8618f44272 tests: fix signature of device.recover in expect-to-fail tests 2018-10-10 13:15:28 +02:00
matejcik
1d3fa77ab6 debuglink: allow with-block without expected_responses 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
fc7a76e2f3 tests: use stdlib mock instead of the third-party one 2018-10-10 13:15:28 +02:00
matejcik
a5abd70619 trezorlib: drop TrezorClientDebugLink from client.py 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
Matheus Degiovani
6d9157c4a5 decred: Return tree and version in insight api (#319) 2018-10-10 12:44:54 +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
c395501d2d
trezorctl: add no-backup option to reset-device 2018-10-08 14:17:07 +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
Jochen Hoenicke
b4c5b996a1 Fix Qt5/4 import strategy.
- Try Qt5 before Qt4.
- Handle all exceptions (a ValueError is thrown if the wrong Qt was
  imported earlier)
2018-10-04 17:42:59 +02:00
Pavol Rusnak
3424f01ae7
tests: nitpicks in resetdevice_skipbackup, add resetdevice_nobackup 2018-10-04 17:40:53 +02:00
matejcik
d859fe36f7 coins: pick correct field name for TxApi 2018-10-04 17:14:46 +02:00
matejcik
dbcc903e52 cardano: fix tests broken after binascii removal 2018-10-02 16:51:53 +02:00
matejcik
a66cf99b74 cosi: fix bug in signing code, make tests pass 2018-10-02 16:11:20 +02:00
matejcik
4fb3acb029 style: uppercase hex constants to conform with black 18.9b0 style 2018-10-01 14:01:33 +02:00
matejcik
15d3b0c722 cosi: clarify convoluted parts of local signing code 2018-09-27 16:53:57 +02:00
Pavol Rusnak
4a0ca873eb trezorlib+tools: remove usage of binascii 2018-09-27 16:52:28 +02:00
Pavol Rusnak
7f55847ab1 tests: remove usage of binascii 2018-09-27 16:52:28 +02:00
Dusan Klinec
61de49fae5
protob test fix after migration to get_fields() 2018-09-20 14:35:47 +02:00
Dusan Klinec
6b32e33c58
protobuf.py uses get_fields() 2018-09-20 13:57:26 +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
Aleksey Popov
144c8c1f5b
lisk: enable tests for t1 (xfail) 2018-09-14 11:26:07 +02:00
Tomas Susanka
f968d68651 tests: tezos is not xfailed anymore 2018-09-13 15:12:42 +02:00
Pavol Rusnak
045c078a50
tests: reduce test_protect_call.py duration from 26 seconds to 5 2018-09-12 20:37:12 +02:00
Pavol Rusnak
6074903d6b
tests: regenerate decred signing tests
because decred people wanted to change bip32_name
in 0b0f01fb59
2018-09-12 19:33:15 +02:00
Adrián Matejov
15df848b05 added Tezos support (#302)
* also added device tests for tezos

Signed-off-by: Adrian Matejov <adrian.matejov@simplestaking.com>

We also pushed signed operations to betanet network and they got accepted.
Here's the list of them
* transaction tz1 http://tzscan.io/ong8MQBX595Ld4dteHCbPqd6uzmEorEft6ZvfiX5vQMX4WHRh7K
* transaction tz2 http://tzscan.io/ooHZ2vbFX1M1fmr9KpLPWQ8r6oZB2RikpGBXsoQSZfbV1hWVjCP
* transaction tz3 http://tzscan.io/op79uLwaFqNB6SgcaAaJtoHFBQk3mL5bC1BQTvYzwX2DVSr8RJG

* origination tz1 http://tzscan.io/ooJg7qXtUjh16AtdSvv5kgaQnxjtAiBysFkG3EaG5qPAuDT1Cym contract http://tzscan.io/KT1VakcExcig27ZAuoLTExgGXtvUsykQSf5R
* origination tz2 http://tzscan.io/opDrUvCGUwKeu86b7GbRLeVzAkyKkdfnV9aSGAzGDLYYS11m6Qr contract http://tzscan.io/KT1LdQeHBSpvvzdRH495qHmtagavZcZ9Z5GW
* origination tz3 http://tzscan.io/opVWtfwvSvHzC6hsSGG31G23Q6nBov8SSvmA2nYXBNc5fWGk3Bg contract http://tzscan.io/KT1VfKfsgKFEfZ5vZUaZNaZyGrQf1gr1MEqr

* delegation tz1 http://tzscan.io/onws37YkYRnUvwYiPqYATZFtBVhBwbS2rdPkQjFGbAfLzt82MGa
* delegation tz2 http://tzscan.io/oocKfbotJwN5Zvmoybhb9LUJ6VhmeS42G2oZHaXQ2mXm98Rzx8r
* delegation tz3 http://tzscan.io/ooFQBcoMzwseJHnFgQ9fEPxAXhtgifuvvEH1CtmyAtnK5R7Drik

* transaction+reveal tz2 http://tzscan.io/ooEyN4FxP8RYh98RJgQxposDUuWHLWT8fUzWawNRCsMGxaNAN9c
* transaction+reveal tz3 http://tzscan.io/ooLaWQzZj1cbkMjZAifV71QCu5bdbMtET5CabrzLWQmnGMMhwmE
2018-09-10 16:40:31 +02:00
matejcik
cb4c366ce9 device_tests: add signtx expected responses generator 2018-09-10 16:02:17 +02:00
Pavol Rusnak
51f178ef1a
tests: cleanup CardanoGetPublicKey test 2018-09-07 19:22:57 +02:00
Tomas Susanka
ea77deeaed tests: xfail marks removed 2018-09-07 17:21:41 +02:00
Tomas Susanka
5fadcb6b06 tests/ontology redundant swipe removed
This bug caused other tests (resetdevice_t2 in particular) to fail. This
is because the test made one more swipe than was supposed to. This led to
a failure in resetdevice tests, which do swipes as well and read data
returned, which did not fit due to the redundant swipe.
2018-09-07 16:33:16 +02:00
Pavol Rusnak
949438f4c5
tests: add script_type test to getpublickey test 2018-09-06 19:05:53 +02:00
Dušan Plavák
bd6bcf7dfa Add network param to cardano sign tx (#306) 2018-09-06 17:25:55 +02:00
matejcik
305cb55d02 style: reformat client.py 2018-09-06 17:09:37 +02:00
Pavol Rusnak
434f279069
use implicit encoding in encode/decode 2018-09-06 16:22:38 +02:00
Matus Zamborsky
21326d3a41 add Ontology support (#301)
* add Ontology support

Signed-off-by: Matus Zamborsky <zamborsky@gmail.com>
2018-09-06 15:36:44 +02:00
Tomas Susanka
4f572f9e15 cardano: remove sign/verify functions 2018-09-06 14:54:06 +02:00
matejcik
351c017583 style: more known_third_party modules
because frankly, isort's detection is a huge mess
2018-09-05 15:43:29 +02:00
Pavol Rusnak
555bb62e3f
btc: add script_type to get_public_node 2018-09-05 15:21:11 +02:00
Dušan Plavák
fb22b894ba Add cardano support to trezorctl and some tests (#300)
Add cardano support to trezorctl and some tests
2018-09-05 14:56:31 +02:00
Tomas Susanka
6c15a41514 tests: ripple fix 2018-09-05 10:42:32 +02:00
matejcik
80766ca6b3 tests: xfail Stellar on T1 until we re-enable it 2018-09-04 16:14:29 +02:00
matejcik
d235875e5e build: support new tooling in trezor-common 2018-09-04 15:51:38 +02:00
matejcik
e5c2329b80 client: drop stellar_get_public_key from compatibility links 2018-09-04 15:51:38 +02:00
matejcik
1de1ff2823 tx_api: fix issue on python < 3.5 2018-09-03 14:59:39 +02:00
matejcik
0f71cbcc44 tx_api: update to assume "/api" path again, let blockHash request be
cached
2018-09-03 14:59:29 +02:00
Tomas Susanka
88a02822d3 stellar: public key methods removed 2018-09-03 14:57:10 +02:00
Pavol Rusnak
3c48f906b2 tests: fix eip155 test 2018-09-03 14:53:53 +02:00
HackyMiner
5a4c37d41c add more eip155 test cases (#297) 2018-09-03 14:52:57 +02:00
matejcik
88b50ac2ff style: add makefile with style targets, final touchups 2018-08-21 16:30:22 +02:00
matejcik
e2d45397d4 device_tests: smarter device selection
skips bridge, dies somewhat more cleanly when no device found
2018-08-21 16:06:18 +02:00
matejcik
abf0e82d80 trezorlib: implement auto-creating protobuf messages from dicts
along with a convert_dict function to rename keys from camelCase
and optionally apply simple field renames
2018-08-21 16:02:15 +02:00
matejcik
f05f9a2b37 nem: make a clearer flow for create_sign_tx 2018-08-21 15:57:50 +02:00
matejcik
3d3e9b67b4 style: apply black/isort 2018-08-13 18:22:19 +02:00
matejcik
e336f578af device_tests: update test_msg_getentropy to new style 2018-08-13 15:49:12 +02:00
matejcik
29f928e4f2 style: bare excepts, left-over bad imports 2018-08-10 16:05:14 +02:00
matejcik
5259146a0b style: remove unused imports with autoflake 2018-08-10 15:48:39 +02:00
matejcik
ca608d0a98 flake8: fix complaints (for the last time, hopefully) 2018-08-10 15:24:21 +02:00
matejcik
6029a98414 debuglink: fix bug in self_test bootloader detection 2018-08-10 15:18:34 +02:00
matejcik
4b4469b9f4 tests: clean up usage of hardening constants 2018-08-10 14:37:49 +02:00
matejcik
c0ef1ec535 tests: use new API 2018-08-10 14:04:58 +02:00
matejcik
d5dee0c897 trezorlib: move mostly-debug methods from device to debuglink 2018-08-10 13:33:14 +02:00
matejcik
65d8adb0be trezorlib: rename device.*_device to device.* 2018-08-10 13:32:50 +02:00
matejcik
a3d560529c trezorlib: post-merge updates 2018-08-06 16:15:44 +02:00
matejcik
2bb7088281 Merge branch 'master' into matejcik/client-split 2018-08-06 16:13:04 +02:00
D.Matskevych
5a677c3782 Added Zencash supporting 2018-07-26 11:34:51 +02:00
Pavol Rusnak
9462601849
tests: extract eip155 tests for ethereum, add more cases 2018-07-19 18:06:56 +02:00
Tomas Susanka
2a5ca12924 ripple: fix invalid fee test 2018-07-13 13:25:43 +02:00
matejcik
5b49658c8b ripple: fix broken fail-test 2018-07-12 16:56:47 +02:00
Tomas Susanka
61e63c6a02 ripple: ripple prefix dropped in functions 2018-07-12 16:36:33 +02:00
Tomas Susanka
c0f29bf4fd ripple: proper sign_tx command 2018-07-12 16:36:33 +02:00
Tomas Susanka
37847fb56f ripple: client functions moved to ripple.py 2018-07-12 16:36:33 +02:00
Tomas Susanka
77414ad761 ripple: code review fixes 2018-07-12 16:36:33 +02:00
Tomas Susanka
2017dadfcb ripple: sign tx command including tests 2018-07-12 16:36:33 +02:00
Tomas Susanka
147e7e21cb ripple: get address command including tests 2018-07-12 16:36:33 +02:00
Tomas Susanka
8348d47fd7 stellar/tests: T2 support merged -> xfail dropped 2018-07-12 15:21:46 +02:00
Tomas Susanka
e5cdf45956 stellar/tests: some device tests set show_display=True 2018-07-11 16:03:38 +02:00
matejcik
87837bc305 stellar: drop protocol_version 2018-07-09 14:06:11 +02:00
matejcik
7083eb7a5c trezorlib: drop @field decorator
its function is replaced by @expect(field="name") -- it doesn't make sense
to use @field without @expect anyway
2018-07-09 13:57:30 +02:00
matejcik
00617817c3 trezorlib: disable encrypt/decrypt message functionality
it is disabled in Trezors and its utility is unclear
2018-07-09 13:56:22 +02:00
matejcik
7e90e89e69 client: get rid of TrezorClient._convert_prime 2018-07-09 13:56:22 +02:00
matejcik
23b58cc0cb flake8: fix complaints 2018-07-09 13:56:22 +02:00
matejcik
f3a042db80 trezorlib: split out methods from ProtocolMixin 2018-07-09 13:56:22 +02:00
matejcik
1820f529fc trezorlib: shuffling things from client 2018-07-09 13:50:25 +02:00
matejcik
2f3a32f8e8 trezorlib: drop support for EncryptMessage and DecryptMessage 2018-07-09 13:46:18 +02:00
matejcik
19a0f4cc7b tx_api: support blockbook, allow url-less operation
Bitcoin Testnet backends were removed.
This broke our tests that work purely on local data but nevertheless
need to know backend URLs. Because the design is less than ideal.

Here, we do a little cleanup:
* blockbook URLs are respected
* Dogecoin is now supported by our blockbook backend so we don't need
  a special tx-api implementation
* it's possible to instantiate a TxApi that is backed by the cache,
  without a known URL
* relevant tests now make use of this feature
2018-07-09 13:46:18 +02:00
matejcik
85a32d01b9 build: do not import trezorlib in setup.py, parse out __version__ by hand
also update path to coin generating tool
2018-07-09 13:46:18 +02:00
matejcik
6f23331dfc build: remove prebuilt protobuf files
Also clean out .gitignore a little while we're at it
2018-07-09 13:46:18 +02:00
matejcik
ad16588171 stellar: update T1 tests 2018-06-28 12:40:49 +02:00
ZuluCrypto
b2f35de8b8 stellar.py - do not alias trezorlib.messages import to "proto" 2018-06-28 11:57:56 +02:00
ZuluCrypto
cd7189839c stellar - return addresses as utf-8 strings 2018-06-28 11:57:56 +02:00
ZuluCrypto
2549eaf5a6 test_stellar.py - split imports into two lines and do not alias messages to "proto" 2018-06-28 11:57:56 +02:00
ZuluCrypto
05afd986c1 test_stellar.py - fix style issues 2018-06-28 11:57:56 +02:00
ZuluCrypto
af38407a43 stellar - add unit tests for parsing XDR 2018-06-28 11:57:56 +02:00
ZuluCrypto
96f0801b90 stellar.py - fix missing destination_amount when parsing path payment 2018-06-28 11:57:56 +02:00
ZuluCrypto
dd324a99c5 stellar.py - fix mising str() cast on type 2018-06-28 11:57:56 +02:00
ZuluCrypto
8a284c03d1 stellar.py - fix incorrect constants 2018-06-28 11:57:56 +02:00
ZuluCrypto
4628327789 fix comment 2018-06-28 11:57:56 +02:00
ZuluCrypto
188178a438 stellar - add test for setting inflation destination 2018-06-28 11:57:56 +02:00
ZuluCrypto
6afaa41616 stellar - _xdr_read_address now returns string instead of bytes 2018-06-28 11:57:56 +02:00
Pavol Rusnak
cc6cc49999
tests: re-enable Stellar for T1 2018-06-27 17:42:11 +02:00
Tomas Susanka
5f73976893 stellar: note on BIP-32 usage; address test with Stellar's official test vectors 2018-06-26 11:52:47 +02:00
matejcik
201297a1f9 tests: close debuglink in fixture-based tests 2018-06-22 14:18:18 +02:00
Pavol Rusnak
3c1456939c
tests: update test_cancel to test using Initialize 2018-06-22 13:28:32 +02:00
matejcik
f9f79b745c Merge branch '0.10.x' 2018-06-22 13:19:28 +02:00
matejcik
b7cbbba6a7 release: bump version to 0.10.2 2018-06-21 16:50:38 +02:00
matejcik
54f1599a5a regenerate license headers
This clarifies the intent: the project is licenced under terms
of LGPL version 3 only, but the standard headers cover only "3 or later",
so we had to rewrite them.

In the same step, we removed author information from individual files
in favor of "SatoshiLabs and contributors", and include an AUTHORS
file that lists the contributors.

Apologies to those whose names are missing; please contact us if you wish
to add your info to the AUTHORS file.
2018-06-21 16:49:13 +02:00
Tomas Susanka
10bbb57c86
tests/device: stellar accounts are addresses 2018-06-20 15:58:13 +02:00
Pavol Rusnak
44ac7656b4
vendor: update trezor-common; regenerate protobuf 2018-06-20 15:57:35 +02:00
Pavol Rusnak
b1eae58884
tests: disable Stellar tests for T1 too 2018-06-20 00:13:34 +02:00
Pavol Rusnak
3f93b28fe4
device_tests: fix test_msg_signtx_zcash 2018-06-15 10:35:28 +02:00
Tomas Susanka
ebe41c69f8 tests/stellar: trezor core currently throws Firmware err 2018-06-13 13:40:58 +02:00
Pavol Rusnak
015d72102d
device_tests: add failing tests for stellar 2018-06-11 19:22:16 +02:00
matejcik
cf661a8196 Merge branch 'fix-0.10.1' 2018-06-11 19:05:32 +02:00
Pavol Rusnak
1477c9aa9e
trezorctl/trezorlib: add show_display to StellarGetAddress/StellarGetPublicKey 2018-06-11 18:55:52 +02:00
matejcik
77361e563d release: bump version and changelog for 0.10.1 2018-06-11 18:51:16 +02:00
Tomas Susanka
22872c53c2 tests/stellar: missing field annotation 2018-06-11 18:42:23 +02:00
Tomas Susanka
d3d9ceb0c4 tests: stellar test for get address 2018-06-11 18:42:23 +02:00
Tomas Susanka
c0a823ca1c protobuf: stellar get address 2018-06-11 18:42:23 +02:00
matejcik
741f264a2f release: bump version and add date to changelog 2018-06-08 16:07:46 +02:00
matejcik
d2021fd8a2 ckd_public: restore as a deprecation wrapper
(because older versions of electrum will still require it)
2018-06-07 17:07:20 +02:00
matejcik
73f016c465 trezorctl: update firmware_update to work better with TT (fix #269)
This removes the --erase option which was fishy before (and is now superseded
by wipe_device in bootloader mode).

Also adds a draft of "local fingerprint check" functionality for T1. This will
be expanded to work with TT in future releases.
2018-06-07 17:06:31 +02:00
Tomas Susanka
63222931be tests/device: nem is not xfail anymore 2018-06-07 14:41:47 +02:00
matejcik
e110d87494 protobuf: update trezor-common and regenerate 2018-06-07 14:07:26 +02:00
Aleksey Popov
922748e348 lisk: restore Lisk sign and verify message functionality 2018-06-07 14:07:26 +02:00
Pavol Rusnak
9238382435
tests: update test_msg_signtx_zcash 2018-06-06 16:42:58 +02:00