1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 07:18:09 +00:00

Include metadata in transaction signing

This commit is contained in:
gabrielkerekes 2020-07-29 08:22:36 +02:00 committed by Pavol Rusnak
parent 0438f318b4
commit f2ee450410
9 changed files with 83 additions and 85 deletions

View File

@ -118,7 +118,7 @@ message CardanoSignTx {
optional uint32 network_id = 8; // network id - mainnet or testnet
repeated CardanoTxCertificateType certificates = 9; // transaction certificates - added in shelley
repeated CardanoTxWithdrawalType withdrawals = 10; // transaction withdrawals - added in shelley
optional bytes metadata_hash = 11; // transaction metadata hash - added in shelley
optional bytes metadata = 11; // transaction metadata - added in shelley
/**
* Structure representing cardano transaction input
*/

View File

@ -131,7 +131,9 @@ async def show_warning_tx_staking_key_hash(
await require_confirm(ctx, Paginated([t1, t2, t3]))
async def confirm_transaction(ctx, amount: int, fee: int, protocol_magic: int):
async def confirm_transaction(
ctx, amount: int, fee: int, protocol_magic: int, has_metadata: bool
) -> None:
t1 = Text("Confirm transaction", ui.ICON_SEND, ui.GREEN)
t1.normal("Transaction amount:")
t1.bold(format_coin_amount(amount))
@ -141,6 +143,9 @@ async def confirm_transaction(ctx, amount: int, fee: int, protocol_magic: int):
t2 = Text("Confirm transaction", ui.ICON_SEND, ui.GREEN)
t2.normal("Network:")
t2.bold(protocol_magics.to_ui_string(protocol_magic))
if has_metadata:
t2.normal("Transaction contains")
t2.normal("metadata")
await require_hold_to_confirm(ctx, Paginated([t1, t2]))
@ -179,14 +184,6 @@ async def confirm_withdrawal(
await require_confirm(ctx, t1)
async def confirm_metadata_hash(ctx: wire.Context, metadata_hash: bytes) -> bool:
t1 = Text("Confirm transaction", ui.ICON_SEND, ui.GREEN)
t1.normal("Confirm metadata hash:")
t1.bold(hexlify(metadata_hash).decode())
await require_confirm(ctx, t1)
async def show_address(
ctx: wire.Context,
address: str,

View File

@ -32,7 +32,6 @@ from .helpers import (
from .helpers.utils import to_account_path
from .layout import (
confirm_certificate,
confirm_metadata_hash,
confirm_sending,
confirm_transaction,
confirm_withdrawal,
@ -61,6 +60,7 @@ LOVELACE_MAX_SUPPLY = 45_000_000_000 * 1_000_000
POOL_HASH_SIZE = 28
METADATA_HASH_SIZE = 32
MAX_METADATA_LENGTH = 500
@seed.with_keychain
@ -80,8 +80,8 @@ async def sign_tx(
_validate_certificates(msg.certificates)
_validate_withdrawals(msg.withdrawals)
if msg.metadata_hash and len(msg.metadata_hash) != METADATA_HASH_SIZE:
raise wire.ProcessError("Invalid metadata hash")
if msg.metadata and len(msg.metadata) > MAX_METADATA_LENGTH:
raise wire.ProcessError("Invalid metadata")
# display the transaction in UI
await _show_tx(ctx, keychain, msg)
@ -171,10 +171,11 @@ def _serialize_tx(keychain: seed.Keychain, msg: CardanoSignTx) -> Tuple[bytes, b
msg.protocol_magic,
)
# We always set transaction metadata to None, even if metadata
# hash is set. Metadata aren't sent to Trezor and the None
# should be replaced by the SW wallet if metadata exist.
serialized_tx = cbor.encode([tx_body, witnesses, None])
metadata = None
if msg.metadata:
metadata = cbor.Raw(bytes(msg.metadata))
serialized_tx = cbor.encode([tx_body, witnesses, metadata])
return serialized_tx, tx_hash
@ -204,8 +205,8 @@ def _build_tx_body(keychain: seed.Keychain, msg: CardanoSignTx) -> Dict:
# tx_body[6] is for protocol updates, which we don't support
if msg.metadata_hash:
tx_body[7] = msg.metadata_hash
if msg.metadata:
tx_body[7] = _hash_metadata(bytes(msg.metadata))
return tx_body
@ -280,6 +281,10 @@ def _build_withdrawals(
return result
def _hash_metadata(metadata: bytes) -> bytes:
return hashlib.blake2b(data=metadata, outlen=METADATA_HASH_SIZE).digest()
def _hash_tx_body(tx_body: Dict) -> bytes:
tx_body_cbor = cbor.encode(tx_body)
return hashlib.blake2b(data=tx_body_cbor, outlen=32).digest()
@ -398,10 +403,10 @@ async def _show_tx(
for withdrawal in msg.withdrawals:
await confirm_withdrawal(ctx, withdrawal)
if msg.metadata_hash:
await confirm_metadata_hash(ctx, msg.metadata_hash)
await confirm_transaction(ctx, total_amount, msg.fee, msg.protocol_magic)
has_metadata = bool(msg.metadata)
await confirm_transaction(
ctx, total_amount, msg.fee, msg.protocol_magic, has_metadata
)
async def _show_outputs(

View File

@ -28,7 +28,7 @@ class CardanoSignTx(p.MessageType):
network_id: int = None,
certificates: List[CardanoTxCertificateType] = None,
withdrawals: List[CardanoTxWithdrawalType] = None,
metadata_hash: bytes = None,
metadata: bytes = None,
) -> None:
self.inputs = inputs if inputs is not None else []
self.outputs = outputs if outputs is not None else []
@ -38,7 +38,7 @@ class CardanoSignTx(p.MessageType):
self.network_id = network_id
self.certificates = certificates if certificates is not None else []
self.withdrawals = withdrawals if withdrawals is not None else []
self.metadata_hash = metadata_hash
self.metadata = metadata
@classmethod
def get_fields(cls) -> Dict:
@ -51,5 +51,5 @@ class CardanoSignTx(p.MessageType):
8: ('network_id', p.UVarintType, 0),
9: ('certificates', CardanoTxCertificateType, p.FLAG_REPEATED),
10: ('withdrawals', CardanoTxWithdrawalType, p.FLAG_REPEATED),
11: ('metadata_hash', p.BytesType, 0),
11: ('metadata', p.BytesType, 0),
}

View File

@ -203,7 +203,7 @@ def sign_tx(
ttl: int,
certificates: List[messages.CardanoTxCertificateType] = (),
withdrawals: List[messages.CardanoTxWithdrawalType] = (),
metadata_hash: bytes = None,
metadata: bytes = None,
protocol_magic: int = PROTOCOL_MAGICS["mainnet"],
network_id: int = NETWORK_IDS["mainnet"],
) -> messages.CardanoSignedTx:
@ -215,7 +215,7 @@ def sign_tx(
ttl=ttl,
certificates=certificates,
withdrawals=withdrawals,
metadata_hash=metadata_hash,
metadata=metadata,
protocol_magic=protocol_magic,
network_id=network_id,
)

View File

@ -71,9 +71,9 @@ def sign_tx(client, file, protocol_magic, network_id, testnet):
cardano.create_withdrawal(withdrawal)
for withdrawal in transaction.get("withdrawals", ())
]
metadata_hash = None
if transaction.get("metadata_hash"):
metadata_hash = bytes.fromhex(transaction["metadata_hash"])
metadata = None
if transaction.get("metadata"):
metadata = bytes.fromhex(transaction["metadata"])
signed_transaction = cardano.sign_tx(
client,
@ -83,7 +83,7 @@ def sign_tx(client, file, protocol_magic, network_id, testnet):
ttl,
certificates,
withdrawals,
metadata_hash,
metadata,
protocol_magic,
network_id,
)

View File

@ -28,7 +28,7 @@ class CardanoSignTx(p.MessageType):
network_id: int = None,
certificates: List[CardanoTxCertificateType] = None,
withdrawals: List[CardanoTxWithdrawalType] = None,
metadata_hash: bytes = None,
metadata: bytes = None,
) -> None:
self.inputs = inputs if inputs is not None else []
self.outputs = outputs if outputs is not None else []
@ -38,7 +38,7 @@ class CardanoSignTx(p.MessageType):
self.network_id = network_id
self.certificates = certificates if certificates is not None else []
self.withdrawals = withdrawals if withdrawals is not None else []
self.metadata_hash = metadata_hash
self.metadata = metadata
@classmethod
def get_fields(cls) -> Dict:
@ -51,5 +51,5 @@ class CardanoSignTx(p.MessageType):
8: ('network_id', p.UVarintType, 0),
9: ('certificates', CardanoTxCertificateType, p.FLAG_REPEATED),
10: ('withdrawals', CardanoTxWithdrawalType, p.FLAG_REPEATED),
11: ('metadata_hash', p.BytesType, 0),
11: ('metadata', p.BytesType, 0),
}

View File

@ -171,7 +171,7 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[[InputAction.SWIPE, InputAction.YES], [InputAction.SWIPE, InputAction.YES]],
@ -198,7 +198,7 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -232,7 +232,7 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[[InputAction.SWIPE, InputAction.YES], [InputAction.SWIPE, InputAction.YES]],
@ -286,7 +286,7 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -320,7 +320,7 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -354,7 +354,7 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -385,7 +385,7 @@ VALID_VECTORS = [
[SAMPLE_CERTIFICATES["stake_registration"]],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -419,7 +419,7 @@ VALID_VECTORS = [
],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -451,7 +451,7 @@ VALID_VECTORS = [
[SAMPLE_CERTIFICATES["stake_deregistration"]],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -482,7 +482,7 @@ VALID_VECTORS = [
[SAMPLE_CERTIFICATES["stake_deregistration"]],
# withdrawals
[SAMPLE_WITHDRAWALS["valid"]],
# metadata hash
# metadata
"",
# input flow
[
@ -496,7 +496,7 @@ VALID_VECTORS = [
# tx body
"83a600818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182583901eb0baa5e570cffbe2934db29df0b6a3d7c0430ee65d4c3a7ab2fefb91bc428e4720702ebd5dab4fb175324c192dc9bb76cc5da956e3c8dff0102182a030a048182018200581c122a946b9ad3d2ddf029d3a828f0468aece76895f15c9efbd69b427705a1581de1122a946b9ad3d2ddf029d3a828f0468aece76895f15c9efbd69b42771903e8a10082825820bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e58400202826a8b9688cf978000e7d1591582c65b149bb9f55dc883ae1acf85432618ca32be8a06fef37e69df503a294e7093006f63ababf9fcea639390226934020a8258205d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c158407efa634e42fa844cad5f60bf005d645817cc674f30eaab0da398b99034850780b40ab5a1028da033330a0f82b01648ec92cff8ca85a072594efb298016f38d0df6",
),
# transaction with metadata hash
# transaction with metadata
(
# network id
PROTOCOL_MAGICS["mainnet"],
@ -514,18 +514,14 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
# metadata
"a200a11864a118c843aa00ff01a119012c590100aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
# input flow
[
[InputAction.SWIPE, InputAction.YES],
[InputAction.YES],
[InputAction.SWIPE, InputAction.YES],
],
[[InputAction.SWIPE, InputAction.YES], [InputAction.SWIPE, InputAction.YES]],
# tx hash
"4e123da8fbe13219e10e7287e6592befcbdbe4e42028e5699249289c8049afc5",
"1875f1d59a53f1cb4c43949867d72bcfd857fa3b64feb88f41b78ddaa1a21cbf",
# tx body
"83a500818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182583901eb0baa5e570cffbe2934db29df0b6a3d7c0430ee65d4c3a7ab2fefb91bc428e4720702ebd5dab4fb175324c192dc9bb76cc5da956e3c8dff0102182a030a075820aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa100818258205d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c15840bf400eece1e8081aa670bd1e80321af98e78089cabc6033fe72a2a859ed8de57a439e23a39798fffab595bc8801a05b2359abc655cc3699c65a3170f30732005f6",
"83a500818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182583901eb0baa5e570cffbe2934db29df0b6a3d7c0430ee65d4c3a7ab2fefb91bc428e4720702ebd5dab4fb175324c192dc9bb76cc5da956e3c8dff0102182a030a075820ea4c91860dd5ec5449f8f985d227946ff39086b17f10b5afb93d12ee87050b6aa100818258205d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c15840b2015772a91043aeb04b98111744a098afdade0db5e30206538d7f2814965a5800d45240137f4d0dc81845a71e67cda38beaf816a520d73c4decbf7cbf0f6d08a200a11864a118c843aa00ff01a119012c590100aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
),
# Testnet transaction
(
@ -549,7 +545,7 @@ VALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# input flow
[
@ -584,7 +580,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid address",
@ -607,7 +603,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid address",
@ -630,7 +626,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid address",
@ -653,7 +649,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid address",
@ -676,7 +672,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid address",
@ -699,7 +695,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Fee is out of range!",
@ -725,7 +721,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Total transaction amount is out of range!",
@ -748,7 +744,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Output address network mismatch!",
@ -771,7 +767,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Output address network mismatch!",
@ -794,7 +790,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid address",
@ -817,7 +813,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid address",
@ -840,7 +836,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid network id/protocol magic combination!",
@ -863,7 +859,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid network id/protocol magic combination!",
@ -909,7 +905,7 @@ INVALID_VECTORS = [
[SAMPLE_CERTIFICATES["invalid_non_staking_path"]],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid certificate",
@ -932,7 +928,7 @@ INVALID_VECTORS = [
[SAMPLE_CERTIFICATES["invalid_pool_size"]],
# withdrawals
[],
# metadata hash
# metadata
"",
# error message
"Invalid certificate",
@ -955,7 +951,7 @@ INVALID_VECTORS = [
[],
# withdrawals
[SAMPLE_WITHDRAWALS["invalid_non_staking_path"]],
# metadata hash
# metadata
"",
# error message
"Invalid withdrawal",
@ -978,12 +974,12 @@ INVALID_VECTORS = [
[],
# withdrawals
[SAMPLE_WITHDRAWALS["invalid_amount_too_large"]],
# metadata hash
# metadata
"",
# error message
"Invalid withdrawal",
),
# Invalid metadata hash size
# Metadata too large
(
# protocol magic
PROTOCOL_MAGICS["mainnet"],
@ -1001,10 +997,10 @@ INVALID_VECTORS = [
[],
# withdrawals
[],
# metadata hash
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
# metadata
"A200A11864A118C843AA00FF01A119012C590202AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
# error message
"Invalid metadata hash",
"Invalid metadata",
),
]
@ -1013,7 +1009,7 @@ INVALID_VECTORS = [
@pytest.mark.cardano
@pytest.mark.skip_t1 # T1 support is not planned
@pytest.mark.parametrize(
"protocol_magic,network_id,inputs,outputs,fee,ttl,certificates,withdrawals,metadata_hash,input_flow_sequences,tx_hash,serialized_tx",
"protocol_magic,network_id,inputs,outputs,fee,ttl,certificates,withdrawals,metadata,input_flow_sequences,tx_hash,serialized_tx",
VALID_VECTORS,
)
def test_cardano_sign_tx(
@ -1026,7 +1022,7 @@ def test_cardano_sign_tx(
ttl,
certificates,
withdrawals,
metadata_hash,
metadata,
input_flow_sequences,
tx_hash,
serialized_tx,
@ -1064,7 +1060,7 @@ def test_cardano_sign_tx(
ttl=ttl,
certificates=certificates,
withdrawals=withdrawals,
metadata_hash=bytes.fromhex(metadata_hash),
metadata=bytes.fromhex(metadata),
protocol_magic=protocol_magic,
network_id=network_id,
)
@ -1076,7 +1072,7 @@ def test_cardano_sign_tx(
@pytest.mark.cardano
@pytest.mark.skip_t1 # T1 support is not planned
@pytest.mark.parametrize(
"protocol_magic,network_id,inputs,outputs,fee,ttl,certificates,withdrawals,metadata_hash,expected_error_message",
"protocol_magic,network_id,inputs,outputs,fee,ttl,certificates,withdrawals,metadata,expected_error_message",
INVALID_VECTORS,
)
def test_cardano_sign_tx_validation(
@ -1089,7 +1085,7 @@ def test_cardano_sign_tx_validation(
ttl,
certificates,
withdrawals,
metadata_hash,
metadata,
expected_error_message,
):
inputs = [cardano.create_input(i) for i in inputs]
@ -1111,7 +1107,7 @@ def test_cardano_sign_tx_validation(
ttl=ttl,
certificates=certificates,
withdrawals=withdrawals,
metadata_hash=bytes.fromhex(metadata_hash),
metadata=bytes.fromhex(metadata),
protocol_magic=protocol_magic,
network_id=network_id,
)

View File

@ -125,7 +125,7 @@ def test_cardano_sign_tx(
outputs = [cardano.create_output(o) for o in outputs]
certificates = []
withdrawals = []
metadata_hash = bytes()
metadata = bytes()
expected_responses = [messages.PassphraseRequest()]
expected_responses += [
@ -157,7 +157,7 @@ def test_cardano_sign_tx(
ttl=ttl,
certificates=certificates,
withdrawals=withdrawals,
metadata_hash=metadata_hash,
metadata=metadata,
protocol_magic=protocol_magic,
network_id=network_id,
)