From 0f2ed0f07ce34ef6cef7c1c95c9a247f88543a41 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Thu, 5 Apr 2018 16:54:48 +0200 Subject: [PATCH] src/apps/ethereum: use wire.Error --- src/apps/ethereum/sign_tx.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/apps/ethereum/sign_tx.py b/src/apps/ethereum/sign_tx.py index a641a4869b..660aa2d4b2 100644 --- a/src/apps/ethereum/sign_tx.py +++ b/src/apps/ethereum/sign_tx.py @@ -1,6 +1,6 @@ +from trezor import wire from trezor.messages.EthereumSignTx import EthereumSignTx from trezor.messages.EthereumTxRequest import EthereumTxRequest -from trezor.messages import FailureType from trezor.utils import HashWriter from trezor.crypto import rlp from apps.ethereum import tokens @@ -124,21 +124,21 @@ def node_derive(root, address_n: list): def check(msg: EthereumSignTx): if msg.chain_id < 0 or msg.chain_id > MAX_CHAIN_ID: - raise ValueError(FailureType.DataError, 'Chain id out of bounds') + raise wire.DataError('Chain id out of bounds') if msg.data_length > 0: if not msg.data_initial_chunk: - raise ValueError(FailureType.DataError, 'Data length provided, but no initial chunk') + raise wire.DataError('Data length provided, but no initial chunk') # Our encoding only supports transactions up to 2^24 bytes. To # prevent exceeding the limit we use a stricter limit on data length. if msg.data_length > 16000000: - raise ValueError(FailureType.DataError, 'Data length exceeds limit') + raise wire.DataError('Data length exceeds limit') if len(msg.data_initial_chunk) > msg.data_length: - raise ValueError(FailureType.DataError, 'Invalid size of initial chunk') + raise wire.DataError('Invalid size of initial chunk') # safety checks if not check_gas(msg) or not check_to(msg): - raise ValueError(FailureType.DataError, 'Safety check failed') + raise wire.DataError('Safety check failed') def check_gas(msg: EthereumSignTx) -> bool: