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

721 Commits

Author SHA1 Message Date
matejcik
269eaa298f tests: make a fixture out of client
also implement Cancel tests
2018-06-05 13:08:54 +02:00
ZuluCrypto
7673ebf952 stellar - add additional tests and instructions for calculating signature 2018-06-05 11:59:48 +02:00
Pavol Rusnak
17479f26a7
device_tests: re-enable decred test for T1 2018-06-02 15:53:22 +02:00
Pavol Rusnak
5e14a5f059
device_tests: cashaddr test in sign/verify message 2018-06-01 21:30:05 +02:00
Pavol Rusnak
1a642713a5
Revert "device_tests: update test_bip32_speed cache-speed ratio to 1.2x"
This reverts commit 2ab4751dcb.
2018-05-30 12:44:39 +02:00
Pavol Rusnak
61f5bbca91
vendor: update trezor-common 2018-05-30 11:31:12 +02:00
Pavol Rusnak
d4b17c5b36
device_tests: fix bitcore entry in coins.py 2018-05-30 10:50:49 +02:00
Pavol Rusnak
0d6ac99bf5
device_tests: fix bgold unit test 2018-05-29 17:33:18 +02:00
matejcik
279da34864 Merge branch 'matejcik/refactor' 2018-05-28 17:52:01 +02:00
matejcik
5191fd09be device_tests: add a compat test for cosi, checking interoperability between Trezor and local implementation 2018-05-28 17:41:52 +02:00
Pavol Rusnak
2ab4751dcb
device_tests: update test_bip32_speed cache-speed ratio to 1.2x 2018-05-28 16:58:42 +02:00
matejcik
8410151810 remove remaining usages of expand_path 2018-05-28 15:47:57 +02:00
matejcik
c10c3f7fd9 stellar: better way to handle default path
(maybe do this for other currencies too?)
2018-05-28 15:47:40 +02:00
matejcik
aace6577c8 log: remove special handling of Features/CoinType in prettyprinter
now that Trezor won't send CoinTypes anymore
2018-05-28 15:01:17 +02:00
matejcik
99bc267301 client: hide uninteresting functions from test tracebacks 2018-05-28 14:45:54 +02:00
matejcik
2bf34dc4b4 unit_tests: added test suite for Ed25519 and CoSi
It's rather slow so it's disabled by default.
Use `pytest -m slow_cosi` to run.
2018-05-28 14:20:45 +02:00
matejcik
a0f73b726d cosi: typehints, documentation, removed selftest 2018-05-28 14:20:26 +02:00
matejcik
0e8fe9e743 ed25519: type hints 2018-05-28 14:17:11 +02:00
Pavol Rusnak
648ef511b6
device_tests: use original ethereum message digest, enable ethereum_{sign,verify}message for T2 2018-05-25 14:23:16 +02:00
matejcik
2fdb5cd538 cosi: publish "pubkey from privkey" operation from ed25519 2018-05-25 13:12:42 +02:00
matejcik
886e269e2f trezorlib: mark ed25519 impl as private 2018-05-25 13:07:02 +02:00
Tomas Susanka
f273bbb736 tests/device/stellar: assert pubkey, address comment 2018-05-25 12:01:07 +02:00
matejcik
9982ef98f9 Merge branch 'master' into matejcik/refactor 2018-05-24 19:18:26 +02:00
matejcik
e779a251fb transport: better ways to handle errors when enumerating devices 2018-05-24 19:14:05 +02:00
matejcik
97fa4670ac transport: add message logging to bridge 2018-05-24 18:08:50 +02:00
Pavol Rusnak
e2962ef9f7
fix typo 2018-05-24 17:07:17 +02:00
Pavol Rusnak
bb5e49e452
device_tests: fix failed test 2018-05-24 17:02:11 +02:00
Pavol Rusnak
b67322be2f
device_tests: enable cashaddr tests (msg_getaddress, signtx_bcash) for T2 2018-05-24 16:40:27 +02:00
matejcik
17b37034e8 device_tests: fix test_msg_recoverydevice for T1 2018-05-23 17:08:16 +02:00
matejcik
f8f0be9c86 device_tests: fix T1 test differences in wording 2018-05-23 16:54:24 +02:00
matejcik
f2aee59e27 device_tests: do not xfail Lisk tests, they are now merged 2018-05-23 14:21:24 +02:00
matejcik
4b7926268e drop Lisk and Stellar sign/verify message functionality 2018-05-23 14:20:54 +02:00
matejcik
70172520fb protobuf: update messages from upstream.
This drops sign/verify messages for Lisk and Stellar so we have to
remove the corresponding methods.
2018-05-23 14:04:09 +02:00
Jan Pochyla
bc27089546 tests: remove lisk sign/verify 2018-05-23 13:16:14 +02:00
matejcik
ce7ee8ae30 device_tests: mark decred 2018-05-22 20:12:51 +02:00
matejcik
2225343c52 device_tests: in test_multisig, T1 raises a different message
expected: "Pubkey not found in multisig script"
actual: "signing.c:780:Pubkey not found in multisig script"
2018-05-22 20:12:51 +02:00
matejcik
013e0f6d66 device_tests: get nicer tracebacks by using pytest.raises instead of custom exception code 2018-05-22 20:12:51 +02:00
matejcik
224e3c18f5 device_tests: fix test_protection_levels for T1
a couple expected ButtonRequests were missing
2018-05-22 20:12:45 +02:00
matejcik
a4fe17b461 device_tests: xfail for decred. This should be investigated more though. 2018-05-22 17:51:41 +02:00
matejcik
465c01d4f7 device_tests: add more currency markers
missed Stellar tests, plus Ethereum, for good measure
2018-05-22 17:29:03 +02:00
matejcik
af98a4071a device_tests: allow custom runxfail
We can now selectively runxfail certain tests. This is useful for
accepting PRs into trezor-core:

