1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-19 22:18:13 +00:00

feat(cardano): allow datum hash in non-script outputs

This commit is contained in:
David Misiak 2022-06-10 12:47:20 +02:00 committed by matejcik
parent f7d0507a65
commit 11c4b25cb0
2 changed files with 1 additions and 6 deletions

View File

@ -299,7 +299,7 @@ In order for the user to be able to verify native scripts a `get_native_script_h
_Plutus script support has been added in the Cardano Alonzo era_
When creating a UTXO with a script address (in any signing mode), it may also contain `datum_hash` which usually provides additional UTXO-related data to the script.
When creating a UTXO with a Plutus script address (in any signing mode), it should also contain a `datum_hash` which provides additional UTXO-related data to the script. However, there are use cases for a `datum_hash` in an output controlled by a key, so we allow those as well.
When one wants to spend funds from the Plutus script address (which is possible only in the Plutus signing mode), they have to attach the Plutus script as well as the datum referenced in the UTXO and a corresponding redeemer. These items are outside the transaction body which is signed by Trezor, so their hash is included in transaction body as `script_data_hash`.

View File

@ -289,9 +289,6 @@ class Signer:
if output.datum_hash is not None:
if len(output.datum_hash) != OUTPUT_DATUM_HASH_SIZE:
raise wire.ProcessError("Invalid output datum hash")
address_type = self._get_output_address_type(output)
if address_type not in addresses.ADDRESS_TYPES_PAYMENT_SCRIPT:
raise wire.ProcessError("Invalid output")
self.account_path_checker.add_output(output)
@ -347,8 +344,6 @@ class Signer:
of readability and because the same decision is made when displaying output tokens.
"""
if output.datum_hash is not None:
# The `return False` case below should not be reachable when datum hash is
# present, but let's make it explicit.
return True
address_type = self._get_output_address_type(output)