-
-
Notifications
You must be signed in to change notification settings - Fork 193
Conversation
* also added device tests for tezos Signed-off-by: Adrian Matejov <[email protected]>
trezorctl
Outdated
# | ||
@cli.command(help='Get Tezos address for specified path.') | ||
@click.option('-n', '--address', required=True, help="BIP-32 path, e.g. m/44'/1729'/0'/0'/0'") | ||
@click.option('-c', '--curve', default=0, type=click.IntRange(0, 2), help='Curve to use (0 = ed25519, 1 = secp256k1, 2 = p256)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use a ChoiceType
for curve, see Bitcoin's get_address
and CHOICE_INPUT_SCRIPT_TYPE
@pytest.mark.skip_t1 | ||
class TestMsgTezosSignTx(TrezorTest): | ||
|
||
def setup_method(self, method): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of this method, make a constant TEZOS_PATH = parse_path(...)
at top level and use it in tests
|
||
path = parse_path("m/44'/1729'/0'/0'/0'") | ||
|
||
address = get_address(self.client, path, 0, show_display=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use your CurveType
enums
trezorlib/tezos.py
Outdated
|
||
|
||
@field('address') | ||
@expect(messages.TezosAddress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you will need to update this to @expect(messages.TezosAddress, field="address")
trezorlib/tezos.py
Outdated
|
||
|
||
@expect(messages.TezosSignedTx) | ||
def sign_tx(client, msg: messages.TezosSignTx): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function should take address_n
as argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and probably curve
too, if that's a property of the derived address)
trezorlib/tezos.py
Outdated
return client.call(msg) | ||
|
||
|
||
def create_sign_tx_msg(address_n, curve, transaction) -> messages.TezosSignTx: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might be able to replace most of this function with protobuf.dict_to_proto
|
||
path = parse_path("m/44'/1729'/0'/0'/0'") | ||
|
||
pk = get_public_key(self.client, path, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use your CurveType
enums instead of constants like 0, 1, 2
I reviewed your code, please see and make changes where appropriate. General notes:
I also did a big change to master, so now you get merge conflicts. Resolution instructions are as follows:
You should also be able to leverage |
Signed-off-by: Adrian Matejov <[email protected]>
Signed-off-by: Adrian Matejov <[email protected]>
@matejcik Everything should be fixed |
trezorlib/tezos.py
Outdated
def sign_tx(client, address_n, curve, operations): | ||
operations["address_n"] = address_n | ||
operations["curve"] = curve | ||
msg = dict_to_proto(messages.TezosSignTx, operations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead:
def sign_tx(client, address_n, curve, transaction: messages.TezosSignTx):
transaction.address_n = address_n
transaction.curve = curve
return client.call(transaction)
trezorctl
Outdated
def tezos_sign_tx(connect, address, curve, file): | ||
client = connect() | ||
address_n = tools.parse_path(address) | ||
return tezos.sign_tx(client, address_n, curve, json.load(file)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not pass raw dicts to sign_tx
, instead move the dict_to_proto
call here.
|
||
import pytest | ||
|
||
from trezorlib import messages as proto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use messages
directly instead of messages as proto
thank you. Looks mostly good now, a couple minor points. I'll also wait for changes in the used paths (or not), as discussed on Gitter. |
Signed-off-by: Adrian Matejov <[email protected]>
@matejcik I will rework this to support only one curve |
Signed-off-by: Adrian Matejov <[email protected]>
Signed-off-by: Adrian Matejov <[email protected]>
Signed-off-by: Adrian Matejov <[email protected]>
@matejcik done.
|
Signed-off-by: Adrian Matejov <[email protected]>
Signed-off-by: Adrian Matejov <[email protected]>
Looks good. |
Signed-off-by: Adrian Matejov <[email protected]>
Added |
Thanks! |
Signed-off-by: Adrian Matejov [email protected]
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