1. trezor-core is going to get a pytest.ini that sets xfail_strict.
   That means that if an `xfail`ed test actually passes, that will
   break the test suite. So it will be visible when we implement
   a feature for which tests exist.
2. To allow PRs to pass the test suite without touching python-trezor
   directly, we add a new pytest.ini option: run_xfail.
   This adds a list of markers which will ignore `xfail`.
   So:
   2.1 First, the python-trezor PR marks the tests with the name
       of the feature. This commit already does that: Lisk tests
       are marked `@pytest.mark.lisk`, NEMs are `@pytest.mark.nem`,
       etc.
       The tests will be also marked with `xfail`, because the
       feature is not in core yet.
   2.2 Then, the trezor-core PR implements the feature, which makes
       the `xfail`ed tests pass. That breaks the test suite.
   2.3 To fix the test suite, the core PR also adds a `run_xfail`
       to `pytest.ini`: `run_xfail = lisk`.
       (it can take a list: `run_xfail = lisk nem stellar`)
       That will make the test suite behave as if the tests are not
       `xfail`ed. If the feature is implemented correctly, the tests
       will pass.
   2.4 When the PR is accepted to core, the next step should be
       a PR to python-trezor that removes the `xfail`s. After that,
       we should also remove the `run_xfail` option, just to be tidy.
2018-05-22 17:29:03 +02:00
Tomas Susanka
e656bbf072 stellar: xdr parse move to trezorctl; client works with messages 2018-05-17 17:17:09 +02:00
matejcik
db92b13f97 cosi: move things around
ed25519raw is moved back to trezorlib
ed25519cosi is renamed to cosi, and has a couple more functions,
with the expectation that TrezorClient.cosi_* methods will move there.

Also most code shouldn't need ed25519raw for anything, so it might get
renamed to "_ed25519" to indicate that it's a private implementation.

