From 0d5f00668fb3d1c093ff3c879311a91d3a7175c8 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Tue, 1 Sep 2020 15:56:57 +0200 Subject: [PATCH] core: remove ownership messages from the public api for now --- core/src/apps/bitcoin/__init__.py | 3 - .../test_msg_authorize_coinjoin.py | 533 ------------------ .../test_msg_getownershipproof.py | 96 ---- tests/ui_tests/fixtures.json | 11 +- 4 files changed, 2 insertions(+), 641 deletions(-) delete mode 100644 tests/device_tests/test_msg_authorize_coinjoin.py delete mode 100644 tests/device_tests/test_msg_getownershipproof.py diff --git a/core/src/apps/bitcoin/__init__.py b/core/src/apps/bitcoin/__init__.py index b55370252..5377055ad 100644 --- a/core/src/apps/bitcoin/__init__.py +++ b/core/src/apps/bitcoin/__init__.py @@ -3,11 +3,8 @@ from trezor.messages import MessageType def boot() -> None: - wire.add(MessageType.AuthorizeCoinJoin, __name__, "authorize_coinjoin") wire.add(MessageType.GetPublicKey, __name__, "get_public_key") wire.add(MessageType.GetAddress, __name__, "get_address") - wire.add(MessageType.GetOwnershipId, __name__, "get_ownership_id") - wire.add(MessageType.GetOwnershipProof, __name__, "get_ownership_proof") wire.add(MessageType.SignTx, __name__, "sign_tx") wire.add(MessageType.SignMessage, __name__, "sign_message") wire.add(MessageType.VerifyMessage, __name__, "verify_message") diff --git a/tests/device_tests/test_msg_authorize_coinjoin.py b/tests/device_tests/test_msg_authorize_coinjoin.py deleted file mode 100644 index 8ceb71909..000000000 --- a/tests/device_tests/test_msg_authorize_coinjoin.py +++ /dev/null @@ -1,533 +0,0 @@ -# This file is part of the Trezor project. -# -# Copyright (C) 2020 SatoshiLabs and contributors -# -# This library is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the License along with this library. -# If not, see . - -import pytest - -from trezorlib import btc, device, messages -from trezorlib.exceptions import TrezorFailure -from trezorlib.tools import parse_path - -from ..tx_cache import TxCache -from .signtx import request_finished, request_input, request_meta, request_output - -B = messages.ButtonRequestType - -TX_CACHE_TESTNET = TxCache("Testnet") -TX_CACHE_MAINNET = TxCache("Bitcoin") - -TXHASH_e5b7e2 = bytes.fromhex( - "e5b7e21b5ba720e81efd6bfa9f854ababdcddc75a43bfa60bf0fe069cfd1bb8a" -) -TXHASH_65b811 = bytes.fromhex( - "65b811d3eca0fe6915d9f2d77c86c5a7f19bf66b1b1253c2c51cb4ae5f0c017b" -) - -PIN = "1234" -ROUND_ID_LEN = 32 - -pytestmark = pytest.mark.skip_t1 - - -@pytest.mark.setup_client(pin=PIN) -def test_sign_tx(client): - with client: - client.use_pin_sequence([PIN]) - btc.authorize_coinjoin( - client, - coordinator="www.example.com", - max_total_fee=10010, - fee_per_anonymity=5000000, # 0.005 % - n=parse_path("m/84'/1'/0'"), - coin_name="Testnet", - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - client.call(messages.LockDevice()) - - with client: - client.set_expected_responses( - [messages.PreauthorizedRequest(), messages.OwnershipProof()] - ) - btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - with client: - client.set_expected_responses( - [messages.PreauthorizedRequest(), messages.OwnershipProof()] - ) - btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/5"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - inp1 = messages.TxInputType( - # seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle" - # 84'/1'/0'/0/0 - # tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2 - amount=100000, - prev_hash=TXHASH_e5b7e2, - prev_index=0, - script_type=messages.InputScriptType.EXTERNAL, - ownership_proof=bytearray.fromhex( - "534c001900016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c40002483045022100d4ad0374c922848c71d913fba59c81b9075e0d33e884d953f0c4b4806b8ffd0c022024740e6717a2b6a5aa03148c3a28b02c713b4e30fc8aeae67fa69eb20e8ddcd9012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d" - ), - ) - inp2 = messages.TxInputType( - address_n=parse_path("84'/1'/0'/1/0"), - amount=7289000, - prev_hash=TXHASH_65b811, - prev_index=1, - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - # Other's coinjoined output. - out1 = messages.TxOutputType( - address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml", - amount=50000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Our coinjoined output. - out2 = messages.TxOutputType( - address_n=parse_path("84'/1'/0'/1/1"), - amount=50000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Our change output. - out3 = messages.TxOutputType( - address_n=parse_path("84'/1'/0'/1/2"), - amount=7289000 - 50000 - 5 - 5000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Other's change output. - out4 = messages.TxOutputType( - address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk", - amount=100000 - 50000 - 5 - 5000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Coordinator's output. - out5 = messages.TxOutputType( - address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q", - amount=10, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - - with client: - client.set_expected_responses( - [ - messages.PreauthorizedRequest(), - request_input(0), - request_input(1), - request_meta(TXHASH_65b811), - request_input(0, TXHASH_65b811), - request_output(0, TXHASH_65b811), - request_output(1, TXHASH_65b811), - request_output(0), - request_output(1), - request_output(2), - request_output(3), - request_output(4), - request_input(0), - request_meta(TXHASH_e5b7e2), - request_input(0, TXHASH_e5b7e2), - request_output(0, TXHASH_e5b7e2), - request_output(1, TXHASH_e5b7e2), - request_input(0), - request_input(1), - request_output(0), - request_output(1), - request_output(2), - request_output(3), - request_output(4), - request_input(1), - request_finished(), - ] - ) - _, serialized_tx = btc.sign_tx( - client, - "Testnet", - [inp1, inp2], - [out1, out2, out3, out4, out5], - prev_txes=TX_CACHE_TESTNET, - preauthorized=True, - ) - - assert ( - serialized_tx.hex() - == "010000000001028abbd1cf69e00fbf60fa3ba475dccdbdba4a859ffa6bfd1ee820a75b1be2b7e50000000000ffffffff7b010c5faeb41cc5c253121b6bf69bf1a7c5867cd7f2d91569fea0ecd311b8650100000000ffffffff0550c3000000000000160014b7a51ede0a66ae36558a3ab097ad86bbd800786150c3000000000000160014167dae080bca35c9ea49c0c8335dcc4b252a1d70cb616e00000000001600141d03a4d2167961b853d6cadfeab08e4937c5dfe8c3af0000000000001600142e01768ca46e57210f0bd2c99e630e8168fa5fe50a000000000000001976a914a579388225827d9f2fe9014add644487808c695d88ac00024730440220694105071db8c6c8ba3d385d01694b6f7c17546327ab26d4c53a6503fee301e202202dd310c23a195a6cebc904b91ebd15d782e6dacd08670a72ade2795e7d3ff4ec012103505647c017ff2156eb6da20fae72173d3b681a1d0a629f95f49e884db300689f00000000" - ) - - # Test for a second time. - btc.sign_tx( - client, - "Testnet", - [inp1, inp2], - [out1, out2, out3, out4, out5], - prev_txes=TX_CACHE_TESTNET, - preauthorized=True, - ) - - # Test for a third time, fees should exceed max_total_fee. - with pytest.raises(TrezorFailure, match="Fees exceed authorized limit"): - btc.sign_tx( - client, - "Testnet", - [inp1, inp2], - [out1, out2, out3, out4, out5], - prev_txes=TX_CACHE_TESTNET, - preauthorized=True, - ) - - -def test_unfair_fee(client): - # Test unfair mining fee distribution amongst participants. - - with client: - btc.authorize_coinjoin( - client, - coordinator="www.example.com", - max_total_fee=10000, - fee_per_anonymity=5000000, # 0.005 % - n=parse_path("m/84'/1'/0'"), - coin_name="Testnet", - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - inp1 = messages.TxInputType( - # seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle" - # 84'/1'/0'/0/0 - # tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2 - amount=100000, - prev_hash=TXHASH_e5b7e2, - prev_index=0, - script_type=messages.InputScriptType.EXTERNAL, - ownership_proof=bytearray.fromhex( - "534c001900016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c40002483045022100d4ad0374c922848c71d913fba59c81b9075e0d33e884d953f0c4b4806b8ffd0c022024740e6717a2b6a5aa03148c3a28b02c713b4e30fc8aeae67fa69eb20e8ddcd9012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d" - ), - ) - inp2 = messages.TxInputType( - address_n=parse_path("84'/1'/0'/1/0"), - amount=7289000, - prev_hash=TXHASH_65b811, - prev_index=1, - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - # Other's coinjoined output. - out1 = messages.TxOutputType( - address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml", - amount=50000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Our coinjoined output. - out2 = messages.TxOutputType( - address_n=parse_path("84'/1'/0'/1/1"), - amount=50000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Our change output. - out3 = messages.TxOutputType( - address_n=parse_path("84'/1'/0'/1/2"), - amount=7289000 - 50000 - 5 - 6000, # unfair mining fee - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Other's change output. - out4 = messages.TxOutputType( - address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk", - amount=100000 - 50000 - 5 - 4000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Coordinator's output. - out5 = messages.TxOutputType( - address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q", - amount=10, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - - with pytest.raises(TrezorFailure, match="fee over threshold"): - btc.sign_tx( - client, - "Testnet", - [inp1, inp2], - [out1, out2, out3, out4, out5], - prev_txes=TX_CACHE_TESTNET, - preauthorized=True, - ) - - -def test_no_anonymity(client): - # Test CoinJoin transaction giving the user's outputs no gain in anonymity. - - with client: - btc.authorize_coinjoin( - client, - coordinator="www.example.com", - max_total_fee=5005, - fee_per_anonymity=5000000, # 0.005 % - n=parse_path("m/84'/1'/0'"), - coin_name="Testnet", - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - inp1 = messages.TxInputType( - # seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle" - # 84'/1'/0'/0/0 - # tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2 - amount=100000, - prev_hash=TXHASH_e5b7e2, - prev_index=0, - script_type=messages.InputScriptType.EXTERNAL, - ownership_proof=bytearray.fromhex( - "534c001900016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c40002483045022100d4ad0374c922848c71d913fba59c81b9075e0d33e884d953f0c4b4806b8ffd0c022024740e6717a2b6a5aa03148c3a28b02c713b4e30fc8aeae67fa69eb20e8ddcd9012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d" - ), - ) - inp2 = messages.TxInputType( - address_n=parse_path("84'/1'/0'/1/0"), - amount=7289000, - prev_hash=TXHASH_65b811, - prev_index=1, - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - # Other's coinjoined output. - out1 = messages.TxOutputType( - address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml", - amount=30000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Other's coinjoined output. - out2 = messages.TxOutputType( - address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk", - amount=30000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Our coinjoined output. - out3 = messages.TxOutputType( - address_n=parse_path("84'/1'/0'/1/1"), - amount=50000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Our coinjoined output. - out4 = messages.TxOutputType( - address_n=parse_path("84'/1'/0'/1/2"), - amount=50000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Our change output. - out5 = messages.TxOutputType( - address_n=parse_path("84'/1'/0'/1/2"), - amount=7289000 - 50000 - 50000 - 10 - 5000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Other's change output. - out6 = messages.TxOutputType( - address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk", - amount=100000 - 30000 - 30000 - 6 - 5000, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - # Coordinator's output. - out7 = messages.TxOutputType( - address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q", - amount=16, - script_type=messages.OutputScriptType.PAYTOWITNESS, - ) - - with pytest.raises(TrezorFailure, match="No anonymity gain"): - btc.sign_tx( - client, - "Testnet", - [inp1, inp2], - [out1, out2, out3, out4, out5, out6, out7], - prev_txes=TX_CACHE_TESTNET, - preauthorized=True, - ) - - -def test_wrong_coordinator(client): - # Ensure that a preauthorized GetOwnershipProof fails if the commitment_data doesn't match the coordinator. - - btc.authorize_coinjoin( - client, - max_total_fee=50000, - coordinator="www.example.com", - n=parse_path("m/84'/1'/0'"), - coin_name="Testnet", - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - with pytest.raises(TrezorFailure, match="Unauthorized operation"): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example.org" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - -def test_cancel_authorization(client): - # Ensure that a preauthorized GetOwnershipProof fails if the commitment_data doesn't match the coordinator. - - btc.authorize_coinjoin( - client, - max_total_fee=50000, - coordinator="www.example.com", - n=parse_path("m/84'/1'/0'"), - coin_name="Testnet", - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - device.cancel_authorization(client) - - with pytest.raises(TrezorFailure, match="No preauthorized operation"): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - -@pytest.mark.skip_ui -def test_multisession_authorization(client): - # Authorize CoinJoin with www.example1.com in session 1. - btc.authorize_coinjoin( - client, - max_total_fee=50000, - coordinator="www.example1.com", - n=parse_path("m/84'/1'/0'"), - coin_name="Testnet", - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - # Open a second session. - session_id1 = client.session_id - client.init_device(new_session=True) - - # Authorize CoinJoin with www.example2.com in session 2. - btc.authorize_coinjoin( - client, - max_total_fee=50000, - coordinator="www.example2.com", - n=parse_path("m/84'/1'/0'"), - coin_name="Testnet", - script_type=messages.InputScriptType.SPENDWITNESS, - ) - - # Requesting a preauthorized ownership proof for www.example1.com should fail in session 2. - with pytest.raises(TrezorFailure, match="Unauthorized operation"): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example1.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - # Requesting a preauthorized ownership proof for www.example2.com should succeed in session 2. - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example2.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - assert ( - ownership_proof.hex() - == "534c00190101f3ce2cb33599634353452b60b38e311282b6fca743eb6147d3d492066c8963de0002483045022100ff4df2485a3206642ce7053902da16f26f0084faa2eb6288a1c27e389f057f4f02202268e0f4e253bd1387230b1ff3de315794e0b426f9cc9624e9c34fa73451164c012103505647c017ff2156eb6da20fae72173d3b681a1d0a629f95f49e884db300689f" - ) - - # Switch back to the first session. - session_id2 = client.session_id - client.init_device(session_id=session_id1) - - # Requesting a preauthorized ownership proof for www.example1.com should succeed in session 1. - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example1.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - assert ( - ownership_proof.hex() - == "534c00190101f3ce2cb33599634353452b60b38e311282b6fca743eb6147d3d492066c8963de000247304402203b098674577c55c8d9151335c9e73ed74649fa01c461bd8390717bfca48167af02205ac35def1b0d7019fc492acb9bbd9914cf55e08e4f1a7e6d4f6f65cbc88b0bd2012103505647c017ff2156eb6da20fae72173d3b681a1d0a629f95f49e884db300689f" - ) - - # Requesting a preauthorized ownership proof for www.example2.com should fail in session 1. - with pytest.raises(TrezorFailure, match="Unauthorized operation"): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example2.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - # Cancel the authorization in session 1. - device.cancel_authorization(client) - - # Requesting a preauthorized ownership proof should fail now. - with pytest.raises(TrezorFailure, match="No preauthorized operation"): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example1.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) - - # Switch to the second session. - client.init_device(session_id=session_id2) - - # Requesting a preauthorized ownership proof for www.example2.com should still succeed in session 2. - ownership_proof, _ = btc.get_ownership_proof( - client, - "Testnet", - parse_path("84'/1'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"www.example2.com" + (1).to_bytes(ROUND_ID_LEN, "big"), - preauthorized=True, - ) diff --git a/tests/device_tests/test_msg_getownershipproof.py b/tests/device_tests/test_msg_getownershipproof.py deleted file mode 100644 index 5757e2865..000000000 --- a/tests/device_tests/test_msg_getownershipproof.py +++ /dev/null @@ -1,96 +0,0 @@ -# This file is part of the Trezor project. -# -# Copyright (C) 2012-2019 SatoshiLabs and contributors -# -# This library is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the License along with this library. -# If not, see . - -import pytest - -from trezorlib import btc, messages -from trezorlib.exceptions import TrezorFailure -from trezorlib.tools import parse_path - -pytestmark = pytest.mark.skip_t1 - - -@pytest.mark.skip_ui -def test_ownership_id(client): - ownership_id = btc.get_ownership_id( - client, - "Bitcoin", - parse_path("m/84'/0'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - ) - assert ( - ownership_id.hex() - == "a122407efc198211c81af4450f40b235d54775efd934d16b9e31c6ce9bad5707" - ) - - -@pytest.mark.skip_ui -def test_p2wpkh_ownership_proof(client): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Bitcoin", - parse_path("m/84'/0'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - ) - assert ( - ownership_proof.hex() - == "534c00190001a122407efc198211c81af4450f40b235d54775efd934d16b9e31c6ce9bad57070002483045022100e5eaf2cb0a473b4545115c7b85323809e75cb106175ace38129fd62323d73df30220363dbc7acb7afcda022b1f8d97acb8f47c42043cfe0595583aa26e30bc8b3bb50121032ef68318c8f6aaa0adec0199c69901f0db7d3485eb38d9ad235221dc3d61154b" - ) - - -@pytest.mark.skip_ui -def test_fake_ownership_id(client): - with pytest.raises(TrezorFailure, match="Invalid ownership identifier"): - btc.get_ownership_proof( - client, - "Bitcoin", - parse_path("m/84'/0'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - ownership_ids=[ - b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - ], - ) - - -def test_confirm_ownership_proof(client): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Bitcoin", - parse_path("m/84'/0'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - ) - - assert ( - ownership_proof.hex() - == "534c00190101a122407efc198211c81af4450f40b235d54775efd934d16b9e31c6ce9bad57070002483045022100fa4561d261464360f18af9668c19e1b07d58f76814623aa8e5c9b2d85bc211d002207f364096183f461be75f763d2f970df6ac9b30a5a39556a07cab9c6f4d7883a80121032ef68318c8f6aaa0adec0199c69901f0db7d3485eb38d9ad235221dc3d61154b" - ) - - -def test_confirm_ownership_proof_with_data(client): - ownership_proof, _ = btc.get_ownership_proof( - client, - "Bitcoin", - parse_path("m/84'/0'/0'/1/0"), - script_type=messages.InputScriptType.SPENDWITNESS, - user_confirmation=True, - commitment_data=b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", - ) - - assert ( - ownership_proof.hex() - == "534c00190101a122407efc198211c81af4450f40b235d54775efd934d16b9e31c6ce9bad57070002483045022100ac67fde3f0c8443c2708b3e405b17c4c8a51e510132b4f35aa6d6782713a53280220616192365f6202ee3f050d4e0e13c38198156024ca978fbd2b8c89c8823bb3dd0121032ef68318c8f6aaa0adec0199c69901f0db7d3485eb38d9ad235221dc3d61154b" - ) diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index 8893e6c6d..2922c5665 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -16,11 +16,6 @@ "test_msg_applysettings.py-test_apply_settings_passphrase": "5c1ed9a0be3d14475102d447da0b5d51bbb6dfaaeceff5ea9179064609db7870", "test_msg_applysettings.py-test_apply_settings_passphrase_on_device": "3e6527e227bdde54f51bc9c417b176d0d87fdb6c40c4761368f50eb201b4beed", "test_msg_applysettings.py-test_safety_checks": "19bd500c3b791d51bbd1140085f306a838194593697529263f362acb0b1ab445", -"test_msg_authorize_coinjoin.py::test_cancel_authorization": "d8a608beb6165f5667cc44dcff6bdc17ebb4638ddd3bd09e7f0e1e75d1e21135", -"test_msg_authorize_coinjoin.py::test_no_anonymity": "fd09da284b650e893990b95047b63a35b6b695fc5301d595f17a6d2cf9d90bcb", -"test_msg_authorize_coinjoin.py::test_sign_tx": "2838d4062333c241b6bbef7e680ec8a5764fe7bcaa41419e4141e146d3586a5d", -"test_msg_authorize_coinjoin.py::test_unfair_fee": "62314e936de46a6caaf02c8eb20f6f471be6e79ca0c5450cad6f67f9cb823f2b", -"test_msg_authorize_coinjoin.py::test_wrong_coordinator": "d8a608beb6165f5667cc44dcff6bdc17ebb4638ddd3bd09e7f0e1e75d1e21135", "test_msg_backup_device.py::test_backup_bip39": "2b63928444b8188eb2241fc03a3b9bc81191cfa9bbf3ef5431894c04ee0ed01f", "test_msg_backup_device.py::test_backup_slip39_advanced": "31900e0e8ad694ce894eee1ce289b425558c1fcd7bcb6128a19c049af436d35f", "test_msg_backup_device.py::test_backup_slip39_basic": "be4d88d882851ce1ddc45165c35952b23121ddca1a811c7fd7c7ef9d31989e8c", @@ -178,8 +173,6 @@ "test_msg_getentropy.py::test_entropy[65]": "a722fa2048fa3102889ec05558d25f837a364ef2a118e85975683e10a56f1356", "test_msg_getentropy.py::test_entropy[8]": "a722fa2048fa3102889ec05558d25f837a364ef2a118e85975683e10a56f1356", "test_msg_getentropy.py::test_entropy[9]": "a722fa2048fa3102889ec05558d25f837a364ef2a118e85975683e10a56f1356", -"test_msg_getownershipproof.py::test_confirm_ownership_proof": "7724ef59fee121da564b935b5880479c9518d97dc286e2949f13a8a8bdf6fa4a", -"test_msg_getownershipproof.py::test_confirm_ownership_proof_with_data": "1043f54be594bd3180c59c8474ef7ef46be35f99ad5f6890949c38680c097e52", "test_msg_lisk_getaddress.py-test_lisk_getaddress": "0063ceb48d21aecd1ddabdb083c8afd2042cdf577e4751fa3f57b2b80f619084", "test_msg_lisk_getpublickey.py-test_lisk_get_public_key": "e4cb8c7430c240e27a2211391ab5eba848be4f50136cf9f693142c2677a939d7", "test_msg_lisk_signmessage.py-test_sign": "c47a6ec147137c75903cff19da6607eaef5a1fc03ace1f840d2952744342b568", @@ -335,12 +328,12 @@ "test_msg_signtx_external.py::test_p2wsh_external_presigned": "8374d50b803db0160de39ce7e5a4170112f4c99d703490920a2de735bd261bda", "test_msg_signtx_grs.py-test_legacy": "3a80ea724a93ed225d64f8def739d63b11f8c096455f971feabec8be6f7597fb", "test_msg_signtx_grs.py-test_legacy_change": "8dfc140534bdaa08f6916831dc0d510f57b07617f30df748e4e0456d4dd93ece", -"test_msg_signtx_invalid_path.py-test_invalid_path_fail": "b0f22cba2dbab2cd21c15c002b66ed89b6c728b10daa8d0c0e78abd4164a3912", -"test_msg_signtx_invalid_path.py-test_invalid_path_pass_forkid": "667dcb09b569e5b4e091e6b1ac7e8e057c0c730c931b22f8c0ee64050f3f467b", "test_msg_signtx_grs.py-test_send_segwit_native": "82dfa15178d33e757da58943aff36dcc0eebb984e34832b71f6ca09b2a525cbc", "test_msg_signtx_grs.py-test_send_segwit_native_change": "d8ae74de3aada1d136c4119f2306a63bd109901ce15d00ae916ba5b4457e798e", "test_msg_signtx_grs.py-test_send_segwit_p2sh": "9ab885dd3b390813f8a47e1d1587abe07ab713e9f8696dc667b3a2925f23c103", "test_msg_signtx_grs.py-test_send_segwit_p2sh_change": "6c352ab975a75a150f7c3415a967fb8635395ff8db0de89ecb9c2011cb519509", +"test_msg_signtx_invalid_path.py-test_invalid_path_fail": "b0f22cba2dbab2cd21c15c002b66ed89b6c728b10daa8d0c0e78abd4164a3912", +"test_msg_signtx_invalid_path.py-test_invalid_path_pass_forkid": "667dcb09b569e5b4e091e6b1ac7e8e057c0c730c931b22f8c0ee64050f3f467b", "test_msg_signtx_komodo.py-test_one_one_fee_sapling": "14bad8852ee51f6fec12677cced9ffafa0cbae91b4ba94e988a800544072ed21", "test_msg_signtx_komodo.py-test_one_one_rewards_claim": "751e83d63bf01c6c57047b5e004629d613df75342371cd43a7b4b80a07f4b88d", "test_msg_signtx_peercoin.py::test_timestamp_included": "825b9bdf5238c5c6415a254a6bae4b2bd9df8fc5cb31f66f0c20145cb4e60bbb",