mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 23:08:14 +00:00
fix(core/cardano): forbid tx outputs with both address and address parameters
This commit is contained in:
parent
597402eab8
commit
a92b5fc333
@ -401,6 +401,37 @@
|
||||
"error_message": "Invalid address"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Output has both address and address parameters set",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "addr_test1vr9s8py7y68e3x66sscs0wkhlg5ssfrfs65084jrlrqcfqqtmut0e",
|
||||
"addressType": 0,
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"stakingPath": "m/1852'/1815'/0'/2/0",
|
||||
"amount": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"error_message": "Outputs can not contain both address and address_parameters fields!"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Certificate has non staking path",
|
||||
"parameters": {
|
||||
|
@ -213,6 +213,12 @@ def _validate_outputs(
|
||||
total_amount = 0
|
||||
for output in outputs:
|
||||
total_amount += output.amount
|
||||
|
||||
if output.address_parameters and output.address is not None:
|
||||
raise wire.ProcessError(
|
||||
"Outputs can not contain both address and address_parameters fields!"
|
||||
)
|
||||
|
||||
if output.address_parameters:
|
||||
validate_address_parameters(output.address_parameters)
|
||||
elif output.address is not None:
|
||||
|
@ -123,7 +123,8 @@ def parse_output(output) -> messages.CardanoTxOutputType:
|
||||
|
||||
if contains_address:
|
||||
address = output["address"]
|
||||
else:
|
||||
|
||||
if contains_address_type:
|
||||
address_parameters = _parse_address_parameters(output)
|
||||
|
||||
if "token_bundle" in output:
|
||||
|
Loading…
Reference in New Issue
Block a user