For now, I added a "verify" method to cosi, so that you don't need to
call into ed25519raw.checkvalid. But trezor-core's keyctl is also
using ed25519raw.publickey. I'm not sure if that's worth replicating
in cosi, or whether to just leave it be, so I'm leaving it be for now.

Importantly, new function "sign_with_privkey" does that math thing that
was part of the selftest and is also explicitly listed in keyctl.
(it's called sign_with_privkey because I expect to have a "sign" method
here that calls into Trezor)
2018-05-17 12:53:01 +02:00
Tomas Susanka
277296be90 tests/stellar: verify marked as not passing on T2 2018-05-16 15:04:00 +02:00
Tomas Susanka
3ee3083e8c tests/device/stellar: verify message 2018-05-14 16:53:10 +02:00
Tomas Susanka
bb74950e23 stellar: message is normalized before sign/verify 2018-05-14 15:33:57 +02:00
Tomas Susanka
22560128fe stellar: StellarSignMessage.message is bytes 2018-05-14 15:17:13 +02:00
Tomas Susanka
d57fe33582 tests/device/stellar: sign message 2018-05-14 14:09:39 +02:00
matejcik
cc7c8ccb59 client: clean up exception and decorator code 2018-05-11 15:34:49 +02:00
matejcik
a478dac5f7 client: clean up logging and printing 2018-05-11 15:34:23 +02:00
matejcik
123aec5d7d tests/device_tests: remove all star imports 2018-05-11 15:29:38 +02:00
matejcik
266e34eec4 tests/device_tests: disable protobuf outputs unless run with -v 2018-05-11 15:29:38 +02:00
matejcik
0b6ec27064 logging: get rid of pprint and VerboseWireMixin
(and also TrezorClientVerbose)
2018-05-11 15:29:38 +02:00
matejcik
ca8ebacab9 logging: convenience function to set up protobuf logging 2018-05-11 15:29:38 +02:00
matejcik
1e4c1c093e protobuf: improve prettyprint formatting 2018-05-11 15:29:38 +02:00
matejcik
eed91db880 protocol: python logging to supersede VerboseWire 2018-05-11 15:29:38 +02:00
matejcik
b7c7190573 trezorlib: remove Hash to btc_hash, prepare for moving it away from things 2018-05-11 15:29:38 +02:00
matejcik
325312d11c protobuf: move formatter function to protobuf where it belongs better 2018-05-11 15:29:38 +02:00
matejcik
579adb1871 tests: update to use parse_path 2018-05-11 15:29:38 +02:00
matejcik
d106869061 trezorlib: deprecate client.expand_path and move the staticmethod
to an ordinary function tools.parse_path

