cardano_node_tests.tests.tests_plutus_v2 package

Submodules

cardano_node_tests.tests.tests_plutus_v2.conftest module

cardano_node_tests.tests.tests_plutus_v2.conftest.cluster(cluster_manager: ClusterManager) ClusterLib[source]

Return instance of clusterlib.ClusterLib.

cardano_node_tests.tests.tests_plutus_v2.mint_build module

cardano_node_tests.tests.tests_plutus_v2.mint_raw module

cardano_node_tests.tests.tests_plutus_v2.mint_raw.check_missing_builtin(cluster_obj: ClusterLib, temp_template: str, payment_addr: AddressRecord, issuer_addr: AddressRecord)[source]

Check builtins added to PlutusV2 from PlutusV3.

cardano_node_tests.tests.tests_plutus_v2.spend_build module

cardano_node_tests.tests.tests_plutus_v2.spend_raw module

cardano_node_tests.tests.tests_plutus_v2.test_mint_build module

Tests for minting with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_mint_build.TestBuildMinting[source]

Bases: object

Tests for minting using Plutus smart contracts and transaction build.

test_inline_datum_visibility(cluster: ClusterLib, payment_addrs: list[AddressRecord], scenario: str)[source]

Test visibility of inline datums on reference inputs by a plutus script.

  • Create the necessary Tx outputs

  • Mint the token and check that the plutus script have visibility of the inline datum

  • Check that the token was minted

  • Check that the reference UTxO was not spent

test_minting_ref_missing_txout(cluster: ClusterLib, payment_addrs: list[AddressRecord], plutus_version: str)[source]

Test minting a token with reference Plutus script without providing TxOut for the token.

Uses cardano-cli transaction build command for building the transactions.

  • Fund the token issuer and create a UTxO for collateral and reference script

  • Check that the expected amount was transferred to token issuer’s address

  • Mint the token using a Plutus script

  • Check that the token was minted and collateral UTxO was not spent

test_minting_ref_one_token(cluster: ClusterLib, payment_addrs: list[AddressRecord], plutus_version: str)[source]

Test minting a token with reference Plutus script.

Uses cardano-cli transaction build command for building the transactions.

  • Fund the token issuer and create a UTxO for collateral and reference script

  • Check that the expected amount was transferred to token issuer’s address

  • Mint the token using a Plutus script

  • Check that the token was minted and collateral UTxO was not spent

  • Check expected fees

  • Check expected Plutus cost

test_reference_inputs_visibility(cluster: ClusterLib, payment_addrs: list[AddressRecord], valid_redeemer: bool)[source]

Test visibility of reference inputs by a plutus script.

  • Create the necessary Tx outputs

  • Create the redeemer with the reference input

  • Mint the token and check that the plutus script have visibility of the reference input

  • Check that the token was minted

  • Check that the reference UTxO was not spent

test_reference_scripts_visibility(cluster: ClusterLib, payment_addrs: list[AddressRecord], valid_redeemer: bool)[source]

Test visibility of reference inputs by a plutus script.

  • Create needed Tx outputs

  • Create the redeemer with the script hash

  • Mint the token and check that the plutus script has visibility of the reference script

  • Check that the token was minted

  • Check that the reference UTxO was not spent

cardano_node_tests.tests.tests_plutus_v2.test_mint_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment address.

cardano_node_tests.tests.tests_plutus_v2.test_mint_negative_build module

Negative tests for minting with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_mint_negative_build.TestNegativeCollateralOutput[source]

Bases: object

Tests for collateral output that are expected to fail.

test_minting_with_small_return_collateral(cluster: ClusterLib, payment_addrs: list[AddressRecord], with_total_collateral: bool, plutus_version: str)[source]

Test minting a token with a Plutus script with return collateral < min UTxO.

In cardano-node >= 11.1.0 (cardano-api >= 11.4.0.0), transaction build fails when the too small return collateral output is specified explicitly (the with_total_collateral parametrization). When it is not specified explicitly, transaction build omits the return collateral output, uses the whole collateral input as total collateral, and the transaction succeeds.

On older versions, transaction build doesn’t validate the return collateral output and the transaction fails on submit with BabbageOutputTooSmallUTxO.

test_minting_with_unbalanced_total_collateral(cluster: ClusterLib, payment_addrs: list[AddressRecord], with_return_collateral: bool, plutus_version: str)[source]

Test minting a token with a Plutus script with unbalanced total collateral.

