cardano_node_tests.tests.tests_plutus package
Submodules
cardano_node_tests.tests.tests_plutus.mint_build module
cardano_node_tests.tests.tests_plutus.mint_raw module
cardano_node_tests.tests.tests_plutus.spend_build module
cardano_node_tests.tests.tests_plutus.spend_raw module
cardano_node_tests.tests.tests_plutus.test_delegation module
Tests for delegation of Plutus script stake address.
stake address registration
stake address delegation
rewards withdrawal
stake address deregistration
- class cardano_node_tests.tests.tests_plutus.test_delegation.TestDelegateAddr[source]
Bases:
object
Tests for address delegation to stake pools.
- pytestmark = [Mark(name='parametrize', args=('use_build_cmd', (False, ParameterSet(values=(True,), marks=(MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': "cannot use `build` with Tx era 'conway': "})),), id=None))), kwargs={'ids': ('build_raw', 'build')}), Mark(name='parametrize', args=('plutus_version', ('v1', ParameterSet(values=('v2',), marks=(MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Plutus V2 is available only in Babbage+ eras'})),), id=None))), kwargs={'ids': ('plutus_v1', 'plutus_v2')}), Mark(name='skipif', args=(False,), kwargs={'reason': "cannot use `build` with Tx era 'conway': "})][source]
- test_delegate_deregister(cluster_lock_42stake: Tuple[ClusterLib, str], pool_user: PoolUserScript, plutus_version: str, use_build_cmd: bool, use_reference_script: bool)[source]
Register, delegate and deregister Plutus script stake address.
The stake address registration and delegation happen in single transaction.
submit registration certificate and delegate stake address to pool
check that the stake address was delegated
withdraw rewards to payment address and deregister stake address
check that the key deposit was returned and rewards withdrawn
check that the stake address is no longer delegated
(optional) check records in db-sync
- test_register_delegate_deregister(cluster_lock_42stake: Tuple[ClusterLib, str], pool_user: PoolUserScript, plutus_version: str, use_build_cmd: bool)[source]
Register, delegate and deregister Plutus script stake address.
The stake address registration and delegation happen in two separate transactions.
submit registration certificate for a stake address
delegate stake address to pool
check that the stake address was delegated
withdraw rewards to payment address and deregister stake address
check that the key deposit was returned and rewards withdrawn
check that the stake address is no longer delegated
(optional) check records in db-sync
- class cardano_node_tests.tests.tests_plutus.test_delegation.TestRegisterAddr[source]
Bases:
object
Tests for address registration.
- pytestmark = [Mark(name='parametrize', args=('use_build_cmd', (False, ParameterSet(values=(True,), marks=(MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': "cannot use `build` with Tx era 'conway': "})),), id=None))), kwargs={'ids': ('build_raw', 'build')}), Mark(name='parametrize', args=('plutus_version', ('v1', ParameterSet(values=('v2',), marks=(MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Plutus V2 is available only in Babbage+ eras'})),), id=None))), kwargs={'ids': ('plutus_v1', 'plutus_v2')}), Mark(name='skipif', args=(False,), kwargs={'reason': "cannot use `build` with Tx era 'conway': "})][source]
- test_register_deregister(cluster_lock_42stake: Tuple[ClusterLib, str], pool_user: PoolUserScript, plutus_version: str, use_build_cmd: bool)[source]
Register and deregister Plutus script stake address.
submit registration certificate for a stake address
check that the stake address was registered
deregister the stake address
check that the key deposit was returned and rewards withdrawn
check that the stake address is no longer registered
(optional) check records in db-sync
- cardano_node_tests.tests.tests_plutus.test_delegation.cluster_lock_42stake(cluster_manager: ClusterManager) Tuple[ClusterLib, str] [source]
Make sure just one staking Plutus test run at a time.
Plutus script always has the same address. When one script is used in multiple tests that are running in parallel, the balances etc. don’t add up.
- cardano_node_tests.tests.tests_plutus.test_delegation.delegate_stake_addr(cluster_obj: ClusterLib, temp_template: str, txins: List[UTXOData], collaterals: List[UTXOData], pool_user: PoolUserScript, pool_id: str, redeemer_file: Path, reference_script_utxos: List[UTXOData] | None, use_build_cmd: bool) Tuple[TxRawOutput, List[dict]] [source]
Delegate a stake address to a pool.
- cardano_node_tests.tests.tests_plutus.test_delegation.deregister_stake_addr(cluster_obj: ClusterLib, temp_template: str, txins: List[UTXOData], collaterals: List[UTXOData], pool_user: PoolUserScript, redeemer_file: Path, reference_script_utxos: List[UTXOData] | None, use_build_cmd: bool) Tuple[TxRawOutput, List[dict]] [source]
Deregister stake address.
- cardano_node_tests.tests.tests_plutus.test_delegation.pool_user(cluster_manager: ClusterManager, cluster_lock_42stake: Tuple[ClusterLib, str]) PoolUserScript [source]
Create pool user.
- cardano_node_tests.tests.tests_plutus.test_delegation.register_delegate_stake_addr(cluster_obj: ClusterLib, temp_template: str, txins: List[UTXOData], collaterals: List[UTXOData], pool_user: PoolUserScript, pool_id: str, redeemer_file: Path, reference_script_utxos: List[UTXOData] | None, use_build_cmd: bool) Tuple[TxRawOutput, List[dict]] [source]
Submit registration certificate and delegate to pool.
- cardano_node_tests.tests.tests_plutus.test_delegation.register_stake_addr(cluster_obj: ClusterLib, temp_template: str, txins: List[UTXOData], collaterals: List[UTXOData], pool_user: PoolUserScript, redeemer_file: Path, reference_script_utxos: List[UTXOData] | None, use_build_cmd: bool) Tuple[TxRawOutput, List[dict]] [source]
Register a stake address.
cardano_node_tests.tests.tests_plutus.test_lobster module
Tests for the “Lobster Challenge”.
See https://github.com/input-output-hk/lobster-challenge
- class cardano_node_tests.tests.tests_plutus.test_lobster.TestLobsterChallenge[source]
Bases:
object
- pytestmark = [Mark(name='skipif', args=(False,), kwargs={'reason': "cannot use `build` with Tx era 'conway': "})][source]
- test_lobster_name(cluster: ClusterLib, payment_addrs: List[AddressRecord])[source]
Test the Lobster Challenge.
Uses cardano-cli transaction build command for building the transactions.
fund token issuer and create a UTxO for collateral
mint the LobsterNFT token
deploy the LobsterNFT token to address of lobster spending script
generate random votes and determine the expected final value
perform voting and check that the final value matches the expected value
(optional) check transactions in db-sync
- cardano_node_tests.tests.tests_plutus.test_lobster.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment address.
cardano_node_tests.tests.tests_plutus.test_mint_build module
Tests for minting with Plutus using transaction build.
- class cardano_node_tests.tests.tests_plutus.test_mint_build.TestBuildMinting[source]
Bases:
object
Tests for minting using Plutus smart contracts and transaction build.
- past_horizon_funds(cluster_manager: ClusterManager, cluster: ClusterLib, payment_addrs: List[AddressRecord]) Tuple[List[UTXOData], List[UTXOData], TxRawOutput] [source]
Create UTxOs for test_ttl_horizon.
- test_minting_context_equivalence(cluster: ClusterLib, payment_addrs: List[AddressRecord], submit_method: str)[source]
Test context equivalence while minting a token.
Uses cardano-cli transaction build command for building the transactions.
fund the token issuer and create a UTxO for collateral
check that the expected amount was transferred to token issuer’s address
generate a dummy redeemer and a dummy Tx
derive the correct redeemer from the dummy Tx
mint the token using the derived redeemer
check that the token was minted and collateral UTxO was not spent
check expected Plutus cost
(optional) check transactions in db-sync
- test_minting_missing_txout(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str, submit_method: str)[source]
Test minting a token with a 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
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_one_token(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str, submit_method: str)[source]
Test minting a token with a Plutus script.
Uses cardano-cli transaction build command for building the transactions.
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
check that the token was minted and collateral UTxO was not spent
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- test_time_range_minting(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str, submit_method: str)[source]
Test minting a token with a time constraints Plutus script.
Uses cardano-cli transaction build command for building the transactions.
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
check that the token was minted and collateral UTxO was not spent
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- test_ttl_horizon(cluster: ClusterLib, payment_addrs: List[AddressRecord], past_horizon_funds: Tuple[List[UTXOData], List[UTXOData], TxRawOutput], plutus_version: str, ttl_offset: int)[source]
Test minting a token with ttl far in the future.
Uses cardano-cli transaction build command for building the transactions.
try to mint a token using a Plutus script when ttl is set far in the future
check that minting failed because of ‘PastHorizon’ failure when ttl is too far in the future
- test_two_scripts_minting(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str, submit_method: str)[source]
Test minting two tokens with two different Plutus scripts.
Uses cardano-cli transaction build command for building the transactions.
fund the token issuer and create a UTxO for collaterals
check that the expected amount was transferred to token issuer’s address
mint the tokens using two different Plutus scripts
check that the tokens were minted and collateral UTxOs were not spent
check transaction view output
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- test_witness_redeemer(cluster: ClusterLib, payment_addrs: List[AddressRecord], key: str, plutus_version: str, submit_method: str)[source]
Test minting a token with a Plutus script.
Uses cardano-cli transaction build command for building the transactions.
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 with required signer
check that the token was minted and collateral UTxO was not spent
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- class cardano_node_tests.tests.tests_plutus.test_mint_build.TestCollateralOutput[source]
Bases:
object
Tests for collateral output.
- test_duplicated_collateral(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str, submit_method: str)[source]
Test minting a token with a Plutus script while using the same collateral input twice.
Tests https://github.com/IntersectMBO/cardano-node/issues/4744
Uses cardano-cli transaction build command for building the transactions.
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 token using a Plutus script and the same collateral UTxO listed twice
check that the token was minted and collateral UTxO was not spent
check that the return collateral amount is the expected
- class cardano_node_tests.tests.tests_plutus.test_mint_build.TestPlutusBatch5V3Builtins[source]
Bases:
object
Tests for batch5 of Plutus Core built-in functions.
- fail_scripts = (PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_1.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_2.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_4.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_5.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_6.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_7.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_8.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_9.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_10.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_11.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_12.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_13.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReadBitPolicyScriptV3_14.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReplicateBytePolicyScriptV3_1.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReplicateBytePolicyScriptV3_2.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReplicateBytePolicyScriptV3_3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReplicateBytePolicyScriptV3_4.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReplicateBytePolicyScriptV3_5.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingReplicateBytePolicyScriptV3_6.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_1.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_2.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_4.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_5.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_6.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_7.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_8.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_9.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_10.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_11.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_12.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_13.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_14.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_15.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_16.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_17.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_18.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/failingWriteBitsPolicyScriptV3_19.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=1000000, per_space=100000, fixed_cost=1234)))[source]
- payment_addrs(skip_bootstrap: None, cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment address.
- run_scenario(cluster_obj: ClusterLib, payment_addrs: List[AddressRecord], plutus_v_record: PlutusScriptData, success_expected: bool)[source]
Run an e2e test for a Plutus builtin.
- success_scripts = (PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingRipemd_160Policy.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=6598460, per_space=14710, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingAndByteStringPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=19269680, per_space=102266, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingOrByteStringPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=19269680, per_space=102266, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingXorByteStringPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=19269680, per_space=102266, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingComplementByteStringPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=5863431, per_space=30027, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingCountSetBitsPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=9211420, per_space=45324, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingFindFirstSetBitPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=8071583, per_space=40221, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingReadBitPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=15272720, per_space=82724, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingReplicateBytePolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=4549650, per_space=22946, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingRotateByteStringPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=22778618, per_space=109004, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingShiftByteStringPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=17922844, per_space=85787, fixed_cost=777777)), PlutusScriptData(script_file=PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/plutus/v3/succeedingWriteBitsPolicyScriptV3.plutus'), script_type='plutus_v3', execution_cost=ExecutionCost(per_time=90646820, per_space=462457, fixed_cost=777777)))[source]
- test_plutus_fail(skip_bootstrap: None, cluster: ClusterLib, payment_addrs: List[AddressRecord], script: PlutusScriptData)[source]
Test scenarios that are supposed to fail.
- test_plutus_success(skip_bootstrap: None, cluster: ClusterLib, payment_addrs: List[AddressRecord], script: PlutusScriptData)[source]
Test scenarios that are supposed to succeed.
- cardano_node_tests.tests.tests_plutus.test_mint_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment address.
cardano_node_tests.tests.tests_plutus.test_mint_negative_build module
Negative tests for minting with Plutus using transaction build.
- class cardano_node_tests.tests.tests_plutus.test_mint_negative_build.TestBuildMintingNegative[source]
Bases:
object
Tests for minting with Plutus using transaction build that are expected to fail.
- fund_issuer_long_asset_name(cluster: ClusterLib, payment_addrs: List[AddressRecord]) Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]] [source]
Fund the token issuer and create the collateral UTxO.
- test_asset_name_too_long(cluster: ClusterLib, fund_issuer_long_asset_name: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]]) None [source]
Test minting a token and ‘calculate-min-required-utxo’ with a name longer than allowed.
Expect failure.
- test_redeemer_with_simple_minting_script(cluster: ClusterLib, payment_addrs: List[AddressRecord])[source]
Test minting a token passing a redeemer for a simple minting script.
Expect failure.
fund the token issuer and create a UTxO for collateral
try to mint the token using a simple script passing a redeemer
check that the minting failed because a Plutus script is expected
- test_time_range_missing_tx_validity(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token with a time constraints Plutus script and no TX validity.
Expect failure.
Uses cardano-cli transaction build command for building the transactions.
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 token using a Plutus script and a TX without validity interval
check that the minting failed
- test_witness_redeemer_missing_signer(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str, submit_method: str)[source]
Test minting a token with a Plutus script with invalid signers.
Expect failure.
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 token using a Plutus script and a TX with signing key missing for the required signer
check that the minting failed because the required signers were not provided
- cardano_node_tests.tests.tests_plutus.test_mint_negative_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment address.
cardano_node_tests.tests.tests_plutus.test_mint_negative_raw module
Negative tests for minting with Plutus using transaction build-raw.
- class cardano_node_tests.tests.tests_plutus.test_mint_negative_raw.TestMintingNegative[source]
Bases:
object
Tests for minting with Plutus using transaction build-raw that are expected to fail.
- fund_execution_units_above_limit(cluster: ClusterLib, payment_addrs: List[AddressRecord], pparams: dict, request: SubRequest) Tuple[List[UTXOData], List[UTXOData], PlutusOp] [source]
- test_execution_units_above_limit(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_execution_units_above_limit: Tuple[List[UTXOData], List[UTXOData], PlutusOp], pparams: dict) None [source]
Test minting a token when execution units are above the limit.
Expect failure.
fund the token issuer and create a UTxO for collateral
try to mint the token when execution units are set above the limits
check that the minting failed because the execution units were too big
- test_low_budget(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token when budget is too low.
Expect failure.
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 token using a Plutus script when execution units are set to half of the expected values
check that the minting failed because the budget was overspent
- test_low_fee(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token when fee is set too low.
Expect failure.
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 a token using a Plutus script when fee is set lower than is the computed fee
check that minting failed because the fee amount was too low
- test_time_range_missing_tx_validity(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token with a time constraints Plutus script and no TX validity.
Expect failure.
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 token using a Plutus script and a TX without validity interval
check that the minting failed
- test_witness_redeemer_missing_signer(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token with a Plutus script with invalid signers.
Expect failure.
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 token using a Plutus script and a TX with signing key missing for the required signer
check that the minting failed because the required signers were not provided
- class cardano_node_tests.tests.tests_plutus.test_mint_negative_raw.TestNegativeCollateral[source]
Bases:
object
Tests for collaterals that are expected to fail.
- test_minting_with_insufficient_collateral(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token with a Plutus script with insufficient collateral.
Expect failure.
fund the token issuer and create a UTxO for collateral with insufficient funds
check that the expected amount was transferred to token issuer’s address
mint the token using a Plutus script
check that the minting failed because a collateral with insufficient funds was provided
- test_minting_with_invalid_collaterals(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token with a Plutus script with invalid collaterals.
Expect failure.
fund the token issuer and create an UTxO for collateral with insufficient funds
check that the expected amount was transferred to token issuer’s address
mint the token using a Plutus script
check that the minting failed because no valid collateral was provided
- cardano_node_tests.tests.tests_plutus.test_mint_negative_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment address.
cardano_node_tests.tests.tests_plutus.test_mint_raw module
Tests for minting with Plutus using transaction build-raw.
- class cardano_node_tests.tests.tests_plutus.test_mint_raw.TestCollateralOutput[source]
Bases:
object
Tests for collateral output.
- test_duplicated_collateral(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token with a Plutus script while using the same collateral input twice.
Tests https://github.com/IntersectMBO/cardano-node/issues/4744
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 token using a Plutus script and the same collateral UTxO listed twice
check that the token was minted and collateral UTxO was not spent
- class cardano_node_tests.tests.tests_plutus.test_mint_raw.TestMinting[source]
Bases:
object
Tests for minting using Plutus smart contracts.
- test_minting_context_equivalence(cluster: ClusterLib, payment_addrs: List[AddressRecord])[source]
Test context equivalence while minting a token.
fund the token issuer and create a UTxO for collateral
check that the expected amount was transferred to token issuer’s address
generate a dummy redeemer and a dummy Tx
derive the correct redeemer from the dummy Tx
mint the token using the derived redeemer
check that the token was minted and collateral UTxO was not spent
(optional) check transactions in db-sync
- test_minting_policy_executed_once1(cluster: ClusterLib, payment_addrs: List[AddressRecord])[source]
Test that minting policy is executed only once even when the same policy is used twice.
Test by minting two tokens while using the same Plutus script twice with two different redeemers.
The Plutus script used in this test takes the expected token name as redeemer. Even though the redeemer used for minting the first token doesn’t match the token name, the token gets minted anyway. That’s because only the last redeemer is used and all the other scripts with identical minting policy (and corresponding redeemers) are ignored. So it only matters that the last redeemer matches the last token name.
fund the token issuer and create a UTxO for collateral - funds for fees and collateral are sufficient for just single minting script
check that the expected amount was transferred to token issuer’s address
mint the tokens using two identical Plutus scripts and two redeemers, where the first redeemer value is invalid
check that the tokens were minted and collateral UTxOs were not spent, i.e. the first script and its redeemer were ignored
check transaction view output
(optional) check transactions in db-sync
- test_minting_policy_executed_once2(cluster: ClusterLib, payment_addrs: List[AddressRecord])[source]
Test that minting policy is executed only once even when the same policy is used twice.
Test minting two tokens while using one Plutus script and one redeemer.
The Plutus script used in this test takes the expected token name as redeemer. Even though the redeemer doesn’t match name of the first token, the token get’s minted anyway. That’s because it is only checked that the last token name matches the redeemer, and redeemer for the first token is not needed.
fund the token issuer and create a UTxO for collateral
check that the expected amount was transferred to token issuer’s address
mint the tokens using a redeemer value that doesn’t match the name of the first token
check that the tokens were minted and collateral UTxOs were not spent, i.e. redeemer for the first token was not needed
check transaction view output
(optional) check transactions in db-sync
- test_minting_two_tokens(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting two tokens with a single Plutus script.
fund the token issuer and create a UTxO for collateral
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
(optional) check transactions in db-sync
- test_time_range_minting(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting a token with a time constraints Plutus script.
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
check that the token was minted and collateral UTxO was not spent
(optional) check transactions in db-sync
- test_ttl_horizon(cluster: ClusterLib, payment_addrs: List[AddressRecord], ttl_offset: int, plutus_version: str)[source]
Test minting a token with ttl far in the future.
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 a token using a Plutus script when ttl is set far in the future
check that minting failed because of ‘PastHorizon’ failure when ttl is too far in the future
- test_two_scripts_minting(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test minting two tokens with two different Plutus scripts.
fund the token issuer and create a UTxO for collaterals
check that the expected amount was transferred to token issuer’s address
mint the tokens using two different Plutus scripts
check that the tokens were minted and collateral UTxOs were not spent
check transaction view output
(optional) check transactions in db-sync
- test_witness_redeemer(cluster: ClusterLib, payment_addrs: List[AddressRecord], key: str, plutus_version: str)[source]
Test minting a token with a Plutus script.
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 with required signer
check that the token was minted and collateral UTxO was not spent
(optional) check transactions in db-sync
- cardano_node_tests.tests.tests_plutus.test_mint_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment address.
cardano_node_tests.tests.tests_plutus.test_spend_build module
Tests for spending with Plutus using transaction build.
- class cardano_node_tests.tests.tests_plutus.test_spend_build.TestBuildLocking[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts and transaction build.
- test_always_fails(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Uses cardano-cli transaction build command for building the transactions.
Test with “always fails” script that fails for all datum / redeemer values.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO
check that the expected error was raised
- test_collateral_is_txin(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while using single UTxO for both collateral and Tx input.
Uses cardano-cli transaction build command for building the transactions.
Tests bug https://github.com/IntersectMBO/cardano-db-sync/issues/750
create a Tx output with a datum hash at the script address and a collateral UTxO
check that the expected amount was locked at the script address
spend the locked UTxO while using the collateral UTxO both as collateral and as normal Tx input
check that the expected amount was spent
(optional) check transactions in db-sync
- test_context_equivalence(cluster: ClusterLib, pool_users: List[PoolUser])[source]
Test context equivalence while spending a locked UTxO.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
generate a dummy redeemer and a dummy Tx
derive the correct redeemer from the dummy Tx
spend the locked UTxO using the derived redeemer
check that the expected amount was spent
(optional) check transactions in db-sync
- test_guessing_game(cluster: ClusterLib, payment_addrs: List[AddressRecord], variant: str, plutus_version: str, embed_datum: bool)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Uses cardano-cli transaction build command for building the transactions.
Test with “guessing game” scripts that expect specific datum and redeemer value. Test both typed and untyped redeemer and datum. Test passing datum and redeemer to cardano-cli as value, json file and cbor file.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
spend the locked UTxO
check that the expected amount was spent
(optional) check transactions in db-sync
- test_partial_spending(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending part of funds (Lovelace and native tokens) on a locked UTxO.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output that contains native tokens with a datum hash at the script address
check that expected amounts of Lovelace and native tokens were locked at the script address
spend the locked UTxO and create new locked UTxO with change
check that the expected amounts of Lovelace and native tokens were spent
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- test_script_invalid(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test failing script together with the –script-invalid argument - collateral is taken.
Uses cardano-cli transaction build command for building the transactions.
Test with “always fails” script that fails for all datum / redeemer values.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO
check that the amount was not transferred and collateral UTxO was spent
- test_two_scripts_spending(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking two Tx outputs with two different Plutus scripts in single Tx.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
spend the locked UTxO
check that the expected amount was spent
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- test_txout_locking(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Uses cardano-cli transaction build command for building the transactions.
Corresponds to Exercise 3 for Alonzo Blue.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
spend the locked UTxO
check that the expected amount was spent
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- test_txout_token_locking(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output that contains native tokens with a datum hash at the script address
check that expected amounts of Lovelace and native tokens were locked at the script address
spend the locked UTxO
check that the expected amounts of Lovelace and native tokens were spent
check expected fees
check expected Plutus cost
(optional) check transactions in db-sync
- cardano_node_tests.tests.tests_plutus.test_spend_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
- cardano_node_tests.tests.tests_plutus.test_spend_build.pool_users(cluster_manager: ClusterManager, cluster: ClusterLib) List[PoolUser] [source]
Create new pool users.
cardano_node_tests.tests.tests_plutus.test_spend_compat_build module
Compatibility tests for spending with Plutus using transaction build.
- class cardano_node_tests.tests.tests_plutus.test_spend_compat_build.TestCompatibility[source]
Bases:
object
Tests for checking compatibility with previous Tx eras.
- cardano_node_tests.tests.tests_plutus.test_spend_compat_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
cardano_node_tests.tests.tests_plutus.test_spend_compat_raw module
Compatibility tests for spending with Plutus using transaction build-raw.
- class cardano_node_tests.tests.tests_plutus.test_spend_compat_raw.TestCompatibility[source]
Bases:
object
Tests for checking compatibility with previous Tx eras.
- cardano_node_tests.tests.tests_plutus.test_spend_compat_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
cardano_node_tests.tests.tests_plutus.test_spend_datum_build module
Tests for datum while spending with Plutus using transaction build.
- class cardano_node_tests.tests.tests_plutus.test_spend_datum_build.TestDatum[source]
Bases:
object
Tests for datum.
- class cardano_node_tests.tests.tests_plutus.test_spend_datum_build.TestNegativeDatum[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts with wrong datum.
- pbt_script_addresses(cluster: ClusterLib) Dict[str, str] [source]
Get Plutus script addresses.
Meant for property-based tests, so this expensive operation gets executed only once.
- test_lock_tx_invalid_datum(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str) None [source]
Test locking a Tx output with an invalid datum.
Expect failure.
- test_no_datum_txout(cluster: ClusterLib, payment_addrs: List[AddressRecord], address_type: str, plutus_version: str)[source]
Test using UTxO without datum hash in place of locked UTxO.
Expect failure.
create a Tx output without a datum hash
try to spend the UTxO like it was locked Plutus UTxO
check that the expected error was raised
- test_too_big(cluster: ClusterLib, payment_addrs: List[AddressRecord], pbt_script_addresses: Dict[str, str], plutus_version: str) None [source]
Try to lock a UTxO with datum that is too big.
Expect failure on node version < 1.36.0.
- cardano_node_tests.tests.tests_plutus.test_spend_datum_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
cardano_node_tests.tests.tests_plutus.test_spend_datum_raw module
Tests for datum while spending with Plutus using transaction build-raw.
- class cardano_node_tests.tests.tests_plutus.test_spend_datum_raw.TestDatum[source]
Bases:
object
Tests for datum.
- class cardano_node_tests.tests.tests_plutus.test_spend_datum_raw.TestNegativeDatum[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts with wrong datum.
- 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_addresses(cluster: ClusterLib) Dict[str, str] [source]
Get Plutus script addresses.
Meant for property-based tests, so this expensive operation gets executed only once.
- test_lock_tx_invalid_datum(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str) None [source]
Test locking a Tx output with an invalid datum.
Expect failure.
- test_no_datum_txout(cluster: ClusterLib, payment_addrs: List[AddressRecord], address_type: str, plutus_version: str)[source]
Test using UTxO without datum hash in place of locked UTxO.
Expect failure.
create a Tx output without a datum hash
try to spend the UTxO like it was locked Plutus UTxO
check that the expected error was raised
- test_too_big(cluster: ClusterLib, payment_addrs: List[AddressRecord], pbt_highest_utxo: UTXOData, pbt_script_addresses: Dict[str, str], plutus_version: str) None [source]
Try to lock a UTxO with datum that is too big.
Expect failure on node version < 1.36.0.
- cardano_node_tests.tests.tests_plutus.test_spend_datum_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
cardano_node_tests.tests.tests_plutus.test_spend_negative_build module
Negative tests for spending with Plutus using transaction build.
- class cardano_node_tests.tests.tests_plutus.test_spend_negative_build.TestNegative[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts that are expected to fail.
- test_collateral_w_tokens(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while collateral contains native tokens.
Expect failure.
Uses cardano-cli transaction build command for building the transactions.
create a collateral UTxO with native tokens
try to spend the locked UTxO
check that the expected error was raised
(optional) check transactions in db-sync
- test_invalid_guessing_game(cluster: ClusterLib, payment_addrs: List[AddressRecord], variant: str, plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Uses cardano-cli transaction build command for building the transactions.
Test with “guessing game” script that expects specific datum and redeemer value. Test negative scenarios where datum or redeemer value is different than expected. Expect failure.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO
check that the amount was not transferred and collateral UTxO was not spent
- test_no_script(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while passing no Plutus script.
Expect failure.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output with a datum hash at the script address
try to spend the locked UTxO using while passing no Plutus script
check that the expected error was raised
(optional) check transactions in db-sync
- test_same_collateral_txin(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while using the same UTxO as collateral.
Expect failure.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO while using the same UTxO as collateral
check that the expected error was raised
(optional) check transactions in db-sync
- test_two_scripts_spending_one_fail(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking two Tx outputs with two different Plutus scripts in single Tx, one fails.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output with a datum hash at the script addresses
try to spend the locked UTxOs
check that the expected error was raised
- test_wrong_script(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while using wrong Plutus script.
Expect failure.
Uses cardano-cli transaction build command for building the transactions.
create a Tx output with a datum hash at the script address
try to spend the locked UTxO while using wrong Plutus script
check that the expected error was raised
(optional) check transactions in db-sync
- class cardano_node_tests.tests.tests_plutus.test_spend_negative_build.TestNegativeRedeemer[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts with wrong redeemer.
- fund_script_guessing_game_v1(cluster: ClusterLib, payment_addrs: List[AddressRecord]) Tuple[List[UTXOData], List[UTXOData]] [source]
Fund a PlutusV1 script and create the locked UTxO and collateral UTxO.
Uses cardano-cli transaction build command for building the transactions.
- fund_script_guessing_game_v2(cluster: ClusterLib, payment_addrs: List[AddressRecord]) Tuple[List[UTXOData], List[UTXOData]] [source]
Fund a PlutusV2 script and create the locked UTxO and collateral UTxO.
Uses cardano-cli transaction build command for building the transactions.
- test_invalid_json(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to build a Tx using a redeemer value that is invalid JSON.
Expect failure.
- test_json_schema_typed_bytes_int_declared(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to build a Tx using int value for redeemer when JSON schema specifies byte string.
Redeemer is in typed format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_typed_int_bytes_declared(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to build a Tx using byte string for redeemer when JSON schema specifies int.
Redeemer is in typed format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_typed_invalid_type(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to build a Tx using a JSON typed schema that specifies an invalid type.
Expect failure.
- test_json_schema_untyped_bytes_int_declared(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to build a Tx using int value for redeemer when JSON schema specifies byte string.
Redeemer is in untyped format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_untyped_int_bytes_declared(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to build a Tx using byte string for redeemer when JSON schema specifies int.
Redeemer is in untyped format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_untyped_invalid_type(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to build a Tx using a JSON untyped schema that specifies an invalid type.
Expect failure.
- test_too_big(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to spend a locked UTxO using redeemer that is too big.
Expect failure.
- test_wrong_type(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to spend a locked UTxO with a wrong redeemer type, try to use bytes.
Expect failure.
- test_wrong_value_above_range(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to spend a locked UTxO with a wrong redeemer value, above max value allowed.
Expect failure.
- test_wrong_value_bellow_range(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to spend a locked UTxO with a wrong redeemer value, bellow min value allowed.
Expect failure.
- test_wrong_value_inside_range(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData]], plutus_version: str) None [source]
Try to spend a locked UTxO with a wrong redeemer value that is in the valid range.
Expect failure.
- cardano_node_tests.tests.tests_plutus.test_spend_negative_build.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
cardano_node_tests.tests.tests_plutus.test_spend_negative_raw module
Negative tests for spending with Plutus using transaction build-raw.
- class cardano_node_tests.tests.tests_plutus.test_spend_negative_raw.TestNegative[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts that are expected to fail.
- fund_execution_units_above_limit(cluster: ClusterLib, payment_addrs: List[AddressRecord], request: SubRequest) Tuple[List[UTXOData], List[UTXOData], PlutusOp] [source]
- test_collateral_percent(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Try to spend locked UTxO while collateral is less than required.
Expect failure.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
create a collateral UTxO with amount of ADA less than required by collateralPercentage
try to spend the UTxO
check that the expected error was raised
(optional) check transactions in db-sync
- test_collateral_w_tokens(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while collateral contains native tokens.
Expect failure.
create a collateral UTxO with native tokens
try to spend the locked UTxO
check that the expected error was raised
(optional) check transactions in db-sync
- test_execution_units_above_limit(cluster: ClusterLib, payment_addrs: List[AddressRecord], fund_execution_units_above_limit: Tuple[List[UTXOData], List[UTXOData], PlutusOp], pparams: dict) None [source]
Test spending a locked UTxO with a Plutus script with execution units above the limit.
Expect failure.
fund the script address and create a UTxO for collateral
try to spend the locked UTxO when execution units are set above the limits
check that failed because the execution units were too big
- test_invalid_guessing_game(cluster: ClusterLib, payment_addrs: List[AddressRecord], variant: str, plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Test with “guessing game” script that expects specific datum and redeemer value. Test negative scenarios where datum or redeemer value is different than expected. Expect failure.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO
check that the amount was not transferred and collateral UTxO was not spent
- test_no_script(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while passing no Plutus script.
Expect failure.
create a Tx output with a datum hash at the script address
try to spend the locked UTxO while passing no Plutus script
check that the expected error was raised
(optional) check transactions in db-sync
- test_same_collateral_txin(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while using the same UTxO as collateral.
Expect failure.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO while using the same UTxO as collateral
check that the expected error was raised
(optional) check transactions in db-sync
- test_two_scripts_spending_one_fail(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking two Tx outputs with two different Plutus scripts in single Tx, one fails.
Expect failure.
create a Tx output with a datum hash at the script addresses
try to spend the locked UTxOs
check that the expected error was raised
- test_wrong_script(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending the locked UTxO while using wrong Plutus script.
Expect failure.
create a Tx output with a datum hash at the script address
try to spend the locked UTxO while using wrong Plutus script
check that the expected error was raised
(optional) check transactions in db-sync
- class cardano_node_tests.tests.tests_plutus.test_spend_negative_raw.TestNegativeRedeemer[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts with wrong redeemer.
- cost_per_unit(cluster: ClusterLib) ExecutionCost [source]
- fund_script_guessing_game_v1(cluster_manager: ClusterManager, cluster: ClusterLib) Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]] [source]
- fund_script_guessing_game_v2(cluster_manager: ClusterManager, cluster: ClusterLib) Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]] [source]
- test_invalid_json(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to build a Tx using a redeemer value that is invalid JSON.
Expect failure.
- test_json_schema_typed_bytes_int_declared(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to build a Tx using int value for redeemer when JSON schema specifies byte string.
Redeemer is in typed format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_typed_int_bytes_declared(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to build a Tx using byte string for redeemer when JSON schema specifies int.
Redeemer is in typed format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_typed_invalid_type(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to build a Tx using a JSON typed schema that specifies an invalid type.
Expect failure.
- test_json_schema_untyped_bytes_int_declared(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to build a Tx using int value for redeemer when JSON schema specifies byte string.
Redeemer is in untyped format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_untyped_int_bytes_declared(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to build a Tx using byte string for redeemer when JSON schema specifies int.
Redeemer is in untyped format and the value doesn’t comply to JSON schema. Expect failure.
- test_json_schema_untyped_invalid_type(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to build a Tx using a JSON untyped schema that specifies an invalid type.
Expect failure.
- test_too_big(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to spend a locked UTxO using redeemer that is too big.
Expect failure on node version < 1.36.0.
- test_wrong_type(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to spend a locked UTxO with an invalid redeemer type.
Expect failure.
- test_wrong_value_above_range(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to spend a locked UTxO with a redeemer int value > maximum allowed value.
Expect failure on node version < 1.36.0.
- test_wrong_value_bellow_range(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to spend a locked UTxO with a redeemer int value < minimum allowed value.
Expect failure on node version < 1.36.0.
- test_wrong_value_inside_range(cluster: ClusterLib, fund_script_guessing_game_v1: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], fund_script_guessing_game_v2: Tuple[List[UTXOData], List[UTXOData], List[AddressRecord]], cost_per_unit: ExecutionCost, plutus_version: str) None [source]
Try to spend a locked UTxO with an unexpected redeemer value.
Expect failure.
- cardano_node_tests.tests.tests_plutus.test_spend_negative_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
cardano_node_tests.tests.tests_plutus.test_spend_raw module
Tests for spending with Plutus using transaction build-raw.
- class cardano_node_tests.tests.tests_plutus.test_spend_raw.TestLocking[source]
Bases:
object
Tests for Tx output locking using Plutus smart contracts.
- test_always_fails(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Test with “always fails” script that fails for all datum / redeemer values.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO
check that the amount was not transferred, collateral UTxO was not spent and the expected error was raised
- test_collaterals(cluster: ClusterLib, payment_addrs: List[AddressRecord], scenario: str, plutus_version: str)[source]
Test dividing required collateral amount into multiple collateral UTxOs.
Test 3 scenarios: 1. maximum allowed number of collateral inputs 2. more collateral inputs than what is allowed 3. no collateral input
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
create multiple UTxOs for collateral
spend the locked UTxO
check that the expected amount was spent when success is expected
OR check that the amount was not transferred and collateral UTxO was not spent when failure is expected
(optional) check transactions in db-sync
- test_context_equivalence(cluster: ClusterLib, pool_users: List[PoolUser])[source]
Test context equivalence while spending a locked UTxO.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
generate a dummy redeemer and a dummy Tx
derive the correct redeemer from the dummy Tx
spend the locked UTxO using the derived redeemer
check that the expected amount was spent
(optional) check transactions in db-sync
- test_guessing_game(cluster: ClusterLib, payment_addrs: List[AddressRecord], embed_datum: bool, variant: str, plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Test with “guessing game” scripts that expect specific datum and redeemer value. Test both typed and untyped redeemer and datum. Test passing datum and redeemer to cardano-cli as value, json file and cbor file.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
spend the locked UTxO
check that the expected amount was spent
(optional) check transactions in db-sync
- test_partial_spending(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test spending part of funds (Lovelace and native tokens) on a locked UTxO.
create a Tx output that contains native tokens with a datum hash at the script address
check that expected amounts of Lovelace and native tokens were locked at the script address
spend the locked UTxO and create new locked UTxO with change
check that the expected amounts of Lovelace and native tokens were spent
(optional) check transactions in db-sync
- test_script_invalid(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test failing script together with the –script-invalid argument - collateral is taken.
Test with “always fails” script that fails for all datum / redeemer values.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
try to spend the locked UTxO
check that the amount was not transferred and collateral UTxO was spent
- test_two_scripts_spending(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking two Tx outputs with two different Plutus scripts in single Tx.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
spend the locked UTxO
check that the expected amount was spent
(optional) check transactions in db-sync
- test_txout_locking(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking a Tx output with a Plutus script and spending the locked UTxO.
Corresponds to Exercise 3 for Alonzo Blue.
create a Tx output with a datum hash at the script address
check that the expected amount was locked at the script address
spend the locked UTxO
check that the expected amount was spent
(optional) check transactions in db-sync
- test_txout_token_locking(cluster: ClusterLib, payment_addrs: List[AddressRecord], plutus_version: str)[source]
Test locking a Tx output with native tokens and spending the locked UTxO.
create a Tx output that contains native tokens with a datum hash at the script address
check that expected amounts of Lovelace and native tokens were locked at the script address
spend the locked UTxO
check that the expected amounts of Lovelace and native tokens were spent
(optional) check transactions in db-sync
- cardano_node_tests.tests.tests_plutus.test_spend_raw.payment_addrs(cluster_manager: ClusterManager, cluster: ClusterLib) List[AddressRecord] [source]
Create new payment addresses.
- cardano_node_tests.tests.tests_plutus.test_spend_raw.pool_users(cluster_manager: ClusterManager, cluster: ClusterLib) List[PoolUser] [source]
Create new pool users.