Skip to content

Commit

Permalink
fixup! feat(cardano): add support for plutus transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmisiak committed Nov 11, 2021
1 parent 3c0c271 commit 2c90304
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions core/src/apps/cardano/sign_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
POOL_OWNER_STAKING_PATH_NAME,
SCHEMA_MINT,
SCHEMA_PAYMENT,
SCHEMA_PUBKEY,
SCHEMA_STAKING,
SCHEMA_STAKING_ANY_ACCOUNT,
WITNESS_PATH_NAME,
Expand Down Expand Up @@ -127,7 +126,7 @@
show_warning_tx_output_contains_datum_hash,
show_warning_tx_output_contains_tokens,
)
from .seed import is_byron_path, is_multisig_path, is_shelley_path
from .seed import is_byron_path, is_minting_path, is_multisig_path, is_shelley_path

if False:
from typing import Any, Union
Expand Down Expand Up @@ -1053,7 +1052,11 @@ def _validate_required_signer(required_signer: CardanoTxRequiredSigner) -> None:
if len(required_signer.key_hash) != ADDRESS_KEY_HASH_SIZE:
raise INVALID_REQUIRED_SIGNER
elif required_signer.key_path:
if not SCHEMA_PUBKEY.match(required_signer.key_path): # TODO use correct schema
if not (
is_shelley_path(required_signer.key_path)
or is_multisig_path(required_signer.key_path)
or is_minting_path(required_signer.key_path)
):
raise INVALID_REQUIRED_SIGNER
else:
raise INVALID_REQUIRED_SIGNER
Expand Down Expand Up @@ -1163,7 +1166,14 @@ def _validate_witness_request(
if is_minting and not transaction_has_token_minting:
raise INVALID_WITNESS_REQUEST
elif signing_mode == CardanoTxSigningMode.PLUTUS_TRANSACTION:
pass
if not (
is_shelley_path(witness_request.path)
or is_multisig_path(witness_request.path)
or is_minting
):
raise INVALID_WITNESS_REQUEST
if is_minting and not transaction_has_token_minting:
raise INVALID_WITNESS_REQUEST
else:
raise RuntimeError # we didn't cover all signing modes

Expand Down

0 comments on commit 2c90304

Please sign in to comment.