diff --git a/trezorlib/tests/device_tests/test_msg_signtx.py b/trezorlib/tests/device_tests/test_msg_signtx.py index 25181fe43d..a7d83f788a 100644 --- a/trezorlib/tests/device_tests/test_msg_signtx.py +++ b/trezorlib/tests/device_tests/test_msg_signtx.py @@ -20,6 +20,7 @@ from binascii import hexlify, unhexlify import pytest from .common import TrezorTest +from .conftest import TREZOR_VERSION from trezorlib import coins from trezorlib import messages as proto @@ -625,8 +626,8 @@ class TestMsgSigntx(TrezorTest): # Now run the attack, must trigger the exception with pytest.raises(CallException) as exc: self.client.sign_tx('Bitcoin', [inp1, inp2], [out1, out2], debug_processor=attack_processor) - assert exc.value.args[0] == proto.FailureType.ProcessError - assert exc.value.args[1] == 'Transaction has changed during signing' + assert exc.value.args[0] in (proto.FailureType.ProcessError, proto.FailureType.DataError) + assert exc.value.args[1].endswith('Transaction has changed during signing') def test_attack_change_input_address(self): # This unit test attempts to modify input address after the Trezor checked @@ -700,8 +701,12 @@ class TestMsgSigntx(TrezorTest): # Now run the attack, must trigger the exception with pytest.raises(CallException) as exc: self.client.sign_tx('Testnet', [inp1], [out1, out2], debug_processor=attack_processor) + assert exc.value.args[0] == proto.FailureType.ProcessError - assert exc.value.args[1] == 'Transaction has changed during signing' + if TREZOR_VERSION == 1: + assert exc.value.args[1].endswith('Failed to compile input') + else: + assert exc.value.args[1].endswith('Transaction has changed during signing') def test_spend_coinbase(self): # 25 TEST generated to m/1 (mfiGQVPcRcaEvQPYDErR34DcCovtxYvUUV) diff --git a/trezorlib/tests/device_tests/test_msg_signtx_bcash.py b/trezorlib/tests/device_tests/test_msg_signtx_bcash.py index f54cedb456..2bb71707ae 100644 --- a/trezorlib/tests/device_tests/test_msg_signtx_bcash.py +++ b/trezorlib/tests/device_tests/test_msg_signtx_bcash.py @@ -219,13 +219,14 @@ class TestMsgSigntxBch(TrezorTest): proto.ButtonRequest(code=proto.ButtonRequestType.SignTx), proto.TxRequest(request_type=proto.RequestType.TXINPUT, details=proto.TxRequestDetailsType(request_index=0)), proto.TxRequest(request_type=proto.RequestType.TXINPUT, details=proto.TxRequestDetailsType(request_index=1)), - proto.Failure(code=proto.FailureType.ProcessError), + proto.Failure(), ]) with pytest.raises(CallException) as exc: self.client.sign_tx('Bcash', [inp1, inp2], [out1], debug_processor=attack_processor) - assert exc.value.args[0] == proto.FailureType.ProcessError - assert exc.value.args[1] == 'Transaction has changed during signing' + + assert exc.value.args[0] == proto.FailureType.DataError + assert exc.value.args[1].endswith('Transaction has changed during signing') def test_attack_change_input(self): self.setup_mnemonic_allallall() diff --git a/trezorlib/tests/device_tests/test_msg_signtx_segwit.py b/trezorlib/tests/device_tests/test_msg_signtx_segwit.py index edfffe0195..fb274179a4 100644 --- a/trezorlib/tests/device_tests/test_msg_signtx_segwit.py +++ b/trezorlib/tests/device_tests/test_msg_signtx_segwit.py @@ -18,6 +18,7 @@ from binascii import hexlify, unhexlify import pytest +from .conftest import TREZOR_VERSION from .common import TrezorTest from trezorlib import coins from trezorlib import messages as proto @@ -240,4 +241,7 @@ class TestMsgSigntxSegwit(TrezorTest): with pytest.raises(CallException) as exc: self.client.sign_tx('Testnet', [inp1], [out1, out2], debug_processor=attack_processor) assert exc.value.args[0] == proto.FailureType.ProcessError - assert exc.value.args[1] == 'Transaction has changed during signing' + if TREZOR_VERSION == 1: + assert exc.value.args[1].endswith("Failed to compile input") + else: + assert exc.value.args[1].endswith('Transaction has changed during signing') diff --git a/trezorlib/tests/device_tests/test_multisig.py b/trezorlib/tests/device_tests/test_multisig.py index 90c0b1693e..115f0fd605 100644 --- a/trezorlib/tests/device_tests/test_multisig.py +++ b/trezorlib/tests/device_tests/test_multisig.py @@ -254,4 +254,4 @@ class TestMultisig(TrezorTest): self.client.sign_tx('Bitcoin', [inp1, ], [out1, ]) assert exc.value.args[0] == proto.FailureType.DataError - assert 'Pubkey not found in multisig script' in exc.value.args[1] + assert exc.value.args[1].endswith('Pubkey not found in multisig script') diff --git a/trezorlib/tests/device_tests/test_op_return.py b/trezorlib/tests/device_tests/test_op_return.py index 1168a128cd..91e370f807 100644 --- a/trezorlib/tests/device_tests/test_op_return.py +++ b/trezorlib/tests/device_tests/test_op_return.py @@ -19,6 +19,7 @@ from binascii import unhexlify, hexlify import pytest from .common import TrezorTest +from .conftest import TREZOR_VERSION from trezorlib import messages as proto from trezorlib.client import CallException @@ -110,5 +111,9 @@ class TestOpReturn(TrezorTest): with pytest.raises(CallException) as exc: self.client.sign_tx('Bitcoin', [inp1], [out1]) - assert exc.value.args[0] == proto.FailureType.DataError - assert exc.value.args[1] == 'OP_RETURN output with non-zero amount' + if TREZOR_VERSION == 1: + assert exc.value.args[0] == proto.FailureType.ProcessError + assert exc.value.args[1].endswith("Failed to compile output") + else: + assert exc.value.args[0] == proto.FailureType.DataError + assert exc.value.args[1].endswith('OP_RETURN output with non-zero amount')