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

597 Commits

Author SHA1 Message Date
matejcik
8b2e2112bc style(python/btc): better specification of type of prev_txes
[no changelog]
2022-01-13 13:01:17 +01:00
grdddj
e3d366e65b feat(python): ScriptUI for trezorctl, reference client implementation 2022-01-12 14:52:01 +01:00
matejcik
dfab3efb86 style(python): fix typecheck issues
[no changelog]
2022-01-07 21:41:17 +01:00
Pavol Rusnak
b0e0280465 chore: drop obsolete fw_vendor_keys field from Features
[no changelog]
2022-01-03 14:23:58 +01:00
Alisina Bahadori
77ab865386 feat(legacy): Implement EIP-712 signing 2021-12-19 20:36:30 +01:00
matejcik
38d44e6803 chore(python): bump trezorlib version in repo 2021-12-10 10:54:04 +01:00
matejcik
b343ad3931 style(python): mark Reader/Writer protocol arguments as position-only
Using `__`-prefixed names seems to be a convention for specifying
position-only arguments before Python 3.8. Pyright respects this
convention and in fact requires it since version 1.1.192.
2021-12-08 10:00:48 +01:00
matejcik
a4bcc95deb feat(python): introduce Trezor models
This keeps information about vendors and USB IDs in one place, and
allows us to extend with model-specific information later.

By default, this should be backwards-compatible -- TrezorClient can
optionally accept model information, and if not, it will try to guess
based on Features.

It is possible to specify which models to look for in transport
enumeration. Bridge and UDP transports ignore the parameter, because
they can't know what model is on the other side.

supersedes #1448 and #1449
2021-12-07 16:55:58 +01:00
matejcik
38fca4a83d chore(python): regenerate GNU copyright headers 2021-12-07 16:55:58 +01:00
matejcik
83bb3a0932 feat(python): show progress bar for firmware upload 2021-12-07 16:55:58 +01:00
matejcik
a2a8cc88d9 feat(python): make the protobuf mappings overridable 2021-12-07 16:55:58 +01:00
Andrew Chow
dbf57d745a feat(python): Optionally init_device in TrezorClient 2021-12-07 16:55:58 +01:00
Andrew Chow
23a09fc047 feat(python): Raise ValueError for non-existant tx hashes
If the device asks for a tx_hash which is not present in prev_txes,
raise a ValueError with some more detailed messaging about the missing
hash rather than the default dictionary lookup failure of KeyError.
2021-12-07 16:55:58 +01:00
grdddj
d6b99ba3eb fix(python): allowing PIN/passphrase input for Git Bash 2021-12-01 13:06:41 +01:00
matejcik
c2bad83296 refactor(python): improve handling of data for trezorlib.ethereum.sign_tx() 2021-11-26 16:28:49 +01:00
grdddj
1a0b590914 feat(python): add full type information
WIP - typing the trezorctl apps

typing functions trezorlib/cli

addressing most of mypy issue for trezorlib apps and _internal folder

fixing broken device tests by changing asserts in debuglink.py

addressing most of mypy issues in trezorlib/cli folder

adding types to some untyped functions, mypy section in setup.cfg

typing what can be typed, some mypy fixes, resolving circular import issues

importing type objects in "if TYPE_CHECKING:" branch

fixing CI by removing assert in emulator, better ignore comments

CI assert fix, style fixes, new config options

fixup! CI assert fix, style fixes, new config options

type fixes after rebasing on master

fixing python3.6 and 3.7 unittests by importing Literal from typing_extensions

couple mypy and style fixes

fixes and improvements from code review

silencing all but one mypy issues

trial of typing the tools.expect function

fixup! trial of typing the tools.expect function

@expect and @session decorators correctly type-checked

Optional args in CLI where relevant, not using general list/tuple/dict where possible

python/Makefile commands, adding them into CI, ignoring last mypy issue

documenting overload for expect decorator, two mypy fixes coming from that

black style fix

improved typing of decorators, pyright config file

addressing or ignoring pyright errors, replacing mypy in CI by pyright

fixing incomplete assert causing device tests to fail

pyright issue that showed in CI but not locally, printing pyright version in CI

fixup! pyright issue that showed in CI but not locally, printing pyright version in CI

unifying type:ignore statements for pyright usage

resolving PIL.Image issues, pyrightconfig not excluding anything

replacing couple asserts with TypeGuard on safe_issubclass

better error handling of usb1 import for webusb

better error handling of hid import

small typing details found out by strict pyright mode

improvements from code review

chore(python): changing List to Sequence for protobuf messages

small code changes to reflect the protobuf change to Sequence

importing TypedDict from typing_extensions to support 3.6 and 3.7

simplify _format_access_list function

fixup! simplify _format_access_list function

typing tools folder

typing helper-scripts folder

some click typing

enforcing all functions to have typed arguments

reverting the changed argument name in tools

replacing TransportType with Transport

making PinMatrixRequest.type protobuf attribute required

reverting the protobuf change, making argument into get_pin Optional

small fixes in asserts

solving the session decorator type issues

fixup! solving the session decorator type issues

improvements from code review

fixing new pyright errors introduced after version increase

changing -> Iterable to -> Sequence in enumerate_devices, change in wait_for_devices

style change in debuglink.py

chore(python): adding type annotation to Sequences in messages.py

better "self and cls" types on Transport

fixup! better "self and cls" types on Transport

