diff --git a/trezorctl b/trezorctl index 2dbb324c6b..6e0a987364 100755 --- a/trezorctl +++ b/trezorctl @@ -1073,8 +1073,7 @@ def decrypt_keyvalue(connect, address, key, value): def ethereum_get_address(connect, address, show_display): client = connect() address_n = tools.parse_path(address) - address = ethereum.get_address(client, address_n, show_display) - return "0x%s" % address.hex() + return ethereum.get_address(client, address_n, show_display) @cli.command(help="Get Ethereum public node of given path.") diff --git a/trezorlib/tests/device_tests/test_msg_ethereum_getaddress.py b/trezorlib/tests/device_tests/test_msg_ethereum_getaddress.py index 07d2de6bd3..8f6ff2708f 100644 --- a/trezorlib/tests/device_tests/test_msg_ethereum_getaddress.py +++ b/trezorlib/tests/device_tests/test_msg_ethereum_getaddress.py @@ -27,26 +27,26 @@ class TestMsgEthereumGetaddress(TrezorTest): def test_ethereum_getaddress(self): self.setup_mnemonic_nopin_nopassphrase() assert ( - ethereum.get_address(self.client, [H_(44), H_(60)]).hex() - == "e025dfbe2c53638e547c6487ded34add7b8aafc1" + ethereum.get_address(self.client, [H_(44), H_(60)]) + == "0xE025dfbE2C53638E547C6487DED34Add7b8Aafc1" ) assert ( - ethereum.get_address(self.client, [H_(44), H_(60), 1]).hex() - == "ed46c856d0c79661cf7d40ffe0c0c5077c00e898" + ethereum.get_address(self.client, [H_(44), H_(60), 1]) + == "0xeD46C856D0c79661cF7d40FFE0C0C5077c00E898" ) assert ( - ethereum.get_address(self.client, [H_(44), H_(60), 0, H_(1)]).hex() - == "6682fa7f3ec58581b1e576268b5463b4b5c93839" + ethereum.get_address(self.client, [H_(44), H_(60), 0, H_(1)]) + == "0x6682Fa7F3eC58581b1e576268b5463B4b5c93839" ) assert ( - ethereum.get_address(self.client, [H_(44), H_(60), H_(9), 0]).hex() - == "fb3be0f9717ff5fcf3c58eb49a9ed67f1bd89d4e" + ethereum.get_address(self.client, [H_(44), H_(60), H_(9), 0]) + == "0xFb3BE0F9717fF5fCF3C58EB49a9Ed67F1BD89D4E" ) assert ( - ethereum.get_address(self.client, [H_(44), H_(60), 0, 9999999]).hex() - == "6b909b50d88c9a8e02453a87b3662e3e7a5e0cf1" + ethereum.get_address(self.client, [H_(44), H_(60), 0, 9999999]) + == "0x6b909b50d88c9A8E02453A87b3662E3e7a5E0CF1" ) assert ( - ethereum.get_address(self.client, [H_(44), H_(6060), 0, 9999999]).hex() - == "98b8e926bd224764de2a0e4f4cbe1521474050af" + ethereum.get_address(self.client, [H_(44), H_(6060), 0, 9999999]) + == "0x98b8e926bd224764De2A0E4f4CBe1521474050AF" ) diff --git a/trezorlib/tests/device_tests/test_msg_ethereum_signmessage.py b/trezorlib/tests/device_tests/test_msg_ethereum_signmessage.py index 0626706b33..5782c5eaab 100644 --- a/trezorlib/tests/device_tests/test_msg_ethereum_signmessage.py +++ b/trezorlib/tests/device_tests/test_msg_ethereum_signmessage.py @@ -26,7 +26,7 @@ from .common import TrezorTest class TestMsgEthereumSignmessage(TrezorTest): PATH = [H_(44), H_(60), H_(0), 0] - ADDRESS = "ea53af85525b1779ee99ece1a5560c0b78537c3b" + ADDRESS = "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b" VECTORS = [ ( "This is an example of a signed message.", @@ -42,5 +42,5 @@ class TestMsgEthereumSignmessage(TrezorTest): self.setup_mnemonic_nopin_nopassphrase() for msg, sig in self.VECTORS: res = ethereum.sign_message(self.client, self.PATH, msg) - assert res.address.hex() == self.ADDRESS + assert res.address == self.ADDRESS assert res.signature.hex() == sig diff --git a/trezorlib/tests/device_tests/test_msg_ethereum_signtx.py b/trezorlib/tests/device_tests/test_msg_ethereum_signtx.py index 91ede489a9..46451520ad 100644 --- a/trezorlib/tests/device_tests/test_msg_ethereum_signtx.py +++ b/trezorlib/tests/device_tests/test_msg_ethereum_signtx.py @@ -21,7 +21,7 @@ from trezorlib.tools import parse_path from .common import TrezorTest -TO_ADDR = bytes.fromhex("1d1c328764a41bda0492b66baa30c4a339ff85ef") +TO_ADDR = "0x1d1c328764a41bda0492b66baa30c4a339ff85ef" @pytest.mark.ethereum @@ -62,7 +62,7 @@ class TestMsgEthereumSigntx(TrezorTest): gas_price=20, gas_limit=20, # ADT token address - to=b"\xd0\xd6\xd6\xc5\xfe\x4a\x67\x7d\x34\x3c\xc4\x33\x53\x6b\xb7\x17\xba\xe1\x67\xdd", + to="0xd0d6d6c5fe4a677d343cc433536bb717bae167dd", chain_id=1, # value needs to be 0, token value is set in the contract (data) value=0, @@ -115,7 +115,7 @@ class TestMsgEthereumSigntx(TrezorTest): gas_price=20, gas_limit=20, # unknown token address (Grzegorz Brzęczyszczykiewicz Token) - to=b"\xfc\x6b\x5d\x6a\xf8\xa1\x32\x58\xf7\xcb\xd0\xd3\x9e\x11\xb3\x5e\x01\xa3\x2f\x93", + to="0xfc6b5d6af8a13258f7cbd0d39e11b35e01a32f93", chain_id=1, # value needs to be 0, token value is set in the contract (data) value=0, diff --git a/trezorlib/tests/device_tests/test_msg_ethereum_signtx_eip155.py b/trezorlib/tests/device_tests/test_msg_ethereum_signtx_eip155.py index 3e45f3da12..014d054afd 100644 --- a/trezorlib/tests/device_tests/test_msg_ethereum_signtx_eip155.py +++ b/trezorlib/tests/device_tests/test_msg_ethereum_signtx_eip155.py @@ -209,7 +209,7 @@ class TestMsgEthereumSigntxChainId(TrezorTest): nonce=n, gas_price=20000000000, gas_limit=gl, - to=bytes.fromhex("8ea7a3fccc211ed48b763b4164884ddbcf3b0a98"), + to="0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98", value=v, chain_id=ci, data=d, diff --git a/trezorlib/tests/device_tests/test_msg_ethereum_verifymessage.py b/trezorlib/tests/device_tests/test_msg_ethereum_verifymessage.py index 8a219a76fe..4c27bfa4e6 100644 --- a/trezorlib/tests/device_tests/test_msg_ethereum_verifymessage.py +++ b/trezorlib/tests/device_tests/test_msg_ethereum_verifymessage.py @@ -24,7 +24,7 @@ from .common import TrezorTest @pytest.mark.ethereum class TestMsgEthereumVerifymessage(TrezorTest): - ADDRESS = "cb3864960e8db1a751212c580af27ee8867d688f" + ADDRESS = "0xCb3864960e8DB1A751212c580AF27Ee8867d688F" VECTORS = [ ( "This is an example of a signed message.", @@ -40,7 +40,7 @@ class TestMsgEthereumVerifymessage(TrezorTest): self.setup_mnemonic_nopin_nopassphrase() for msg, sig in self.VECTORS: res = ethereum.verify_message( - self.client, bytes.fromhex(self.ADDRESS), bytes.fromhex(sig), msg + self.client, self.ADDRESS, bytes.fromhex(sig), msg ) assert res is True @@ -48,6 +48,6 @@ class TestMsgEthereumVerifymessage(TrezorTest): self.setup_mnemonic_nopin_nopassphrase() signature = bytes.fromhex(self.VECTORS[0][1]) res = ethereum.verify_message( - self.client, bytes.fromhex(self.ADDRESS), signature, "another message" + self.client, self.ADDRESS, signature, "another message" ) assert res is False diff --git a/vendor/trezor-common b/vendor/trezor-common index b947aa3d45..495b35e212 160000 --- a/vendor/trezor-common +++ b/vendor/trezor-common @@ -1 +1 @@ -Subproject commit b947aa3d45af58605f8f090078a2de3d5878571d +Subproject commit 495b35e212f48ea2ac9e356febd5a49c3ee5254b