Also remove PRIME_DERIVATION_FLAG and move it to tools.HARDENED_FLAG
2018-05-11 15:29:37 +02:00
matejcik
4f66b37f25 tests: update imports after tests.support move 2018-05-11 15:29:37 +02:00
matejcik
603b201ad0 tests: create tests.support module
for things that should not be part of trezorlib but tests use them
2018-05-11 15:29:37 +02:00
Tomas Susanka
77766d2d0f tests/device/eth: known/unknown token test 2018-05-10 13:33:06 +02:00
matejcik
e0d850df7d protobuf: update generators and messages to be identical with trezor-core 2018-05-09 17:15:13 +02:00
Tomas Susanka
18adf6cc4d tests/stellar: marked as passing on T1 2018-05-09 16:34:51 +02:00
matejcik
5329bc9463
Merge pull request #167 from zulucrypto/stellar
[Stellar] [WIP] Add Stellar support to trezorctl
2018-05-07 14:23:56 +02:00
matejcik
dd0217c746 protobuf: update trezor-common and messages 2018-05-07 14:14:16 +02:00
matejcik
28264a4fe0 protobuf: improve description of sint_to_uint 2018-05-07 14:10:34 +02:00
matejcik
df8c3da1a2 protobuf: properly implement signed types (fixes #249) 2018-05-07 14:10:34 +02:00
matejcik
4c06a613b5 ethereum: do 'int_to_big_endian' conversion manually
instead of relying on 'rlp.utils' from which it was removed
by 1.0, and moved to 'eth_utils' which don't support py3.4
2018-05-04 17:43:58 +02:00
Tomas Susanka
6f032456fc tests/device/nem: mosaic with levy test 2018-05-03 14:03:38 +02:00
ZuluCrypto
7128347975
stellar tests - added missing pytest import 2018-04-28 13:06:13 -06:00
ZuluCrypto
5fccc4381b
fix style to match flake8 2018-04-28 12:59:08 -06:00
ZuluCrypto
200b5a71df
Merge remote-tracking branch 'upstream/master' into stellar 2018-04-28 12:54:32 -06:00
ZuluCrypto
2cf6414fa5
stellar - minor cleanup and simplification of some boolean field checks 2018-04-28 12:39:55 -06:00
Tomas Susanka
7cfbe689e8 tests/device/nem: different amounts; note about what is displayed 2018-04-27 17:39:04 +01:00
Tomas Susanka
50e755be46 tests/device/nem: known/unknown mosaics test 2018-04-27 17:37:29 +01:00
Aleksey Popov
8f31422adf lisk: Fix wrong signature in tx tests 2018-04-23 16:47:15 +02:00
ZuluCrypto
49025aad2b
stellar tests - fix imports and indicate that tests are currently expected to fail 2018-04-20 10:35:01 -06:00
ZuluCrypto
61f5e1df61
stellar.py now returns a tuple from parse_transaction_bytes and no longer uses a reserved argument name 2018-04-20 10:34:26 -06:00
ZuluCrypto
ea6ced4dae
client.py - refactor Stellar signing loop to make the message flow clearer 2018-04-20 10:33:56 -06:00
ZuluCrypto
94f3f43746
sync with current state of upstream master 2018-04-19 15:18:55 -06:00
ZuluCrypto
1fb521f4cd
client.py updated to use Stellar messages instead of map 2018-04-19 15:10:57 -06:00
ZuluCrypto
73b07a489b
stellar - refactor parser to return protobuf messages instead of map 2018-04-19 15:10:27 -06:00
ZuluCrypto
38647de7f9
client.py - minor style fixes and fix for use of "types.Message" instead of "proto.Message" 2018-04-19 13:29:36 -06:00
matejcik
1008c45100 tests: xfail Lisk tests until trezor-core#90 is merged 2018-04-18 15:46:10 +02:00
Aleksey Popov
45cca15e5f lisk: Add lisk_sign_tx 2018-04-18 12:09:09 +02:00
Aleksey Popov
5e1168c48d lisk: Add lisk_get_publickey 2018-04-18 12:09:09 +02:00
Aleksey Popov
514e808b56 lisk: Add lisk_verify_message 2018-04-18 12:09:09 +02:00
Aleksey Popov
d3685639f9 lisk: Add lisk_sign_message 2018-04-18 12:09:09 +02:00
Aleksey Popov
3e742177d2 lisk: Add lisk_get_address method 2018-04-18 12:09:09 +02:00
Aleksey Popov
c0418333c1 common: update trezor-common submodule 2018-04-18 12:09:09 +02:00
Tomas Susanka
fd16bbfc8e tests: nem mosaics fix 2018-04-16 12:39:17 +02:00
Tomas Susanka
767330aea0 tests: multisig fixes 2018-04-16 12:24:55 +02:00
Peter van Mourik
497f0467cf Added Wanchain support (#230) 2018-04-11 12:24:13 +02:00
Roman Zeyde
892eb41837 tests: add device test for auto-lock delay 2018-04-11 11:17:17 +02:00
Roman Zeyde
0a10b53e3a client: allow setting auto-lock delay 2018-04-11 11:17:17 +02:00
matejcik
ab62f5db6f flake8: delete trailing lines 2018-04-10 16:01:22 +02:00
matejcik
928498c666 coins: wrap JSON errors in an ImportError 2018-04-10 15:58:34 +02:00
matejcik
bd43363b1c coins: refactor, use data from coins.json instead of hardcoded lists 2018-04-10 15:58:34 +02:00
matejcik
c4f38fd740 trezor-common: update to version with Decred Testnet API URL 2018-04-10 15:58:34 +02:00
matejcik
40ff849228 flake8: make flake8 better and more strict
this removes some unused variables and also catches a couple bugs
2018-04-10 15:58:34 +02:00
matejcik
e3d59eedfb tx_api: drop completely unused Smartbit API 2018-04-10 15:58:34 +02:00
Tomas Susanka
edbcd2012d tests/device/nem: multisig tests 2018-04-10 14:50:01 +02:00
Tomas Susanka
891865f948 tests/device/nem: tests fixes due to layout changes 2018-04-09 13:40:23 +02:00
Pavol Rusnak
24dc617f36
disable bcash tests for T2 2018-04-05 17:03:36 +02:00
Jochen Hoenicke
e43a62cb03 Updated unit tests for cashaddr. (#195) 2018-04-05 11:20:08 +02:00
Tomas Susanka
0631a0a5b1 tests/device/nem: transfer multiple mosaics 2018-04-04 15:18:21 +02:00
Tomas Susanka
51d9a809bc tests: pytest xfail is used instead of skipping 2018-04-04 13:18:22 +02:00
ZuluCrypto
7eef1df6b0
stellar - added some unit tests 2018-04-03 19:50:38 -06:00
ZuluCrypto
1d722f838a
add Stellar support 2018-04-03 19:50:22 -06:00
ZuluCrypto
0902aefd62
update generated protobuf files with Stellar changes 2018-04-03 19:49:56 -06:00
matejcik
020b298020 tests/device: autodetect Trezor version and skip the appropriate tests automatically 2018-04-03 18:56:18 +02:00
Pavol Rusnak
12c58ce3cc transport: inject info about udev rules into io/os exception 2018-04-03 18:27:38 +02:00
Tomas Susanka
7c08800cb9 tests/device/nem: test files seperated; swiping for t2 2018-04-03 14:16:49 +02:00
Tomas Susanka
6935c0ee7d tests/device/nem: importance transfer test 2018-03-29 12:43:54 +02:00
Tomas Susanka
5ce254c535 tests/device/nem: aggregate modification test 2018-03-29 11:46:29 +02:00
Tomas Susanka
326056b968 tests/device/nem: mosaic supply change test; const fixes 2018-03-29 10:52:18 +02:00
Tomas Susanka
48cb8d0216 tests/device/nem: mosaic creation levy test 2018-03-29 10:41:49 +02:00
Tomas Susanka
3248b47e5b tests/device/nem: mosaic creation properties test 2018-03-29 10:41:49 +02:00
Tomas Susanka
0e108a662f tests/device/nem: mosaic_creation basic test 2018-03-29 10:41:49 +02:00
Tomas Susanka
ac51c73365 tests/device/nem: provision_namespace test 2018-03-29 10:41:49 +02:00
matejcik
e79026cb4b trezorlib: fix client ctors for transport arg
This restores the API before PR #241, and makes sure that ctor signature doesn't
depend on mixin order.
(Mixins will be going away shortly anyway.)
2018-03-28 15:57:50 +02:00
Roman Zeyde
bd3d014dd4 Allow specifying 'state' at ProtocolMixin c-tor 2018-03-28 14:31:20 +02:00
Tomas Susanka
5d0b5632b3 nem: missing return fix 2018-03-27 16:41:13 +02:00
Tomas Susanka
c4dc6e2c93 tests/device/nem: constants used 2018-03-27 16:06:49 +02:00
Jan Pochyla
8d296ed4c1 tests: add T2 RecoveryDevice test 2018-03-22 15:28:04 +01:00
Tomas Susanka
e435175d79 tests/device: nem encrypted payload doesn't ask for confirmation 2018-03-21 15:16:09 +01:00
Tomas Susanka
333343224b tests/device: typos in nem tests 2018-03-21 15:16:09 +01:00
matejcik
e4a2946398 nem: fill out address_n properly for nem_sign_tx 2018-03-21 14:56:27 +01:00
Tomas Susanka
93dbdb14c1 tests/device: nem encrypted payload 2018-03-21 13:29:23 +01:00
Jan Pochyla
71dd003637 tests: add T2 ResetDevice test 2018-03-20 16:47:11 +01:00
Jan Pochyla
3e65761395 debuglink: add new fields 2018-03-20 16:47:11 +01:00
matejcik
4b59d9191c flake8: fix complaints in new code.
One of these days I'm going to automate this check.
2018-03-20 13:29:33 +01:00
matejcik
7e1d962799 trezorlib: sign_tx only downloads non-segwit transactions.
This should achieve the same goal as PR #193.
In addition, this refactor removes usage of `_extend_` methods
and the unnecessary `_fill_missing` calls.
2018-03-20 13:10:08 +01:00
matejcik
afb3e04c24 trezorlib/protobuf.py: return BytesType from wire as bytes, not bytearray.
This makes more sense, because bytes are immutable and callers have no business
mutating structures from the wire anyway.

Incidentally this should fix issue #236, where rlp library would treat
bytes and bytearrays differently and produce invalid structures in our usecase.

Also very minor nitpicks and code cleanup for neater typing.
2018-03-20 13:00:36 +01:00
matejcik
f87d931ce7 trezorlib: factor out NEM to a separate module 2018-03-20 12:39:23 +01:00
Tomas Susanka
a5e3d50fb0 tests/device: nem bytes assert 2018-03-19 14:52:50 +01:00
matejcik
6efe4e4418 trezorlib/messages: regenerate messages with new pb2py
drop `from future import`
in __init__.py, import just the name, not *
2018-03-15 19:55:57 +01:00
Pavol Rusnak
35aadfd32f
update protobuf 2018-03-12 16:21:45 +01:00
Pavol Rusnak
a0dd3ee502
trezorctl: add passphrase_source handling to apply_settings 2018-03-12 15:25:52 +01:00
Pavol Rusnak
3ac96f5b00
update protobuf 2018-03-12 15:10:17 +01:00
Roman Zeyde
ab5e4eee34 tests: add test_msg_getecdhsessionkey.py (#233) 2018-03-11 22:51:14 +01:00
matejcik
6b51228090 use binascii.hexlify instead of bytearray.hex (which doesn't exist in python < 3.5) 2018-03-09 14:38:04 +01:00
matejcik
5edcea9ba6
transport: fix all_transports when required modules are missing (#232)
This lets the library work without libusb or hidapi (`--disable-libusb`, `--disable-hidapi`).
2018-03-09 10:58:24 +01:00
Tomas Susanka
89eac8f157 tests/device: more Bitcoin Gold tests
including segwit and multisig
updates https://github.com/trezor/trezor-core/issues/147
2018-03-08 14:35:56 +01:00
Tomas Susanka
869af4498b tests/device: Bitcoin Gold tests 2018-03-07 16:43:01 +01:00
Pavol Rusnak
683f383e90
tests: fix test_msg_getpublickey_curve.py (don't try public derivation for ed25519) 2018-03-07 15:46:09 +01:00
matejcik
d8c9c970f5 flake8: clean up imports from last commit 2018-03-07 15:28:35 +01:00
matejcik
dd052d07b0 better getch() functions, fixed windows version (fixes #207) 2018-03-07 15:18:32 +01:00