Expect failure.

cardano_node_tests.tests.tests_plutus_v2.test_mint_negative_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment address.

cardano_node_tests.tests.tests_plutus_v2.test_mint_negative_raw module

Negative tests for minting with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_mint_negative_raw.TestNegativeCollateralOutput[source]

Bases: object

Tests for collateral output that are expected to fail.

test_minting_with_limited_collateral(cluster: ClusterLib, payment_addrs: list[AddressRecord], plutus_version: str)[source]

Test minting a token with a Plutus script with limited collateral amount.

Expect failure.

  • Fund the token issuer and create a UTxO for collateral

  • Check that the expected amount was transferred to token issuer’s address

  • Mint the token using a Plutus script while limiting the usable collateral amount

  • Check that the minting failed because insufficient collateral amount was provided

test_minting_with_small_return_collateral(cluster: ClusterLib, payment_addrs: list[AddressRecord], with_total_collateral: bool, plutus_version: str)[source]

Test minting a token with a Plutus script with return collateral < min UTxO.

Expect failure.

test_minting_with_unbalanced_total_collateral(cluster: ClusterLib, payment_addrs: list[AddressRecord], with_return_collateral: bool, plutus_version: str)[source]

Test minting a token with a Plutus script with unbalanced total collateral.

Expect failure.

cardano_node_tests.tests.tests_plutus_v2.test_mint_negative_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment address.

cardano_node_tests.tests.tests_plutus_v2.test_mint_raw module

Tests for minting with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_mint_raw.TestMinting[source]

Bases: object

Tests for minting using Plutus smart contracts.

test_datum_hash_visibility(cluster: ClusterLib, payment_addrs: list[AddressRecord], scenario: str)[source]

Test visibility of datum hash on reference inputs by the plutus script.

  • Create needed Tx outputs

  • Mint token and check that plutus script have visibility of the datum hash

  • Check that the token was minted

  • Check that the reference UTxO was not spent

test_minting_two_tokens(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_reference_script: bool, plutus_version: str)[source]

Test minting two tokens with a single Plutus script.

  • Fund the token issuer and create a UTxO for collateral and possibly reference script

  • Check that the expected amount was transferred to token issuer’s address

  • Mint the tokens using a Plutus script

  • Check that the tokens were minted and collateral UTxO was not spent