fixing some easy things from strict pyright run
2021-11-26 16:28:49 +01:00
grdddj
77afcb335b chore(python): replacing attrs with dataclasses 2021-11-26 16:28:49 +01:00
grdddj
57579c5a80 chore(python): removing pyblake2 as a required library 2021-11-26 16:28:49 +01:00
Pavol Rusnak
0fc3b32b7e fix(python): accept also "taproot" for taproot scripts in cli
[no changelog]
2021-11-22 11:25:19 +01:00
matejcik
a1a1a7a36c fix(proto): fix typo in previous commit 2021-11-19 15:03:33 +01:00
Andrew Kozlik
9a7990d087 feat(tests): Add no_script_type device tests for SignMessage. 2021-11-10 17:35:57 +01:00
Andrew Kozlik
c2f1850abb feat(common): Add no_script_type option to SignMessage. 2021-11-10 17:35:57 +01:00
matejcik
2a2da21879 fix(python/debuglink): fix formatting for expected messages
This was broken by the previous commit removing f-strings. For this
reason, `format()` was renamed to `to_string` to make it clearer that
it's not the `str.format` method.
2021-11-10 13:57:57 +01:00
matejcik
f8b9cda05d feat(python): support Cardano derivation type arguments 2021-11-10 13:57:57 +01:00
matejcik
10e338e005 feat(core/cardano): allow derivation type selection 2021-11-10 13:57:57 +01:00
matejcik
9922e7ba48 feat(python): support derive_cardano setting 2021-11-10 13:57:57 +01:00
matejcik
846eca36ca feat(python): add type information to the UI object 2021-11-10 13:57:57 +01:00
matejcik
8caac218ec feat(core/cardano): indicate whether Cardano seed should be derived 2021-11-10 13:57:57 +01:00
Jun Luo
3af00f4181 chore(python/stellar): bump stellar-sdk to 5.0.0.
[no changelog]
2021-11-04 13:16:29 +01:00
Jun Luo
b3ac52e98c refactor(python/stellar): Since the firmware does not support MuxedAccount, we refuse to process this type of transaction. 2021-11-04 13:16:29 +01:00
Jun Luo
62b649ef5d refactor(common & core & legacy): Stellar, rename StellarCreatePassiveOfferOp to StellarCreatePassiveSellOfferOp. 2021-11-04 13:16:29 +01:00
Jun Luo
d064aae3f9 feat(common & core & legacy): Stellar, add support for StellarPathPaymentStrictSendOp. 2021-11-04 13:16:29 +01:00
Jun Luo
1dcb8e4913 feat(common & core & legacy): Stellar, add support for StellarManageBuyOfferOp. 2021-11-04 13:16:29 +01:00
Jun Luo
3a5768c4bf refactor(common & core & legacy): Stellar, rename StellarManageOfferOp to StellarManageSellOfferOp and rename StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp. 2021-11-04 13:16:29 +01:00
Pavol Rusnak
0068c12f77
fix(python): use unified descriptor format <a;b> (#1885) 2021-11-04 10:36:53 +01:00
grdddj
73238135d6 feat(core/ethereum): EIP-712
Based on original contribution by Max Kupriianov <xlab@hey.com>

Implemented EIP-712 typed data signatures in Ethereum app.

Add eth_abi into pyproject deps

device test for EIP 712

fixed hex decoding for address

fixup! fixed hex decoding for address

code quality, more pythonic code, removing unused imports

running black and isort on changed files

trezorctl file input for EIP 712 data signing

fixup! code quality, more pythonic code, removing unused imports

fixup! fixup! code quality, more pythonic code, removing unused imports

necessary changes after rebase to master

unit tests for sign_typed_data.py

new protobuf messages, working for nonarray types

simplified and verified solution for our simple data

support for simple arrays, without their confirmation

reverting protobuf value messages to bytes, appropriate changes

showing arrays in Trezor, code quality improvements

data validation on Trezor, minor improvements

using custom types for storing type data instead of dicts, addressing feedback from review

moving helper functions to its own file, tests for decode_data

additional overall tests

support for arrays of structs

adding support for metamask_v4_compat variable

using HashWriter object to collect the final hash continously

minor improvements in code quality

validate_field_type function

streaming values from client without saving them, missing UI

prototype of streamed UI using confirm_properties

accounting for bytes in data, more data types in integration tests

rebase on master, using f-strings

minor fixes and improvements from code review

StructHasher class for the whole hashing process

mypy and style changes

asking users whether to show structs and arrays

protobuf descriptions to fix make defs_check

unifying comments, mypy fix

unit tests for StructHasher class

UI fixtures, skipping device tests for T1

addressing majority of code review comments about code quality and structure

changing file structure - layouts, helpers, sign_typed_data

decode_data renaming and docstring, renaming unit test file

using tuples instead of lists in elifs

layout improvements

excluding core/src/apps/common/confirm.py file from the PR

True/False returning layout with Show more button

code review layout improvements

forgotten br_type argument to should_show_more
2021-11-02 14:27:01 +01:00
Eduard Klementiev
10ce81b5d1 fix(python/trezorctl): fix operator precedence issue for ethereum sign-tx command 2021-10-25 15:51:21 +02:00
Andrew Kozlik
13cbb59082 feat(common): Add script_pubkey field to TxInput message. 2021-10-18 19:58:56 +02:00
Pavol Rusnak
ba0879961c feat(python): add support for Taproot descriptors 2021-10-18 13:36:05 +02:00
Pavol Rusnak
4ed9f00c73 feat(common): add support for Taproot input and output scripts 2021-10-18 13:36:05 +02:00
amadejpapez
85ba7c12ba style(all): use f-strings for formatting
[no changelog]
2021-10-13 11:53:17 +02:00
gabrielkerekes
1f33ab420d feat(cardano): update transaction signing for multisig 2021-10-11 15:16:24 +02:00
gabrielkerekes
21281d7cf4 feat(cardano): add support for script addresses derivation 2021-10-11 15:16:24 +02:00
gabrielkerekes
dd9652cd07 feat(cardano): add get-native-script-hash call 2021-10-11 15:16:24 +02:00
matejcik
e2ec761898 fix(python/stellar): use boolean value for is_authorized
[no changelog]
2021-09-24 10:30:19 +02:00
matejcik
399ee51be6 refactor(python/stellar): avoid warning when constructing StellarSignTx
[no changelog], covered in Stellar refactor changelog entries
2021-09-24 10:30:19 +02:00
matejcik
1dcfdebf7a feat(all): make Stellar timebounds required 2021-09-24 10:30:19 +02:00
matejcik
0a0b75378d feat(python/stellar): update for stellar protobuf changes
[no changelog]
2021-09-24 10:30:19 +02:00
matejcik
1b601b3e08 feat(common): strong typing for Stellar protobuf messages
BREAKING CHANGE: StellarAssetType is renamed to StellarAsset.
The name StellarAssetType is reused for the corresponding enum.

Enums are introduced in several other places. Their values correspond to
allowed values of (previously int) fields so this should not pose a
compatibility problem.

Many fields are now required. We believe that this should not pose a
compatibility problem, because all known interfaces to Stellar signing
actually accept Stellar XDR on input, whose required fields match the
protobuf schema.
2021-09-24 10:30:19 +02:00
matejcik
30b08d949b feat(common): add default values to EthereumSignTx fields
so that we can avoid Optional types for fields
2021-09-10 15:09:03 +02:00
matejcik
639406b01f feat(all): make chain_id mandatory 2021-09-10 15:09:03 +02:00
arbitrarylink
f051225730 feat(core,legacy): add support for Ethereum 64-bit chain_id
* Changes from original PR

* Now that we are rejecting chain_ids of 0, we need to have the tests set the chain_ids to at least 1.

* Ran 'make gen' and uploaded changed files.

* Ran make style_check and fixed reported errors

* Added changelog files

* Reverted changes concerning chain_id 0 being rejected.

* Adds tests for MAX_CHAIN_ID and MAX_CHAIN_ID+1.  Also reverts MAX_CHAIN_ID to the previous value.

* Added missing whitespace around arithmetic operator.

Co-authored-by: Michael Hatton <michaelhatton@Michaels-Mini.fios-router.home>
2021-09-10 15:09:03 +02:00
matejcik
f083beb3c2 fix(python/trezorctl): fix "invalid value" of ChoiceType with default
[no changelog] as the changelog entry is explicitly added to previous
version
2021-09-07 13:37:23 +02:00
gabrielkerekes
b0c8590f00 feat(cardano): streamed transaction signing 2021-08-20 11:50:13 +02:00
gabrielkerekes
d2a5be4e38 feat(cardano): prepare protobuf messages for streamed tx signing 2021-08-20 11:50:13 +02:00
matejcik
ee068b01ea chore(python): remove Lisk 2021-08-19 10:25:41 +02:00
Jun Luo
1adc869626 fix(python/stellar): correct the data type passed to StellarAllowTrustOp.is_authorized.
[no changelog]
2021-08-11 14:15:27 +02:00
Frederik Bolding
38fa9197ca feat(core,python): support for Ethereum EIP1559 transactions
Initial EIP1559 implementation

Fix a few small issues

Progress on Python lib implementation and firmware

Fix RLP length

Start fixing tests

Fix legacy transactions

Simplify API and logic

Add EIP1559 tests

Fix access list formatting

Fix UI visiblity issue

Fix commented out code

fix: correct linting issues

Fix access_list protobuf formatting

Remove unneeded code

Remove dead code

Check tx_type bounds for EIP 2718

Reduce code duplication

Prefer eip2718_type over re-using tx_type

Add more tests

Simplify format_access_list

Simplify sign_tx slightly

Change Access List format and add logic to encode it

Fix a bunch of small PR comments

Fix a linting issue

Move tests out of class and regenerate

Remove copy-pasted comments

Add access list to CLI

Simplify _parse_access_list_item

Fix small mistakes following rebase

Fix linting

Refactor to use a separate message for EIP 1559 tx

Simplify changed legacy code

Fix a few small PR comments

Fix linting

fix(legacy): recognize SignTxEIP1559 on legacy build

Fix PR comments
2021-08-10 11:00:29 +02:00
overcat
5cf873a03a feat(python/stellar): print a readable message when the user has not submitted a base64-encoded transaction envelope. 2021-08-06 13:14:57 +02:00
Jun Luo
543b9f407c refactor(python/stellar): Use Stellar Python SDK to parse Stellar transactions.
As a side effect, support for TransactionV1 format transaction is added.
2021-08-06 13:14:57 +02:00
gabrielkerekes
4f7c6b3586 feat(common): change all protobuf message type hints to strings
In order to support recursive protobuf messages, which will be needed by Cardano's native scripts.
[no changelog]
2021-08-05 12:10:30 +02:00
matejcik
9ab1891b22 feat(common): more required fields in messages-management
[no changelog]
2021-08-04 15:03:11 +02:00
matejcik
0e650b1a5b fix(python): do not set socket to nonblocking for wait_until_ready
There's two udp calls in `UdpTransport._ping()`:
- socket.sendall(b"PINGPING") -> this will be instanteous, AND it will
raise if the receiving side is not listening.
- socket.recv() -> this will wait for SOCKET_TIMEOUT seconds, but only
in case the sendall() succeeded. This means that receiving side exists
and we are now waiting until it's awake enough to respond.

In conclusion, we avoid hammering emulator with PINGPINGs with a timeout
so short we don't see an answer. This should avoid the problem
occasionally seen in CI and described in #1668
2021-08-04 10:58:59 +02:00
matejcik
34047cf3ec Revert "feat(python): give the emulator a little more time to respond to ping"
This reverts commit ae0da5e245.

It seems that there was no good reason for the change in the first
place.
2021-08-04 10:58:59 +02:00
matejcik
92e9d61e24 feat(python/debuglink): reset_debug_features to reconfigure debuglink 2021-08-04 10:58:59 +02:00
matejcik
b3312d1ef7 fix(tests): set_filter must be used in with-block
This makes sure filters are properly cleared when the with-block exits
2021-08-04 10:58:59 +02:00
matejcik
e7c40c9560 feat(python/trezorctl): trezorctl device reboot-to-bootloader 2021-07-29 15:32:42 +02:00
grdddj
13b8a6e54d fix(python/trezorctl): firmware download does not require connected trezor 2021-07-20 11:03:57 +02:00
matejcik
f8bb90366a fix(tests): auto-swipe by using only ButtonRequest.pages 2021-07-09 21:01:07 +02:00
matejcik
1e1963f1ee fix(core): do not send ButtonRequest on every paging event
partial revert of 54db2291f2 from #1671
2021-07-09 15:00:29 +02:00
grdddj
6bbc9a78f3 feat(python/trezorctl): improving and refactoring firmware CLI commands 2021-07-07 10:33:03 +02:00
matejcik
d047c98cb2 feat(python/debuglink): auto-page on pageable screens 2021-06-22 11:25:12 +02:00
matejcik
4f0aca7bb5 feat(python): pass whole ButtonRequest to button_request UI handler 2021-06-22 11:25:12 +02:00
matejcik
ea2a9375ac feat(python/debuglink): streamline expected responses handling [no changelog] 2021-06-22 11:25:12 +02:00
matejcik
1012ee8497 feat(core): send ButtonRequests for paging events 2021-06-22 11:25:12 +02:00
gabrielkerekes
a92b5fc333 fix(core/cardano): forbid tx outputs with both address and address parameters 2021-06-08 15:02:24 +02:00
matejcik
a58823cc0c refactor(python): rework trezorlib protobuf codec
API-compatibility with the original one is retained.

Now that we don't need to keep code parity with core, we could do some
changes that make life easier.

All generated classes are now in one file. This makes github diffs more
readable, at the cost of somewhat complicating inspecting individual
classes; however, that is something we shouldn't be doing anyway.

Enums are now implemented as enum.IntEnum.

The original class-level FIELDS member was restored.

Each field is now defined via protobuf.Field, which is easier to work
with in the codec, AND we're not stuffing defaults and flags into the
same field.
2021-06-08 09:55:19 +02:00
matejcik
aaa3ce6117 fix(core/bitcoin): fix CoinJoin authorization with new cache 2021-05-06 13:14:21 +02:00
matejcik
ae0da5e245 feat(python): give the emulator a little more time to respond to ping 2021-05-06 13:14:21 +02:00
gabrielkerekes
bf3e64ff20 fix(common): add isort:skip_file to files generated by pb2py 2021-04-23 11:09:29 +02:00
gabrielkerekes
a3d0016a2f refactor(trezorlib/cardano): rename create_* functions
To avoid ambiguity between creating messages from parameters and parsing them from JSON.
2021-04-23 11:09:29 +02:00
gabrielkerekes
2313293477 feat(core/cardano): add support for catalyst voting registration 2021-04-23 11:09:29 +02:00
gabrielkerekes
2c503b16f5 fix(common): fix one value enums in pb2py 2021-04-23 11:09:29 +02:00
Pavol Rusnak
65cefbc879
docs: remove wallet.trezor.io references 2021-04-16 16:18:48 +02:00
Martin Milata
0278998f72 style(common): mypy: disable implicit Optional for function arguments 2021-04-01 11:12:30 +02:00
Rafael Korbas
a9b8b0e119 feat(core/cardano): chunked serialization of signed transaction 2021-03-26 11:15:19 +01:00
mcudev
23abf7aff0 python/trezorctl: make bitcoin regtest a supported coin for trezorctl btc get-descriptor 2021-03-25 15:52:34 +01:00
Andrew Kozlik
885b6f7214 feat(python): Support 50 digit PIN and wipe code in trezorctl. 2021-03-25 14:24:41 +01:00
matejcik
cb7152542d feat: drop DebugLinkShowText functionality 2021-03-18 10:59:51 +01:00
JoeGruff
e3ea32a986 multi: Add decred staking.
Add two new input and four output script types.

Decred ticket purchases consist of a stake submission, op returns, and
change addresses. Although change addresses are allowed by consensus,
they are no longer used in practice and so have been given the
restrictions of a null pubkey and no value. Stake scripts are almost
identical to p2pkh or p2sh except for an extra opcode in front. Inputs
are currently only used in the form of one input three outputs with the
first output, or stake submission, paying to a public key hash, or with
two inputs and five outputs with the stake submission paying to a
multisig script hash. The op returns are directed to the user in the
case of one and the voting service provider and user in the case of two.

One of the sstx commitment for a ticket must pay back to the trezor
wallet. This is checked and an error is thrown if we don't find the
expected public key hash.

Because this adds the ability to create new types of outputs once the
ticket votes, two new input script types are also needed. A successful
vote will lead to a stake generation script that must be spent, and an
unsuccessful vote will lead to a revocation script that must be spent.
If we allowed stake change scripts to have a valid pubkey, that too
would require another op code, but we disallow those for output.
2021-03-17 12:16:08 +01:00
Roman Zeyde
b2877afa7f feat(common): add public_key to ECDHSessionKey 2021-03-08 15:59:00 +01:00
Pavol Rusnak
4b0f41d41e
fix(common): change msg_id of RebootToBootloader from 804 to 87 2021-03-03 12:07:00 +01:00
Ondrej Mikle
77e99078c3
chore(trezorlib): add generated message files 2021-03-03 12:07:00 +01:00
Ondrej Mikle
1579c62332
chore(legacy): reboot to bootloader protobuf generated messages 2021-03-03 12:06:59 +01:00
Pavol Rusnak
10edcb0d3a
doc(python): change wording from beta wallet to beta channel
[skip_ci]
2021-03-02 10:39:20 +01:00
Martin Milata
192d0dcf87 feat(core): hold homescreen to lock 2021-02-24 00:10:10 +01:00
Martin Milata
db2db8e6f3 feat(common): add hold_ms to DebugLinkDecision 2021-02-24 00:10:10 +01:00
Pavol Rusnak
f780cbdb17
feat(python): add possibility to enter PIN via letters (#1496) 2021-02-23 10:39:26 +01:00
matejcik
14037d0c31 chore: regenerate protobuf classes 2021-02-10 10:56:52 +01:00
Pavol Rusnak
48d1a7a880
fix(python): append checksum to descriptors (#1445) 2021-02-05 17:46:02 +01:00
Pavol Rusnak
81ae1d0ec0
fix(python): remove extraneous empty line from descriptors output
[skip_ci]
2021-02-03 14:58:30 +01:00
Rafael Korbas
e4c406822c Add multiasset sending and min validity to Cardano transactions 2021-01-27 18:26:40 +01:00
Rafael Korbas
44c7d23741 Cardano: map account paths to account numbers 2021-01-22 14:45:29 +01:00
Pavol Rusnak
345ef52949 feat(proto): add amount_unit to AuthorizeCoinJoin and SignTx 2021-01-22 14:07:36 +01:00
Pavol Rusnak
6689b9c22f common/protob: add GetAddress.ignore_xpub_magic field 2021-01-21 23:46:29 +01:00
Pavol Rusnak
88889472eb feat(python): add btc get-descriptor command 2021-01-08 14:17:09 +01:00
Pavol Rusnak
edb1243f64 feat(proto): add descriptors related fields to GetPublicKey/PublicKey 2021-01-08 14:17:09 +01:00
matejcik
5feb76f603 fix(python): do not log "resumed session" if there is no id 2020-12-11 11:44:01 +01:00
matejcik
4d4d0e7216 fix(python): do not call EndSession in bootloader mode (fixes #1379) 2020-12-11 11:41:15 +01:00
Pavol Rusnak
1187e4ddaf style(common): use new syntax for typing in autogenerated protobuf enums 2020-12-01 15:52:29 +01:00
Pavol Rusnak
cd829a99de style(python/src): use new syntax for typing 2020-12-01 15:52:29 +01:00
Martin Milata
8fd12f4373 fix(tests): run test_softlock_instability on emulator only 2020-12-01 12:35:11 +01:00
Rafael Korbas
b311bd4d4a Add displaying of TTL to cardano transaction, align url validation with Ledger 2020-11-20 15:58:50 +01:00
Rafael Korbas
b261f789f3 Add support for stakepool registration to Cardano 2020-11-20 15:58:50 +01:00
Pavol Rusnak
225cd15732 fix(python): drop references to beta-wallet.trezor.io 2020-11-16 09:45:42 +01:00
matejcik
5005a61eaf fix(python): update trezorctl multisig feature to new API 2020-10-30 10:25:51 +01:00
matejcik
a36ccd7e6f feat!(python): drop Mapping protocol support from MessageType 2020-10-30 10:25:51 +01:00
matejcik
8c460dcbf3 feat(python): improve error message when prev_txes are not provided 2020-10-30 10:25:51 +01:00
matejcik
3d6d1a56ac feat(python): implement API compatibility with trezorlib 0.12 2020-10-30 10:25:51 +01:00
Andrew Kozlik
9e5d5bd5f9 feat: Add support for experimental field flag in protobuf. 2020-10-23 15:07:15 +02:00
Andrew Kozlik
b636e959f5 chore(python): Support TXORIGINPUT and TXORIGOUTPUT in trezorlib. 2020-10-23 15:07:15 +02:00
Andrew Kozlik
ad6a0bc2a2 chore(common): Add new request types TXORIGINPUT and TXORIGOUTPUT. 2020-10-23 15:07:15 +02:00
Andrew Kozlik
443e0c101e chore(common): Add orig_hash and orig_index fields to TxInput and TxOutput. 2020-10-23 15:07:15 +02:00
Martin Milata
0376670404 feat(common): expose 'unstable' option in generated code 2020-10-16 13:53:31 +02:00
Martin Milata
3b138b4f98 feat(python): add experimental_features setting 2020-10-16 13:53:31 +02:00
Martin Milata
314cd260eb feat(common): add experimental_features setting 2020-10-16 13:53:31 +02:00
Martin Milata
b2c4bbdaa2 feat(common): add auto_lock_delay and display_rotation to Features 2020-10-02 11:06:16 +02:00
matejcik
e4785d47e0 style: apply black 20.8b1 2020-09-29 11:30:40 +02:00
matejcik
6dda240f5c test(python): add flake8-requirements 2020-09-29 11:30:40 +02:00
matejcik
0eed360037 chore: make tx type names shorter
as suggested by @andrewkozlik:
TxAckInputType -> TxInput
TxAckOutputType -> TxOutput
TxAckPrevTxType -> PrevTx
TxAckPrevInputType -> PrevInput
TxAckPrevOutputType -> PrevOutput
2020-09-23 16:00:10 +02:00
matejcik
01b66a5858 fix(python): always fill TransactionType.lock_time 2020-09-23 16:00:10 +02:00
matejcik
9ee7eee1eb chore!(python): bump trezorlib version because of breaking API change 2020-09-23 16:00:10 +02:00
matejcik
08d896f2f9 chore(tests): update to kwargs usage and new btc.sign_tx API 2020-09-23 16:00:10 +02:00
matejcik
b41021a5fb chore(python): fix kwargs usage 2020-09-23 16:00:10 +02:00
matejcik
5ddf1dfafb feat!(python): modify btc.sign_tx api to accept kwargs
Because we can't pass SignTx anymore because it has required fields and
the caller is not supposed to fill out those.

Instead you can send arbitrary kwargs that match signtx fields.

BREAKING CHANGE: argument `details: SignTx` is no longer accepted.
2020-09-23 16:00:10 +02:00
matejcik
ef4022fbf5 auto: regenerate protobuf classes 2020-09-23 16:00:10 +02:00
matejcik
90ee5f3d38 feat!: implement protobuf required fields and default values
BREAKING CHANGE: this makes arguments to protobuf constructors
keyword-only, and arguments corresponding to required fields are now
mandatory
2020-09-23 16:00:10 +02:00
Martin Milata
76a1760764 python: support SafetyChecks.PromptTemporarily 2020-09-18 09:02:40 +02:00
Martin Milata
7d37b2c90f common: add PromptTemporarily to SafetyChecks enum 2020-09-18 09:02:40 +02:00
Martin Milata
9f066e877d common: add SafetyCheckLevel to Features 2020-09-18 09:02:40 +02:00
Andrew Kozlik
5d745d5d04 common/protob: Add commitment_data to TxInputType. 2020-09-08 19:36:10 +02:00
matejcik
ffe3b5487d python: ignore failures of EndSession call, so that end_session() does not raise 2020-08-28 15:37:06 +02:00
matejcik
e0583dd5cb all: use a specific error code for "invalid session" 2020-08-28 15:37:06 +02:00
matejcik
e96a9e8d39 python/trezorctl: make use of EndSession 2020-08-28 15:37:06 +02:00
matejcik
4f92d2b14d python: call EndSession when requested 2020-08-28 15:37:06 +02:00
matejcik
17736e8fba python/trezorctl: fix output of 'btc get-address' help text 2020-08-27 15:19:53 +02:00
matejcik
d19f00b26c python/trezorctl: fix minor bugs in 'set homescreen' 2020-08-27 13:44:20 +02:00
matejcik
fb1deb6156 python/trezorctl: improve 'set homescreen' command 2020-08-25 13:17:21 +02:00
matejcik
a14634c389 python: make PIL optional in the toif module, add size check 2020-08-25 13:17:08 +02:00
matejcik
032a65e1cf python: export toif as public module 2020-08-25 11:30:33 +02:00
Martin Milata
43b7ccefc7 python/trezorctl: remove --skip-vendor-header from firmware-update 2020-08-25 11:16:04 +02:00
Martin Milata
29861e076b python: fix cli --file handling
It seems that Click doesn't do the right thing when argument and hidden
option with the same name exist, which was introduced in commit
2678e64a99.
2020-08-25 11:07:34 +02:00
Ferdinando M. Ametrano
b3d483dd6b
python: silenced unused variables (#1202) 2020-08-24 10:56:18 +02:00
Martin Milata
6319fcfe4a python: fix trezorctl lisk sign-message address parsing 2020-08-18 13:45:49 +02:00
Andrew Kozlik
9da715e025 python: Fix UnboundLocalError in trezorctl btc get-address. 2020-08-12 17:43:51 +02:00
Pavol Rusnak
5536fbb98a python: use stdlib blake2s on python 3.6+
commit 6d407c84d7 did not replace everything
2020-08-10 23:35:38 +02:00
matejcik
4029fc1e1c python: remove superfluous .keep file 2020-08-05 16:45:56 +02:00
matejcik
35c3af87dd python: rename unsafe_prompts to safety_checks 2020-08-05 16:45:56 +02:00
matejcik
769ccf52c6 python: fix behavior of client.ping() when device is locked 2020-08-05 16:45:56 +02:00
matejcik
efcaf7bda6 python/btc: improve missing signature detection 2020-08-05 16:45:56 +02:00
matejcik
037bef3a38 python: fix logging of protobuf repeated enums 2020-08-05 16:45:56 +02:00
matejcik
c244503e1f python/trezorctl: add aliases for firmware-update 2020-08-05 16:45:56 +02:00
matejcik
d5fe57012d python: bump version before release 2020-08-05 16:45:56 +02:00
matejcik
2678e64a99 python/trezorctl: improve file-based arguments 2020-08-05 16:45:56 +02:00
matejcik
e585d35f34 python: clarify session and feature management API
init_device() should be used to initialize a session. Reuses existing
session if available.

end_session() explicitly closes any existing session and requests a new
one

lock() enables soft-lock

clear_session() is the equivalent of lock() + end_session()

A new function ensure_unlocked() can be used to open a session and
prompt for PIN and passphrase before further operations.
2020-08-05 16:45:56 +02:00
matejcik
95f33a77c7 python/trezorctl: support multisig addresses in get-address 2020-08-05 16:45:56 +02:00
Andrew Kozlik
62d66a713c python: Add cancel_authorization() to trezorlib. 2020-08-04 17:32:44 +02:00
Andrew Kozlik
5c1f197602 common/protob: Add CancelAuthorization message. 2020-08-04 17:32:44 +02:00
Andrew Kozlik
85cf79169c python: Support preauthorized operations in trezorlib. 2020-08-04 17:32:44 +02:00
Andrew Kozlik
84c1324290 python: Add authorize_coinjoin() to trezorlib. 2020-08-04 17:32:44 +02:00
Andrew Kozlik
2c30dd62fc common: Add DoPreauthorized message. 2020-08-04 17:32:44 +02:00
Andrew Kozlik
bbab13f6e7 common/protob: Add AuthorizeCoinJoin message. 2020-08-04 17:32:44 +02:00
gabrielkerekes
a5d3b63912 Refactor trezorlib transaction key checking 2020-07-30 17:17:03 +02:00
gabrielkerekes
f2ee450410 Include metadata in transaction signing 2020-07-30 17:17:03 +02:00
gabrielkerekes
c29d297a77 Set default values to client functions parameters 2020-07-30 17:17:03 +02:00
gabrielkerekes
93b9f35678 Update trezorlib
Add certificates, withdrawals and metadata hash
2020-07-30 17:17:03 +02:00
gabrielkerekes
e92baf5b02 Update protobuf 2020-07-30 17:17:03 +02:00
gabrielkerekes
b5f3511c1c Add support for script addresses in tx outputs 2020-07-30 14:43:32 +02:00
matejcik
741fca0156 tests: watch_layout must be explicit (fixes #1142) 2020-07-29 11:50:47 +02:00
Pavol Rusnak
cec87bba50
core: remove mono bold font variant (not used anywhere) 2020-07-27 23:22:34 +02:00
Gabriel Kerekeš
d2c1624602 Cardano shelley update 2/3 (#1112) 2020-07-27 13:11:23 +02:00
gabrielkerekes
e1615e60ec Update Cardano to support Shelley era 1/3
Update protobuf

- Previous transactions don't need to be sent anymore, because fee is
  included in the transaction now. Thus transactions_count can be
  removed from CardanoSignTx message and the CardanoTxAck and
  CardanoTxRequest messages can be removed altogether.
- CardanoTxInputType.type is unused so remove it

Add NULL (None type) serialisation to CBOR

- Transaction metada must either have a valid structure or CBOR NULL
  must be used (if metadata is empty) - it can't be simply left out.

Add protocol_magics file

- Just to have a nicer way of representing protocol magics

Update transaction signing

- Previous transactions no longer need to be requested
- Output building is simplified, since fee doesn't need to be calculated
- Remove transaction class since it is no longer needed (only functions
  remained)
- Reorder functions so it reads top to bottom

Add protocol magic to byron address on testnet

- This has always been a part of the spec, but it hasn't been
  implemented before, because it wasn't really needed.

Update trezorlib

Update tests

- Transaction messages are no longer required
- Expected values are different since tx format changed
- Common values in test cases have been extracted

Remove unused file

- Progress was used when receiving previous transactions

Add CRC check to output address validation
2020-07-27 13:04:49 +02:00
matejcik
fdcb64ac24 all: rename protobuf unsafe_prompts to safety_checks 2020-07-24 16:37:58 +02:00
matejcik
1109250dcf core: add option to allow unsafe prompts 2020-07-24 16:37:58 +02:00
matejcik
c964ff702d python: disallow setting auto-lock without PIN 2020-07-10 14:05:52 +02:00
Andrew Kozlik
a973c3bc6e python: Add get_ownership_id() and get_ownership_proof() to trezorlib. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
533de50588 common/protob: Add GetOwnershipId message. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
6c523d09e0 tests/sign_tx: Don't expect signatures to be returned for external inputs. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
956ea9a94f common: Add ownership_proof field to TxInputType. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
c723c78529 common/protob: Add GetOwnershipProof message. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
cc655575c8 common: Add witness field to TxInputType. 2020-07-03 11:17:19 +02:00
Tomas Susanka
14a8da9c28 common: remove underscore from 'overwintered' field
Due to some Suite/Connect compatibility issues.
2020-07-01 13:56:32 +00:00
Tomas Susanka
ca3dd2bfb9 common: skip deprecated fields during generation; deprecate overwintered field in Zcash 2020-06-30 16:02:21 +02:00
matejcik
312d6ea822 python: fix padding in first chunk (fixes #1082) 2020-06-25 11:23:26 +02:00
Tomas Susanka
e534ae3ad7 legacy, core: rename Features.pin_cached to unlocked and unify 2020-06-19 21:26:36 +02:00
matejcik
6f53ca0ac6 core: rework wait_layout()
The original wait_layout was unreliable, because there are no guarantees
re order of arrival of the respective events. Still, TT's event handling
is basically deterministic, so as long as the host sent its messages
close enough to each other, the order worked out.

This is no longer the case with the introduction of loop.spawn: TT's
behavior is still deterministic, but now ButtonAck is processed *before*
the corresponding wait_layout, so the waiting side waits forever.

In the new process, the host must first register to receive layout
events, and then receives all of them (so the number of calls to
wait_layout must match the number of layout changes).

DebugLinkWatchLayout message must be version-gated, because of an
unfortunate collection of bugs in previous versions wrt unknown message
handling; and this interests us because upgrade-tests are using
wait_layout feature.
2020-06-04 16:18:46 +02:00
matejcik
5d823ff5ea core: use ButtonRequestType.PinEntry for PIN entry 2020-06-04 16:18:46 +02:00
matejcik
bbfce4e303 common: introduce ButtonRequestType.PinEntry 2020-06-04 16:18:46 +02:00
matejcik
fc6c99c6f9 tests: disable PIN detection, all PIN uses must be explicit 2020-06-04 16:18:46 +02:00
matejcik
b68cc5abda python/debuglink: implement use_pin_sequence support for trezor-core 2020-06-04 16:18:46 +02:00
matejcik
62ced317cd python/debuglink: proto -> messages 2020-06-04 16:18:46 +02:00
matejcik
ee32806bb2 python/debuglink: add debuglink message logging 2020-06-04 16:18:46 +02:00
matejcik
6069173252 python/debuglink: clean out debuglink methods 2020-06-04 16:18:46 +02:00
matejcik
0600d87c8c common: rename ClearSession to LockDevice, introduce EndSession 2020-06-04 16:18:46 +02:00
matejcik
83d3acb0a6 python: fix dead code in protobuf pretty-printing 2020-05-29 12:27:42 +02:00
Tomas Susanka
9dfc08ca61 core/bitcoin: drop decred_script_version 2020-05-21 19:14:39 +02:00
matejcik
29db769185 tests: update test vectors to use correct paths 2020-05-15 14:08:29 +02:00
matejcik
aeaa402b75 python: fix PASSPHRASE_TEST_PATH 2020-05-15 14:08:29 +02:00
Tomas Susanka
15e33b42c0 python: style 2020-05-05 07:05:53 +00:00
Serge
e900173b9c python/trezorctl: del an outdated mesage 2020-05-05 06:46:49 +02:00
Serge
4e25c396d2 python/trezorctl: display embedded v2 image fingerprint (fixes #977) 2020-05-05 06:46:49 +02:00
matejcik
59f43514be python: convert chunks to bytes when reading from hid 2020-05-04 10:16:15 +02:00
matejcik
7ebbccdbba python/debuglink: support conditional expected_responses 2020-04-25 18:27:29 +02:00
matejcik
5885978c83 Merge branch 'release/2020-04' 2020-04-15 15:00:23 +02:00
Dusan Klinec
25b6e9058f xmr: proto - add fields for protocol optimization 2020-04-13 22:19:56 +02:00
matejcik
1b50877545 tests: streamline TrezorFailure exception usage 2020-03-26 11:30:06 +01:00
matejcik
a40f1e00ed python: add period at end of sentence 2020-03-26 11:30:06 +01:00
matejcik
2402853b9c python: simplify outdated firmware warning (full message is still used in the exception) 2020-03-26 11:30:06 +01:00
matejcik
f52c087cb6 python/trezorctl: implement common client and exception handling (fixes #226) 2020-03-26 11:30:06 +01:00
matejcik
b440ca1ec5 python: drop deprecated name CallException 2020-03-26 11:30:06 +01:00
matejcik
7a85d93d94 python/debuglink: properly use session_counter for debuglink transport 2020-03-26 11:30:06 +01:00
matejcik
af05e0927f python/trezorctl: nicer output for list-devices 2020-03-26 11:30:06 +01:00
matejcik
b801f1a9cf python/trezorctl: help user find the right firmware version (fixes #823) 2020-03-26 11:30:06 +01:00
matejcik
2112da7ab5 python/trezorctl: send raw bytes to device (fixes #116) 2020-03-26 11:30:06 +01:00
matejcik
9a330f3475 python: unify protobuf-encoding code paths
Protobuf encoding now happens in TrezorClient, and transports get encoded blobs
to (chunkify and) send.  This is a better design because transports don't need
to know about protobuf.

It also lays groundwork for sending raw bytes feature (#116)

This commit also removes all vestiges of ProtocolV2 which was never used and
will probably need to be redesigned from the ground up anyway. The code is
still ready for protocol flexibility.
2020-03-26 11:30:06 +01:00
matejcik
9d29952a15 python: move out deprecated ckd_public 2020-03-26 11:30:06 +01:00
matejcik
5dfb01c25d python: drop old Electrum compatibility code 2020-03-26 11:30:06 +01:00
matejcik
6ccf22225c python: drop coins.json (fixes #752) 2020-03-26 11:30:06 +01:00
matejcik
325dae890e python: completely drop trezorlib.coins and trezorlib.tx_api 2020-03-26 11:30:06 +01:00
matejcik
5a526888cf python: move json_to_tx to btc.from_json, add test cases 2020-03-26 11:30:06 +01:00
matejcik
d2dd78f979 python: drop TxApi and coin specializations in json_to_tx 2020-03-26 11:30:06 +01:00
matejcik
208bac8653 common: drop capricoin blockbook servers 2020-03-26 11:30:06 +01:00
matejcik
ffdb299c61 all: drop Capricoin support [NO BACKPORT] 2020-03-20 14:19:30 +00:00
matejcik
e2035b4972 all: drop Horizen and BIP-115 support [NO BACKPORT] 2020-03-20 14:19:07 +00:00
matejcik
27803ee8c1 all: drop overwintered field from transaction 2020-03-20 14:18:27 +00:00
Pavol Rusnak
817b922850 all: add extra_data and timestamp fields to coin specification 2020-03-20 14:18:27 +00:00
Andrew Kozlik
e51ed5bf05 trezorlib: Regenerate coins.json. 2020-03-17 11:53:48 +01:00
Andrew Kozlik
ac78d1e2f3 trezorctl: Validate PIN digits and length. 2020-03-17 11:53:48 +01:00
Andrew Kozlik
2f905a1157 core/webauthn: Add algorithm and curve to WebAuthnListResidentCredentials response. 2020-03-12 15:45:26 +01:00
Michail Brynard
c2635a4773 python: fix encoding errors in Stellar 2020-03-02 16:01:15 +01:00
matejcik
b916072389 common: restore PassphraseAck.state 2020-02-24 15:15:09 +01:00
matejcik
5523c7bbef tests: add SD card format feature tests 2020-02-20 12:51:48 +01:00
matejcik
ddee77ecb6 core: add SD clearing via debuglink 2020-02-20 12:51:48 +01:00
Tomas Susanka
ff1bb67abc common: return the PasshraseType button request 2020-02-20 08:04:35 +00:00
matejcik
e61b7d28e9 all: do not send state in PassphraseAck (not needed for compatibility) 2020-02-13 15:44:50 +01:00
matejcik
3959600760 python/protobuf: do not warn for unknown enum values (fixes #832) 2020-02-13 15:37:14 +01:00
matejcik
cdb7a7eb68
Merge pull request #840 from trezor/matejcik/sys-exit
wipe code activation tests
2020-02-13 15:11:33 +01:00
matejcik
0ec628ccd4 legacy: fix CALLBACK checker 2020-02-12 17:18:51 +01:00
matejcik
1cc1382153 python/trezorctl: improve get-session 2020-02-12 17:18:50 +01:00
matejcik
81a03edf61 python/debuglink: add docstrings, rename functions for clearer usage 2020-02-12 15:38:18 +01:00