test_missing_builtin(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test builtins added to PlutusV2 from PlutusV3.

  • Fund the token issuer and create a UTxO for collateral

  • Check that the expected amount was transferred to token issuer’s address

  • Try to mint the tokens using a Plutus script

  • Check that the tokens were minted and collateral UTxO was not spent -OR- check the expected failure

cardano_node_tests.tests.tests_plutus_v2.test_mint_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment address.

cardano_node_tests.tests.tests_plutus_v2.test_mint_secp256k1_build module

SECP256k1 tests for minting with Plutus using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_mint_secp256k1_build.TestSECP256k1[source]

Bases: object

test_negative_secp_builtin_functions(cluster: ClusterLib, payment_addrs: list[AddressRecord], test_vector: str, algorithm: str, plutus_version: str)[source]

Try to mint a token with invalid test vectors.

Expect failure.

test_use_secp_builtin_functions(cluster: ClusterLib, payment_addrs: list[AddressRecord], algorithm: str, plutus_version: str)[source]

Test that is possible to use the two SECP256k1 builtin functions.

  • Fund the token issuer

  • Mint the tokens using a Plutus script with a SECP256k1 function

  • Check that the token was minted

cardano_node_tests.tests.tests_plutus_v2.test_mint_secp256k1_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment address.

cardano_node_tests.tests.tests_plutus_v2.test_mint_secp256k1_raw module

SECP256k1 tests for minting with Plutus using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_mint_secp256k1_raw.TestSECP256k1[source]

Bases: object

test_negative_secp_builtin_functions(cluster: ClusterLib, payment_addrs: list[AddressRecord], test_vector: str, algorithm: str, plutus_version: str)[source]

Try to mint a token with invalid test vectors.

Expect failure.

test_use_secp_builtin_functions(cluster: ClusterLib, payment_addrs: list[AddressRecord], algorithm: str, plutus_version: str)[source]

Test that is possible to use the two SECP256k1 builtin functions.

  • Fund the token issuer

  • Mint the tokens using a Plutus script with a SECP256k1 function

  • Check that the token was minted

cardano_node_tests.tests.tests_plutus_v2.test_mint_secp256k1_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment address.

cardano_node_tests.tests.tests_plutus_v2.test_spend_build module

Tests for spending with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_build.TestBuildLocking[source]

Bases: object

Tests for Tx output locking using Plutus V2 functionalities and transaction build.

test_min_required_utxo(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_inline_datum: bool, use_token: bool, use_reference_script: bool, request: FixtureRequest)[source]

Test minimum required UTxO in different scenarios with v2 functionalities.

  • Create the necessary Tx outputs

  • Check the min required UTxO

test_txout_locking(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_inline_datum: bool, use_reference_script: bool)[source]

Test combinations of inline datum and datum file + reference script and script file.

  • Create the necessary Tx outputs

  • Spend the locked UTxO

  • Check that the expected UTxOs were correctly spent

  • (optional) Check transactions in db-sync

cardano_node_tests.tests.tests_plutus_v2.test_spend_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_collateral_build module

Tests for collateral while spending with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_collateral_build.TestCollateralOutput[source]

Bases: object

Tests for Tx output locking using Plutus with collateral output.

test_collateral_with_tokens(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_return_collateral: bool)[source]

Test failing script using collaterals with tokens.

  • Create the token

  • Fund the script address and create a UTxO for collateral

  • Spend the locked UTxO

  • Check that the expected amount of collateral was spent

test_with_total_return_collateral(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_return_collateral: bool, use_total_collateral: bool)[source]

Test failing script with combination of total and return collateral set.

  • Fund the script address and create a UTxO for collateral

  • Spend the locked UTxO

  • Check that the expected amount of collateral was spent

cardano_node_tests.tests.tests_plutus_v2.test_spend_collateral_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_collateral_raw module

Tests for collateral while spending with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_collateral_raw.TestCollateralOutput[source]

Bases: object

Tests for Tx output locking using Plutus with collateral output.

test_collateral_with_tokens(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test failing script using collaterals with tokens.

  • Create the token

  • Fund the script address and create a UTxO for collateral

  • Spend the locked UTxO

  • Check that the expected amount of collateral was spent

test_with_total_return_collateral(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_return_collateral: bool, use_total_collateral: bool)[source]

Test failing script with combination of total and return collateral set.

  • Fund the script address and create a UTxO for collateral

  • Spend the locked UTxO

  • Check that the expected amount of collateral was spent

cardano_node_tests.tests.tests_plutus_v2.test_spend_collateral_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_compat_build module

Compatibility tests for spending with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_compat_build.TestCompatibility[source]

Bases: object

Tests for checking compatibility with previous Tx eras.

test_inline_datum_old_tx_era(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an inline datum using old Tx era.

Expect failure with Alonzo-era Tx.

test_reference_script_old_tx_era(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with a reference script using old Tx era.

test_ro_reference_old_tx_era(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test building Tx with read-only reference input using old Tx era.

Expect failure.

cardano_node_tests.tests.tests_plutus_v2.test_spend_compat_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_compat_raw module

Compatibility tests for spending with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_compat_raw.TestCompatibility[source]

Bases: object

Tests for checking compatibility with previous Tx eras.

test_inline_datum_old_tx_era(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an inline datum using old Tx era.

Expect failure with Alonzo-era Tx.

test_reference_script_old_tx_era(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with a reference script using old Tx era.

test_ro_reference_old_tx_era(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test building Tx with read-only reference input using old Tx era.

Expect failure.

cardano_node_tests.tests.tests_plutus_v2.test_spend_compat_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_datum_build module

Tests for datum while spending with Plutus using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_datum_build.TestInlineDatum[source]

Bases: object

Tests for Tx output with inline datum.

test_check_inline_datum_cost(cluster: ClusterLib)[source]

Check that the min UTxO value with an inline datum depends on the size of the datum.

  • Calculate the min UTxO value with a small datum, using both inline and hash

  • Calculate the min UTxO value with a big datum, using both inline and hash

  • Check that the min UTxO value with an inline datum depends on datum size

class cardano_node_tests.tests.tests_plutus_v2.test_spend_datum_build.TestNegativeInlineDatum[source]

Bases: object

Tests for Tx output with inline datum that are expected to fail.

pbt_script_address(cluster: ClusterLib) str[source]

Get Plutus script address.

Meant for property-based tests, so this expensive operation gets executed only once.

test_lock_tx_big_datum(cluster: ClusterLib, payment_addrs: list[AddressRecord], pbt_script_address: str) None[source]

Test locking a Tx output with a datum bigger than the allowed size.

Expect failure on node version < 1.36.0.

test_lock_tx_datum_as_witness(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test unlock a Tx output with a datum as witness.

Expect failure.

test_lock_tx_invalid_datum(cluster: ClusterLib, payment_addrs: list[AddressRecord]) None[source]

Test locking a Tx output with an invalid datum.

Expect failure.

test_lock_tx_v1_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an inline datum and a v1 script.

Expect failure.

cardano_node_tests.tests.tests_plutus_v2.test_spend_datum_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_datum_raw module

Tests for datum while spending with Plutus using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_datum_raw.TestNegativeInlineDatum[source]

Bases: object

Tests for Tx output with inline datum that are expected to fail.

pbt_highest_utxo(cluster: ClusterLib, payment_addrs: list[AddressRecord]) UTXOData[source]

Get UTxO with highest amount of Lovelace.

Meant for property-based tests, so this expensive operation gets executed only once.

pbt_script_address(cluster: ClusterLib) str[source]

Get Plutus script address.

Meant for property-based tests, so this expensive operation gets executed only once.

test_lock_tx_big_datum(cluster: ClusterLib, payment_addrs: list[AddressRecord], pbt_highest_utxo: UTXOData, pbt_script_address: str) None[source]

Test locking a Tx output with a datum bigger than the allowed size.

Expect failure on node version < 1.36.0.

test_lock_tx_datum_as_witness(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test unlock a Tx output with a datum as witness.

Expect failure.

test_lock_tx_invalid_datum(cluster: ClusterLib, payment_addrs: list[AddressRecord]) None[source]

Test locking a Tx output with an invalid datum.

Expect failure.

test_lock_tx_v1_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an inline datum and a v1 script.

Expect failure.

cardano_node_tests.tests.tests_plutus_v2.test_spend_datum_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_raw module

Tests for spending with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_raw.TestLockingV2[source]

Bases: object

Tests for Tx output locking using Plutus V2 smart contracts.

test_datum_bytes_in_dbsync(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test that datum bytes in db-sync corresponds to original datum.

  • Create a Tx output with an inline datum at the script address

  • Double-check that the UTxO datum hash corresponds to the datum CBOR file

  • Check that datum from db-sync produces the original datum hash

  • Check that datum bytes in db-sync corresponds to the original datum

test_txout_locking(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_inline_datum: bool, use_reference_script: bool)[source]

Test combinations of inline datum and datum file + reference script and script file.

  • Create the necessary Tx outputs

  • Check that the expected amount was locked at the script address

  • Spend the locked UTxO

  • Check that the expected UTxOs were correctly spent

  • (optional) Check transactions in db-sync

cardano_node_tests.tests.tests_plutus_v2.test_spend_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_build module

Tests for ro reference inputs while spending with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_build.TestNegativeReadonlyReferenceInputs[source]

Bases: object

Tests for Tx with readonly reference inputs that are expected to fail.

test_reference_input_without_spend_anything(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test using a read-only reference input without spending any UTxO.

Expect failure.

test_reference_spent_output(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test use a reference input that was already spent.

Expect failure

test_v1_script_with_reference_input(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test use a reference input with a v1 Plutus script.

Expect failure

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_build.TestReadonlyReferenceInputs[source]

Bases: object

Tests for Tx with readonly reference inputs.

test_reference_input_non_plutus(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test using a read-only reference input in non-Plutus transaction.

  • Use a reference input in normal non-Plutus transaction

  • Check that the reference input was not spent

  • (optional) Check transactions in db-sync

test_same_input_as_reference_input(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test use a reference input that is also a regular input of the same transaction.

  • Create the necessary Tx outputs

  • Use a reference input that is also a regular input and spend the locked UTxO

  • Check that input was spent

  • Check β€œtransaction view”

test_use_reference_input(cluster: ClusterLib, payment_addrs: list[AddressRecord], reference_input_scenario: str)[source]

Test use a reference input when unlock some funds.

  • Create the necessary Tx outputs

  • Use a reference input and spend the locked UTxO

  • Check that the reference input was not spent

  • (optional) Check transactions in db-sync

test_use_same_reference_input_multiple_times(cluster: ClusterLib, cluster_manager: ClusterManager, payment_addrs: list[AddressRecord])[source]

Test 2 transactions using the same reference input in the same block.

  • Create the UTxO that will be used as readonly reference input

  • Create the transactions using the same readonly reference input

  • Submit both transactions

  • Check that the readonly reference input was not spent

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_raw module

Tests for ro reference inputs while spending with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_raw.TestNegativeReadonlyReferenceInputs[source]

Bases: object

Tests for Tx with readonly reference inputs that are expected to fail.

test_reference_input_without_spend_anything(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test using a read-only reference input without spending any UTxO.

Expect failure.

test_reference_spent_output(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test use a reference input that was already spent.

Expect failure

test_v1_script_with_reference_input(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test use a reference input with a v1 Plutus script.

Expect failure

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_raw.TestReadonlyReferenceInputs[source]

Bases: object

Tests for Tx with readonly reference inputs.

test_reference_input_non_plutus(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test using a read-only reference input in non-Plutus transaction.

  • Use a reference input in normal non-Plutus transaction

  • Check that the reference input was not spent

  • (optional) Check transactions in db-sync

test_same_input_as_reference_input(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test use a reference input that is also a regular input of the same transaction.

  • Create the necessary Tx outputs

  • Use a reference input that is also a regular input and spend the locked UTxO

  • Check that the input was spent

  • Check β€œtransaction view”

test_use_reference_input(cluster: ClusterLib, payment_addrs: list[AddressRecord], reference_input_scenario: str)[source]

Test use a reference input when unlock some funds.

  • Create the necessary Tx outputs

  • Use a reference input and spend the locked UTxO

  • Check that the reference input was not spent

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_inputs_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_build module

Tests for reference scripts while spending with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_build.TestNegativeReferenceScripts[source]

Bases: object

Tests for Tx output with reference scripts that are expected to fail.

test_lock_byron_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with a Plutus V2 reference script on Byron address.

Expect failure.

test_lock_tx_v1_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with a Plutus V1 reference script.

Expect failure.

test_not_a_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an invalid reference script.

Expect failure.

test_two_scripts_one_fail(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking two Tx with different Plutus reference scripts in single Tx, one fails.

Expect failure.

test_v1_attached_v2_reference(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an attached V1 script and one using reference V2 script.

  • Create the Tx output with an attached V1 script

  • Create the Tx output with the reference V2 script

  • Spend the locked UTxOs

  • Check that the UTxOs were correctly spent

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_build.TestReferenceScripts[source]

Bases: object

Tests for Tx output locking using Plutus smart contracts with reference scripts.

test_mix_reference_attached_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an attached V2 script and one using reference V2 script.

  • Create the Tx output with an attached script

  • Create the Tx output with the reference script

  • Spend the locked UTxOs

  • Check that the UTxOs were correctly spent

test_reference_multiple_script(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_same_script: bool)[source]

Test locking two Tx output with a V2 reference script and spending it.

  • Create the Tx outputs with an inline datum at the script address

  • Create the Tx outputs with the reference scripts

  • Spend the locked UTxOs using the reference UTxOs

  • Check that the UTxOs were correctly spent

test_reference_same_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking two Tx output with the same V2 reference script and spending it.

  • Create the Tx outputs with an inline datum at the script address

  • Create the Tx output with the reference script

  • Spend the locked UTxOs using the reference UTxO

  • Check that the UTxOs were correctly spent

test_spend_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord], plutus_version: str, address_type: str)[source]

Test spending a UTxO that holds a reference script.

  • Create a Tx output with reference script (reference script UTxO)

  • Check that the expected amount was transferred

  • Spend the UTxO

  • Check that the UTxO was spent

test_spend_regular_utxo_and_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord], plutus_version: str)[source]

Test spend an UTxO and use a reference a script on the same transaction.

  • Create the reference script UTxO with the β€˜ALWAYS_FAILS’ script to have confidence that the script was not being executed

  • Spend a regular UTxO and reference the script at the same transaction

  • Check that the destination UTxO have the right balance

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_raw module

Tests for reference scripts while spending with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_raw.TestNegativeReferenceScripts[source]

Bases: object

Tests for Tx output with reference scripts that are expected to fail.

test_lock_byron_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with a Plutus V2 reference script on Byron address.

Expect failure.

test_lock_tx_v1_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with a Plutus V1 reference script.

Expect failure.

test_not_a_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an invalid reference script.

Expect failure.

test_two_scripts_one_fail(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking two Tx with different Plutus reference scripts in single Tx, one fails.

Expect failure.

test_v1_attached_v2_reference(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an attached V1 script and one using reference V2 script.

Expect failure.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_raw.TestReferenceScripts[source]

Bases: object

Tests for Tx output locking using Plutus smart contracts with reference scripts.

test_mix_reference_attached_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking a Tx output with an attached V2 script and one using reference V2 script.

  • Create the Tx output with an attached script

  • Create the Tx output with the reference script

  • Spend the locked UTxOs

  • Check that the UTxOs were correctly spent

test_reference_multiple_script(cluster: ClusterLib, payment_addrs: list[AddressRecord], use_same_script: bool)[source]

Test locking two Tx output with a V2 reference script and spending it.

  • Create the Tx outputs with an inline datum at the script address

  • Create the Tx outputs with the reference scripts

  • Spend the locked UTxOs using the reference UTxOs

  • Check that the UTxOs were correctly spent

test_reference_same_script(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test locking two Tx output with the same V2 reference script and spending it.

  • Create the Tx outputs with an inline datum at the script address

  • Create the Tx output with the reference script

  • Spend the locked UTxOs using the reference UTxO

  • Check that the UTxOs were correctly spent

test_reference_script_byron_address(cluster: ClusterLib, payment_addrs: list[AddressRecord])[source]

Test creating reference script UTxO on Byron address.

  • Create a Byron address

  • Create a reference script UTxO on Byron address with the β€˜ALWAYS_FAILS’ script to have confidence that the script was not being executed

test_spend_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord], plutus_version: str, address_type: str)[source]

Test spending a UTxO that holds a reference script.

  • Create a Tx output with reference script (reference script UTxO)

  • Check that the expected amount was transferred

  • Spend the UTxO

  • Check that the UTxO was spent

test_spend_regular_utxo_and_reference_script(cluster: ClusterLib, payment_addrs: list[AddressRecord], plutus_version: str)[source]

Test spend an UTxO and use a reference a script on the same transaction.

  • Create the reference script UTxO with the β€˜ALWAYS_FAILS’ script to have confidence that the script was not being executed

  • Spend a regular UTxO and reference the script at the same transaction

  • Check that the destination UTxO have the right balance

cardano_node_tests.tests.tests_plutus_v2.test_spend_ref_scripts_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_secp256k1_build module

SECP256k1 tests for spending with Plutus V2 using transaction build.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_secp256k1_build.TestSECP256k1[source]

Bases: object

build_fund_script_secp(cluster: ClusterLib, payment_addrs: list[AddressRecord], request: SubRequest) tuple[str, list[UTXOData], list[UTXOData], UTXOData][source]

Fund a Plutus script and create the necessary Tx outputs.

test_overspending_execution_budget(cluster: ClusterLib, payment_addrs: list[AddressRecord], build_fund_script_secp: tuple[str, list[UTXOData], list[UTXOData], UTXOData]) None[source]

Try to build a transaction with a plutus script that overspend the execution budget.

Expect failure.

test_use_secp_builtin_functions(cluster: ClusterLib, payment_addrs: list[AddressRecord], build_fund_script_secp: tuple[str, list[UTXOData], list[UTXOData], UTXOData])[source]

Test that it is possible to spend a locked UTxO by a script that uses a SECP function.

  • Create the necessary Tx outputs

  • Spend the locked UTxO

  • Check that script address UTxO was spent

cardano_node_tests.tests.tests_plutus_v2.test_spend_secp256k1_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

cardano_node_tests.tests.tests_plutus_v2.test_spend_secp256k1_raw module

SECP256k1 tests for spending with Plutus V2 using transaction build-raw.

class cardano_node_tests.tests.tests_plutus_v2.test_spend_secp256k1_raw.TestSECP256k1[source]

Bases: object

fund_script_secp(cluster: ClusterLib, payment_addrs: list[AddressRecord], request: SubRequest) tuple[str, list[UTXOData], list[UTXOData]][source]

Fund a Plutus script and create the necessary Tx outputs.

test_use_secp_builtin_functions(cluster: ClusterLib, payment_addrs: list[AddressRecord], fund_script_secp: tuple[str, list[UTXOData], list[UTXOData]])[source]

Test that it is possible to spend a locked UTxO by a script that uses a SECP function.

  • Create the necessary Tx outputs

  • Spend the locked UTxO

  • Check that script address UTxO was spent

cardano_node_tests.tests.tests_plutus_v2.test_spend_secp256k1_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) list[AddressRecord][source]

Create new payment addresses.

Module contents