cardano_node_tests.utils packageο
Submodulesο
cardano_node_tests.utils.artifacts moduleο
Functionality for collecting testing artifacts.
- cardano_node_tests.utils.artifacts.save_cli_coverage(*, cluster_obj: ClusterLib, pytest_config: Config) Path | None[source]ο
Save CLI coverage info.
- cardano_node_tests.utils.artifacts.save_cluster_artifacts(*, save_dir: Path, state_dir: Path) None[source]ο
Save cluster artifacts (logs, certs, etc.).
- cardano_node_tests.utils.artifacts.save_start_script_coverage(*, log_file: Path, pytest_config: Config) Path | None[source]ο
Save info about CLI commands executed by cluster start script.
- Returns:
Path to the saved coverage log file, or None when coverage collection is disabled, the log file doesnβt exist, or the copy failed.
cardano_node_tests.utils.blockers moduleο
Functionality for checking if an issue is blocked and thus blocking a test.
- class cardano_node_tests.utils.blockers.GH(issue: int, repo: str = 'IntersectMBO/cardano-node', fixed_in: str = '', message: str = '')[source]ο
Bases:
objectMethods for working with GitHub issues.
- fixed_in[source]ο
A version of the project where the issue is fixed. On projects other than cardano-node, cardano-cli and cardano-db-sync, it is the cardano-node version into which the fix was integrated.
- finish_test(force_blocked: bool = False) None[source]ο
Fail or Xfail test with GitHub issue reference.
Never returns - the test outcome is always set via pytest.xfail or pytest.fail.
- Parameters:
force_blocked β Treat the issue as blocked without checking its state.
- Raises:
ValueError β If the GitHub issue doesnβt exist or is not accessible. Cannot happen with force_blocked, as the issue state is not checked.
- cardano_node_tests.utils.blockers.finish_test(issues: Collection[GH]) None[source]ο
Fail or Xfail test with references to multiple GitHub issues.
Never returns - the test outcome is always set via pytest.xfail or pytest.fail.
- Parameters:
issues β GitHub issues to report. Must not be empty.
- Raises:
ValueError β If no issues were provided, or if a referenced GitHub issue doesnβt exist or is not accessible.
cardano_node_tests.utils.cluster_nodes moduleο
Functionality for cluster setup and interaction with cluster nodes.
- class cardano_node_tests.utils.cluster_nodes.ClusterEnv(socket_path: pathlib.Path, state_dir: pathlib.Path, work_dir: pathlib.Path, instance_num: int, cluster_era: str, command_era: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.cluster_nodes.ClusterType(*args, **kwargs)[source]ο
Bases:
ProtocolProtocol for cluster types.
- cluster_scripts: ScriptsTypes[source]ο
- create_addrs_data(*, cluster_obj: ClusterLib, destination_dir: str | Path = '.') dict[str, dict[str, Any]][source]ο
Create addresses and their keys for usage in tests.
- get_cluster_obj(*, command_era: str = '') ClusterLib[source]ο
Return instance of ClusterLib (cluster_obj).
- property is_testnet: bool[source]ο
Check if the cluster runs on a long-running public network (preview, mainnet, etc.).
- property testnet_type: str[source]ο
Return testnet type (preview, preprod, etc.).
Returns an empty string on local cluster and βunknownβ when the testnet is not recognized.
- type: ClusterKind[source]ο
- class cardano_node_tests.utils.cluster_nodes.LocalCluster[source]ο
Bases:
ClusterTypeLocal cluster type (full cardano mode).
- create_addrs_data(*, cluster_obj: ClusterLib, destination_dir: str | Path = '.') dict[str, dict[str, Any]][source]ο
Create addresses and their keys for usage in tests.
- class cardano_node_tests.utils.cluster_nodes.ServiceStatus(name: str, status: str, pid: int | None, uptime: str | None, message: str = '')[source]ο
Bases:
object
- class cardano_node_tests.utils.cluster_nodes.TestnetCluster[source]ο
Bases:
ClusterTypeTestnet cluster type (full cardano mode).
- TESTNETS: ClassVar[dict[int, dict]] = {1506203091: {'shelley_start': '2020-07-29T21:44:51Z', 'type': Testnets.mainnet}, 1654041600: {'byron_epochs': 4, 'type': Testnets.preprod}, 1666656000: {'byron_epochs': 0, 'type': Testnets.preview}}[source]ο
- create_addrs_data(*, cluster_obj: ClusterLib, destination_dir: str | Path = '.') dict[str, dict[str, Any]][source]ο
Create addresses and their keys for usage in tests.
- cardano_node_tests.utils.cluster_nodes.get_cardano_node_socket_path(*, instance_num: int, socket_file_name: str = '') Path[source]ο
Return path to socket file in the given cluster instance.
- cardano_node_tests.utils.cluster_nodes.get_cluster_env() ClusterEnv[source]ο
Get cardano cluster environment.
- cardano_node_tests.utils.cluster_nodes.get_cluster_type() ClusterType[source]ο
Return instance of the cluster type indicated by configuration.
- cardano_node_tests.utils.cluster_nodes.get_instance_num() int[source]ο
Get cardano cluster instance number.
- cardano_node_tests.utils.cluster_nodes.load_addrs_data() dict[source]ο
Load data about addresses and their keys for usage in tests.
- cardano_node_tests.utils.cluster_nodes.load_pools_data(*, cluster_obj: ClusterLib) dict[source]ο
Load data for pools existing in the cluster environment.
- cardano_node_tests.utils.cluster_nodes.reload_supervisor_config(*, instance_num: int | None = None, delay: int = 60) None[source]ο
Reload supervisor configuration.
- cardano_node_tests.utils.cluster_nodes.restart_all_nodes(*, instance_num: int | None = None, delay: int = 60) None[source]ο
Restart all Cardano nodes of the running cluster.
- cardano_node_tests.utils.cluster_nodes.restart_nodes(node_names: list[str], *, instance_num: int | None = None, delay: int = 60) None[source]ο
Restart list of Cardano nodes of the running cluster.
- cardano_node_tests.utils.cluster_nodes.run_supervisorctl(args: list[str], *, instance_num: int | None = None, ignore_fail: bool = False) bytes[source]ο
Run supervisorctl command.
- cardano_node_tests.utils.cluster_nodes.services_action(service_names: list[str], *, action: str, instance_num: int | None = None) None[source]ο
Perform action on services on the running cluster.
- cardano_node_tests.utils.cluster_nodes.services_status(service_names: list[str] | None = None, *, instance_num: int | None = None) list[ServiceStatus][source]ο
Return status info for list of services running on the running cluster (all by default).
- cardano_node_tests.utils.cluster_nodes.set_cluster_env(*, instance_num: int, socket_file_name: str = '') None[source]ο
Set env variables for the given cluster instance.
- cardano_node_tests.utils.cluster_nodes.setup_test_addrs(*, cluster_obj: ClusterLib, destination_dir: str | Path = '.') Path[source]ο
Set addresses and their keys up for usage in tests.
- cardano_node_tests.utils.cluster_nodes.start_cluster(cmd: str, args: list[str]) ClusterLib[source]ο
Start cluster.
cardano_node_tests.utils.cluster_scripts moduleο
Functionality for cluster scripts (starting and stopping clusters).
Copying scripts and their configuration, so it can be altered by tests
Setup of scripts and their configuration for starting of multiple cluster instances
- class cardano_node_tests.utils.cluster_scripts.CustomCardonnayScripts(num_pools: int, scripts_dir: Path, ports_base: int)[source]ο
Bases:
LocalScriptsScripts for starting local cluster.
Re-definition of Cardonnay Local Scripts that allows randomly selected localhost addresses.
- class cardano_node_tests.utils.cluster_scripts.LocalScripts(num_pools: int = -1)[source]ο
Bases:
ScriptsTypesScripts for starting local cluster.
- copy_scripts_files(*, destdir: str | Path) StartupFiles[source]ο
Make copy of cluster scripts files located in this repository.
- gen_split_topology_files(*, destdir: str | Path, instance_num: int, offset: int = 0) None[source]ο
Generate topology files for split network.
- class cardano_node_tests.utils.cluster_scripts.ScriptsTypes(*args, **kwargs)[source]ο
Bases:
ProtocolProtocol for scripts of a given cluster instance type.
- copy_scripts_files(*, destdir: str | Path) StartupFiles[source]ο
Make copy of cluster scripts files.
Testnet files and scripts can be copied and modified by tests before using them. E.g. we might want to change KES period, pool cost, etc.
- gen_split_topology_files(*, destdir: str | Path, instance_num: int, offset: int = 0) None[source]ο
Generate topology files for split network.
- class cardano_node_tests.utils.cluster_scripts.StartupFiles(start_script: pathlib.Path, genesis_spec: pathlib.Path, config_glob: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.cluster_scripts.TestnetScripts[source]ο
Bases:
ScriptsTypesScripts for starting a node on testnet.
- TESTNET_GLOBS: ClassVar[tuple[str, ...]] = ('config*.json', 'genesis-*.json', 'topology-*.json', 'checkpoints*.json', '*snapshot*.json', 'dbsync-config.*', 'submit-api-config.*')[source]ο
- copy_scripts_files(*, destdir: str | Path) StartupFiles[source]ο
Make copy of cluster scripts files located in this repository.
- gen_split_topology_files(*, destdir: str | Path, instance_num: int, offset: int = 0) None[source]ο
Generate topology files for split network.
Not supported on testnet, always raises NotImplementedError.
- get_instance_ports(*, instance_num: int) InstancePorts[source]ο
Return ports mapping for given cluster instance.
- prepare_scripts_files(*, destdir: str | Path, instance_num: int, scriptsdir: str | Path | None = None) InstanceFiles[source]ο
Prepare scripts files for starting and stopping cluster instance.
There is just one cluster instance running for a given testnet. We keep the instance_num support anyway, as this makes it possible to run multiple testnets on the same machine.
- cardano_node_tests.utils.cluster_scripts.get_testnet_variant_scriptdir(*, testnet_variant: str) Path | None[source]ο
Get path to testnet variant scripts directory.
cardano_node_tests.utils.clusterlib_utils moduleο
Utilities that extends the functionality of cardano-clusterlib.
- class cardano_node_tests.utils.clusterlib_utils.ChainAccount(reserves: int, treasury: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.clusterlib_utils.NativeTokenRec(token: str, amount: int, issuers_addrs: list[cardano_clusterlib.structs.AddressRecord], token_mint_addr: cardano_clusterlib.structs.AddressRecord, script: pathlib.Path)[source]ο
Bases:
object
- class cardano_node_tests.utils.clusterlib_utils.Token(coin: str, amount: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.clusterlib_utils.TxMetadata(metadata: dict, aux_data: list)[source]ο
Bases:
object
- class cardano_node_tests.utils.clusterlib_utils.UpdateProposal(arg: str, value: Any, name: str = '', check_func: Callable | None = None)[source]ο
Bases:
object
- cardano_node_tests.utils.clusterlib_utils.build_and_submit_tx(*, cluster_obj: ClusterLib, name_template: str, src_address: str, submit_method: str = '', build_method: str = '', txins: list[UTXOData] | tuple[()] = (), txouts: list[TxOut] | tuple[()] = (), readonly_reference_txins: list[UTXOData] | tuple[()] = (), script_txins: list[ScriptTxIn] | tuple[()] = (), return_collateral_txouts: list[TxOut] | tuple[()] = (), total_collateral_amount: int | None = None, mint: list[Mint] | tuple[()] = (), tx_files: TxFiles | None = None, complex_certs: list[ComplexCert] | tuple[()] = (), complex_proposals: list[ComplexProposal] | tuple[()] = (), change_address: str = '', fee_buffer: int | None = None, raw_fee: int | None = None, required_signers: list[str | Path] | list[str] | list[Path] | tuple[()] = (), required_signer_hashes: list[str] | None = None, withdrawals: list[TxOut] | tuple[()] = (), script_withdrawals: list[ScriptWithdrawal] | tuple[()] = (), script_votes: list[ScriptVote] | tuple[()] = (), deposit: int | None = None, current_treasury_value: int | None = None, treasury_donation: int | None = None, invalid_hereafter: int | None = None, invalid_before: int | None = None, witness_override: int | None = None, witness_count_add: int = 0, byron_witness_count: int = 0, reference_script_size: int = 0, script_valid: bool = True, calc_script_cost_file: str | Path | None = None, join_txouts: bool = True, destination_dir: str | Path = '.', cli_asset_balancing: bool | None = None) TxRawOutput[source]ο
Build and submit a transaction.
Use submit_method to switch between cardano-cli transaction submit and submit-api. Use build_method to select one of the cardano-cli transaction build* commands:
build
build_raw
build_estimate
- cardano_node_tests.utils.clusterlib_utils.build_stake_multisig_script(*, cluster_obj: ClusterLib, script_name: str, script_type_arg: str, stake_vkey_files: Iterable[Path], required: int = 0, slot: int = 0, slot_type_arg: str = '') Path[source]ο
Build a stake multi-signature script.
- Parameters:
cluster_obj β An instance of clusterlib.ClusterLib.
script_name β A name of the script.
script_type_arg β A script type, see MultiSigTypeArgs.
stake_vkey_files β A list of paths to stake vkey files.
required β A number of required keys for the βatLeastβ script type (optional).
slot β A slot that sets script validity, depending on value of slot_type_arg (optional).
slot_type_arg β A slot validity type, see MultiSlotTypeArgs (optional).
- Returns:
A path to the script file.
- Return type:
Path
- cardano_node_tests.utils.clusterlib_utils.check_pool_data(*, pool_params: dict, pool_creation_data: PoolData) str[source]ο
Check that actual pool state corresponds with pool creation data.
- cardano_node_tests.utils.clusterlib_utils.check_reference_script_policyid(name_template: str, cluster_obj: ClusterLib, script_file: str | Path, script_data: dict) None[source]ο
Check that the policy ID of a reference script file matches the original script policy ID.
- cardano_node_tests.utils.clusterlib_utils.check_txins_spent(*, cluster_obj: ClusterLib, txins: list[UTXOData], wait_blocks: int = 2) None[source]ο
Check that txins were spent.
- cardano_node_tests.utils.clusterlib_utils.check_updated_params(*, update_proposals: list[UpdateProposal], protocol_params: dict) None[source]ο
Compare update proposals with actual protocol parameters.
- cardano_node_tests.utils.clusterlib_utils.cli_has(command: str) bool[source]ο
Check if a cardano-cli subcommand or argument is available.
E.g. cli_has(βquery leadership-schedule βnextβ)
- cardano_node_tests.utils.clusterlib_utils.create_collaterals(*, cluster: ClusterLib, payment_addr: AddressRecord, temp_template: str, tx_outs: list[TxOut]) list[UTXOData][source]ο
Create collateral UTxOs as required.
- cardano_node_tests.utils.clusterlib_utils.create_payment_addr_records(*names: str, cluster_obj: ClusterLib, stake_vkey_file: str | Path | None = None, key_gen_method: KeyGenMethods = KeyGenMethods.DIRECT, destination_dir: str | Path = '.') list[AddressRecord][source]ο
Create new payment address(es).
- cardano_node_tests.utils.clusterlib_utils.create_pool_users(*, cluster_obj: ClusterLib, name_template: str, no_of_addr: int = 1, payment_key_gen_method: KeyGenMethods = KeyGenMethods.DIRECT, destination_dir: str | Path = '.') list[PoolUser][source]ο
Create PoolUsers.
- cardano_node_tests.utils.clusterlib_utils.create_reference_utxo(*, temp_template: str, cluster_obj: ClusterLib, payment_addr: AddressRecord, dst_addr: AddressRecord, script_file: Path, amount: int) tuple[UTXOData, TxRawOutput][source]ο
Create a reference script UTxO.
- cardano_node_tests.utils.clusterlib_utils.create_stake_addr_records(*names: str, cluster_obj: ClusterLib, destination_dir: str | Path = '.') list[AddressRecord][source]ο
Create new stake address(es).
- cardano_node_tests.utils.clusterlib_utils.datum_hash_from_txout(*, cluster_obj: ClusterLib, txout: TxOut) str[source]ο
Return datum hash from clusterlib.TxOut.
- cardano_node_tests.utils.clusterlib_utils.deregister_stake_address(*, cluster_obj: ClusterLib, pool_user: PoolUser, name_template: str, deposit_amt: int = -1) TxRawOutput | None[source]ο
Deregister stake address.
- cardano_node_tests.utils.clusterlib_utils.gen_byron_addr(*, cluster_obj: ClusterLib, name_template: str, destination_dir: str | Path = '.') AddressRecord[source]ο
Generate a Byron address and keys.
- cardano_node_tests.utils.clusterlib_utils.gen_payment_addr_and_keys_from_mnemonic(*, name: str, cluster_obj: ClusterLib, size: Literal[12, 15, 18, 21, 24] = 24, stake_vkey_file: str | Path | None = None, stake_script_file: str | Path | None = None, destination_dir: str | Path = '.') AddressRecord[source]ο
Generate payment address and key pair.
- Parameters:
cluster_obj β An instance of clusterlib.ClusterLib.
size β Number of words in the mnemonic (12, 15, 18, 21, or 24).
name β A name of the address and key pair.
stake_vkey_file β A path to corresponding stake vkey file (optional).
stake_script_file β A path to corresponding payment script file (optional).
destination_dir β A path to directory for storing artifacts (optional).
- Returns:
- A data container containing the address and
key pair / script file.
- Return type:
clusterlib.AddressRecord
- cardano_node_tests.utils.clusterlib_utils.get_blocks_before(*, cluster_obj: ClusterLib) dict[str, int][source]ο
Get blocksBefore section of ledger state with bech32 encoded pool ids.
- cardano_node_tests.utils.clusterlib_utils.get_chain_account_state(*, ledger_state: dict) ChainAccount[source]ο
Get chain account state from ledger state dict.
- cardano_node_tests.utils.clusterlib_utils.get_delegation_state(*, cluster_obj: ClusterLib) dict[source]ο
Get delegationState section of ledger state.
- cardano_node_tests.utils.clusterlib_utils.get_just_lovelace_utxos(*, address_utxos: list[UTXOData]) list[UTXOData][source]ο
Get UTxOs with just Lovelace.
- cardano_node_tests.utils.clusterlib_utils.get_ledger_state(*, cluster_obj: ClusterLib) dict[source]ο
Return the current ledger state info.
- cardano_node_tests.utils.clusterlib_utils.get_plutus_b64(*, script_file: str | Path) str[source]ο
Get base64 encoded binary version of Plutus script from file.
- cardano_node_tests.utils.clusterlib_utils.get_pparams_update_args(*, update_proposals: list[UpdateProposal]) list[str][source]ο
Get cli arguments for pparams update action.
- cardano_node_tests.utils.clusterlib_utils.get_protocol_version(cluster_obj: ClusterLib) int[source]ο
Get the protocol version major number.
- cardano_node_tests.utils.clusterlib_utils.get_reference_script_size(*, script_file: str | Path) int[source]ο
Get the size of a script as it is accounted for when used as a reference script.
Since Conway, the ledger charges minFeeRefScriptCostPerByte for every byte of every reference script a transaction pulls in, be it through a reference input or through a spent UTxO that holds the script. The size is the size of the script as serialized by the ledger, which is the bare script for Plutus scripts and the CBOR encoded structure for simple scripts.
- Parameters:
script_file β A path to the script file.
- Returns:
A size of the reference script in bytes.
- Return type:
int
- cardano_node_tests.utils.clusterlib_utils.get_script_data_policyid(*, cluster_obj: ClusterLib, script_name: str, script_data: dict) str[source]ο
Get hash of the script data.
- cardano_node_tests.utils.clusterlib_utils.get_snapshot_delegations(*, ledger_snapshot: dict) dict[str, list[str]][source]ο
Get delegations data from ledger state snapshot.
- cardano_node_tests.utils.clusterlib_utils.get_snapshot_rec(*, ledger_snapshot: dict) dict[str, int | list][source]ο
Get uniform record for ledger state snapshot.
- cardano_node_tests.utils.clusterlib_utils.get_stability_window(*, cluster_obj: ClusterLib) int[source]ο
Return the stability window (3k/f) in slots.
Rounded down, so that the result is never above the window the ledger itself uses. A caller that uses it as a limit therefore stays inside the window. The division is exact on every testnet variant, so the rounding only guards against a variant that picks a securityParam and activeSlotsCoeff that donβt divide.
- Parameters:
cluster_obj β An instance of clusterlib.ClusterLib.
- Returns:
The number of slots in the stability window.
- Return type:
int
- cardano_node_tests.utils.clusterlib_utils.get_stake_rec(*, stake_snapshot: dict) dict[source]ο
Get uniform record for stake key snapshot.
- cardano_node_tests.utils.clusterlib_utils.get_utxo_ix_offset(*, utxos: list[UTXOData], txouts: list[TxOut]) int[source]ο
Get offset of index of the first user-defined txout.
Change txout created by transaction build used to be UTxO with index 0, now it is the last UTxO. This function exists for backwards compatibility with the old behavior.
- cardano_node_tests.utils.clusterlib_utils.load_body_metadata(*, tx_body_file: Path) Any[source]ο
Load metadata from file containing transaction body.
- cardano_node_tests.utils.clusterlib_utils.load_registered_pool_data(*, cluster_obj: ClusterLib, pool_name: str, pool_id: str) PoolData[source]ο
Load data of existing registered pool.
- cardano_node_tests.utils.clusterlib_utils.load_tx_metadata(*, tx_body_file: Path) TxMetadata[source]ο
Load transaction metadata from file containing transaction body.
- cardano_node_tests.utils.clusterlib_utils.mint_or_burn_sign(*, cluster_obj: ClusterLib, new_tokens: list[NativeTokenRec], temp_template: str, submit_method: str = SubmitMethods.CLI, build_method: str = BuildMethods.BUILD_RAW, sign_incrementally: bool = False) TxRawOutput[source]ο
Mint or burn tokens, depending on the amount value. Sign using skeys.
Positive amount value means minting, negative means burning.
- cardano_node_tests.utils.clusterlib_utils.mint_or_burn_witness(*, cluster_obj: ClusterLib, new_tokens: list[NativeTokenRec], temp_template: str, invalid_hereafter: int | None = None, invalid_before: int | None = None, submit_method: str = SubmitMethods.CLI, build_method: str = BuildMethods.BUILD_RAW, sign_incrementally: bool = False) TxRawOutput[source]ο
Mint or burn tokens, depending on the amount value. Sign using witnesses.
Positive amount value means minting, negative means burning.
- cardano_node_tests.utils.clusterlib_utils.new_tokens(*asset_names: str, cluster_obj: ClusterLib, temp_template: str, token_mint_addr: AddressRecord, issuer_addr: AddressRecord, amount: int) list[NativeTokenRec][source]ο
Mint new token, sign using skeys.
- cardano_node_tests.utils.clusterlib_utils.register_stake_address(*, cluster_obj: ClusterLib, pool_user: PoolUser, name_template: str, deposit_amt: int = -1) TxRawOutput[source]ο
Register stake address.
- cardano_node_tests.utils.clusterlib_utils.save_ledger_state(*, cluster_obj: ClusterLib, state_name: str, ledger_state: dict | None = None, destination_dir: str | Path = '.') Path[source]ο
Save ledger state to file.
- Parameters:
cluster_obj β An instance of clusterlib.ClusterLib.
state_name β A name of the ledger state (can be epoch number, etc.).
ledger_state β A dict with ledger state to save (optional).
destination_dir β A path to directory for storing the state JSON file (optional).
- Returns:
A path to the generated state JSON file.
- Return type:
Path
- cardano_node_tests.utils.clusterlib_utils.wait_for_epoch_interval(*, cluster_obj: ClusterLib, start: int, stop: int, force_epoch: bool = False, check_slot: bool = False) None[source]ο
Wait for time interval within an epoch.
- Parameters:
cluster_obj β An instance of clusterlib.ClusterLib.
start β A start of the interval, in seconds. Negative number for counting from the end of an epoch.
stop β An end of the interval, in seconds. Negative number for counting from the end of an epoch.
force_epoch β A bool indicating whether the interval must be in current epoch (False by default).
check_slot β A bool indicating whether to check if slot number matches time interval after waiting (False by default).
- cardano_node_tests.utils.clusterlib_utils.wait_for_rewards(*, cluster_obj: ClusterLib) None[source]ο
Wait until 4th epoch, if necessary, for first reward distribution.
- cardano_node_tests.utils.clusterlib_utils.withdraw_reward_w_build(*, cluster_obj: ClusterLib, stake_addr_record: AddressRecord, dst_addr_record: AddressRecord, tx_name: str, verify: bool = True, destination_dir: str | Path = '.') TxRawOutput[source]ο
Withdraw reward to payment address.
- Parameters:
cluster_obj β An instance of clusterlib.ClusterLib.
stake_addr_record β An AddressRecord tuple for the stake address with reward.
dst_addr_record β An AddressRecord tuple for the destination payment address.
tx_name β A name of the transaction.
verify β A bool indicating whether to verify that the reward was transferred correctly.
destination_dir β A path to directory for storing artifacts (optional).
cardano_node_tests.utils.configuration moduleο
Cluster and test environment configuration.
cardano_node_tests.utils.custom_clusterlib moduleο
Custom ClusterLib extended with functionality that is useful for testing.
- class cardano_node_tests.utils.custom_clusterlib.ClusterLib(state_dir: str | Path, slots_offset: int | None = None, socket_path: str | Path = '', command_era: str = 'latest')[source]ο
Bases:
ClusterLib- cli(cli_args: list[str], timeout: float | None = None, add_default_args: bool = True) CLIOut[source]ο
Run the cardano-cli command.
- Parameters:
cli_args β A list of arguments for cardano-cli.
timeout β A timeout for the command, in seconds (optional).
add_default_args β Whether to add default arguments to the command (optional).
- Returns:
A data container containing command stdout and stderr.
- Return type:
clusterlib.CLIOut
- class cardano_node_tests.utils.custom_clusterlib.TransactionGroup(clusterlib_obj: itp.ClusterLib)[source]ο
Bases:
TransactionGroup
cardano_node_tests.utils.dbsync_check_tx moduleο
Function for checking a transaction in db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check a transaction in db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_collaterals(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx collaterals match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_datum(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx datum match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_fee(*, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx fee matches the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_ins(*, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx inputs match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_mint(*, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx minting matches the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_outs(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx outputs match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_reference_inputs(*, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx reference inputs match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_reference_scripts(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that reference scripts in Tx inputs match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_required_signers(*, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx required signers match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_scripts(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx script hashes match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_validity(*, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx validity interval match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.check_tx_withdrawals(*, tx_raw_output: TxRawOutput, response: TxRecord) None[source]ο
Check that the Tx withdrawals match the data from db-sync.
- cardano_node_tests.utils.dbsync_check_tx.utxodata2txout(*, utxodata: UTxORecord | UTXOData) TxOut[source]ο
Convert UTxORecord or UTxOData to clusterlib.TxOut.
- cardano_node_tests.utils.dbsync_check_tx.utxorecord2utxodata(utxorecord: UTxORecord) UTXOData[source]ο
Convert UTxORecord to clusterlib.UTXOData.
cardano_node_tests.utils.dbsync_conn moduleο
Functionality for interacting with db-sync database in postgres.
cardano_node_tests.utils.dbsync_queries moduleο
SQL queries to db-sync database.
- class cardano_node_tests.utils.dbsync_queries.ADAPotsDBRow(id: int, slot_no: int, epoch_no: int, treasury: Decimal, reserves: Decimal, rewards: Decimal, utxo: Decimal, deposits_stake: Decimal, deposits_drep: Decimal, deposits_proposal: Decimal, fees: Decimal, block_id: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.ADAStashDBRow(id: int, addr_view: str, cert_index: int, amount: Decimal, tx_id: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.BlockDBRow(id: int, epoch_no: int | None, slot_no: int | None, epoch_slot_no: int | None, block_no: int | None, previous_id: int | None, tx_count: int | None, proto_major: int | None, proto_minor: int | None, pool_id: str | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.CollateralTxOutDBRow(tx_out_id: int, utxo_ix: int, address: str, value: Decimal, tx_hash: memoryview)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.CommitteeDeregistrationDBRow(id: int, tx_id: int, cert_index: int, voting_anchor_id: int, cold_key: memoryview)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.CommitteeRegistrationDBRow(id: int, tx_id: int, cert_index: int, cold_key: memoryview, hot_key: memoryview)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.DatumDBRow(id: int, datum_hash: memoryview, tx_id: int, value: dict, bytes: memoryview)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.DelegationVoteDBRow(id: int, stake_address_hash_view: str, drep_hash_view: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.DrepDistributionDBRow(id: int, hash_id: int, amount: int, epoch_no: int, drep_hash_view: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.DrepRegistrationDBRow(id: int, tx_id: int, cert_index: int, deposit: int, drep_hash_id: int, voting_anchor_id: int | None, hash_raw: memoryview, hash_view: str, has_script: bool)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.EpochDBRow(id: int, out_sum: int, fees: int, tx_count: int, blk_count: int, epoch_number: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.EpochParamDBRow(id: int, epoch_no: int, min_fee_a: int, min_fee_b: int, max_block_size: int, max_tx_size: int, max_bh_size: int, key_deposit: int, pool_deposit: int, max_epoch: int, optimal_pool_count: int, influence: float, monetary_expand_rate: float, treasury_growth_rate: float, decentralisation: float, protocol_major: int, protocol_minor: int, min_utxo_value: int, min_pool_cost: int, nonce: memoryview, cost_model_id: int, price_mem: float, price_step: float, max_tx_ex_mem: int, max_tx_ex_steps: int, max_block_ex_mem: int, max_block_ex_steps: int, max_val_size: int, collateral_percent: int, max_collateral_inputs: int, block_id: int, extra_entropy: memoryview | None, coins_per_utxo_size: int, pvt_motion_no_confidence: float, pvt_committee_normal: float, pvt_committee_no_confidence: float, pvt_hard_fork_initiation: float, dvt_motion_no_confidence: float, dvt_committee_normal: float, dvt_committee_no_confidence: float, dvt_update_to_constitution: float, dvt_hard_fork_initiation: float, dvt_p_p_network_group: float, dvt_p_p_economic_group: float, dvt_p_p_technical_group: float, dvt_p_p_gov_group: float, dvt_treasury_withdrawal: float, committee_min_size: int, committee_max_term_length: int, gov_action_lifetime: int, gov_action_deposit: int, drep_deposit: int, drep_activity: int, pvtpp_security_group: float, min_fee_ref_script_cost_per_byte: float)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.EpochStakeDBRow(id: int, hash: memoryview, view: str, amount: int, epoch_number: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.EpochStateDBRow(id: int, committee_id: int, no_confidence_id: int | None, constitution_id: int, epoch_no: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.GovActionProposalDBRow(id: int, tx_id: int, action_ix: int, prev_gov_action_proposal: int | None, deposit: int, return_address: int, expiration: int, voting_anchor_id: int, type: str, description: dict, param_proposal: int | None, ratified_epoch: int | None, enacted_epoch: int | None, dropped_epoch: int | None, expired_epoch: int | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.MetadataDBRow(id: int, key: Decimal, json: Any, bytes: memoryview, tx_id: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.NewCommitteeInfoDBRow(id: int, tx_id: int, action_ix: int, quorum_numerator: int, quorum_denominator: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.NewCommitteeMemberDBRow(id: int, committee_id: int, committee_hash: memoryview, expiration_epoch: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.NewConstitutionInfoDBRow(id: int, script_hash: memoryview | None, gov_action_type: str, gap_id: int, tx_id: int, action_ix: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.OffChainVoteDataDBRow(data_id: int, data_vot_anchor_id: int, data_hash: memoryview, data_json: dict, data_bytes: memoryview, data_warning: str | None, data_language: str, data_comment: str | None, data_is_valid: bool | None, auth_name: str | None, auth_wit_alg: str | None, auth_pub_key: str | None, auth_signature: str | None, auth_warning: str | None, ext_update_id: int | None, ext_update_title: str | None, ext_update_uri: str | None, gov_act_id: int | None, gov_act_title: str | None, gov_act_abstract: str | None, gov_act_motivation: str | None, gov_act_rationale: str | None, ref_id: int | None, ref_label: str | None, ref_uri: str | None, ref_hash_digest: str | None, ref_hash_alg: str | None, vot_anchor_url: str, vot_anchor_data_hash: memoryview, vot_anchor_type: str, vot_anchor_block_id: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.OffChainVoteDrepDataDBRow(id: int, hash: memoryview, language: str, comment: str | None, json: dict, bytes: memoryview, warning: str | None, is_valid: bool | None, payment_address: str, given_name: str, objectives: str, motivations: str, qualifications: str, image_url: str, image_hash: str | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.OffChainVoteFetchErrorDBRow(id: int, voting_anchor_id: int, fetch_error: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.ParamProposalDBRow(id: int, epoch_no: int | None, key: memoryview | None, min_fee_a: int | None, min_fee_b: int | None, max_block_size: int | None, max_tx_size: int | None, max_bh_size: int | None, key_deposit: int | None, pool_deposit: int | None, max_epoch: int | None, optimal_pool_count: int | None, influence: float | None, monetary_expand_rate: float | None, treasury_growth_rate: float | None, decentralisation: float | None, entropy: memoryview | None, protocol_major: int | None, protocol_minor: int | None, min_utxo_value: int | None, min_pool_cost: int | None, coins_per_utxo_size: int | None, cost_model_id: int | None, price_mem: float | None, price_step: float | None, max_tx_ex_mem: int | None, max_tx_ex_steps: int | None, max_block_ex_mem: int | None, max_block_ex_steps: int | None, max_val_size: int | None, collateral_percent: int | None, max_collateral_inputs: int | None, registered_tx_id: int | None, pvt_motion_no_confidence: float | None, pvt_committee_normal: float | None, pvt_committee_no_confidence: float | None, pvt_hard_fork_initiation: float | None, dvt_motion_no_confidence: float | None, dvt_committee_normal: float | None, dvt_committee_no_confidence: float | None, dvt_update_to_constitution: float | None, dvt_hard_fork_initiation: float | None, dvt_p_p_network_group: float | None, dvt_p_p_economic_group: float | None, dvt_p_p_technical_group: float | None, dvt_p_p_gov_group: float | None, dvt_treasury_withdrawal: float | None, committee_min_size: int | None, committee_max_term_length: int | None, gov_action_lifetime: int | None, gov_action_deposit: int | None, drep_deposit: int | None, drep_activity: Decimal | None, pvtpp_security_group: float | None, min_fee_ref_script_cost_per_byte: float | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.PoolDataDBRow(id: int, hash: memoryview, view: str, cert_index: int, vrf_key_hash: memoryview, pledge: int, reward_addr: memoryview, reward_addr_view: str, active_epoch_no: int, meta_id: int | None, margin: Decimal, fixed_cost: int, deposit: Decimal | None, registered_tx_id: int, metadata_url: str | None, metadata_hash: memoryview | None, owner_stake_address_id: int, owner: memoryview, ipv4: str | None, ipv6: str | None, dns_name: str | None, port: int | None, retire_cert_index: int | None, retire_announced_tx_id: int | None, retiring_epoch: int | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.PoolOffChainDataDBRow(id: int, ticker_name: str, hash: memoryview, json: dict, bytes: memoryview, pmr_id: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.PoolOffChainFetchErrorDBRow(id: int, pmr_id: int, fetch_error: str, retry_count: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.PotTransferDBRow(id: int, cert_index: int, treasury: Decimal, reserves: Decimal, tx_id: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.RedeemerDBRow(id: int, tx_id: int, unit_mem: int, unit_steps: int, fee: int, purpose: str, script_hash: memoryview, value: dict)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.RewardDBRow(address: str, type: str, amount: Decimal, earned_epoch: int, spendable_epoch: int, pool_id: str | None = '')[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.SchemaVersion[source]ο
Bases:
objectQuery and cache db-sync schema version.
- classmethod stages() SchemaVersionStages[source]ο
- class cardano_node_tests.utils.dbsync_queries.SchemaVersionStages(one: int, two: int, three: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.ScriptDBRow(id: int, tx_id: int, hash: memoryview, type: str, serialised_size: int | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.StakeAddrDBRow(id: int, view: str, tx_id: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.StakeDelegDBRow(tx_id: int, active_epoch_no: int | None, pool_id: str | None, address: str | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.TreasuryWithdrawalDBRow(id: int, tx_id: int, action_ix: int, expiration: int, ratified_epoch: int | None, enacted_epoch: int | None, dropped_epoch: int | None, expired_epoch: int | None, addr_view: str, amount: Decimal)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.TxDBRow(tx_id: int, tx_hash: memoryview, block_id: int, block_index: int, out_sum: Decimal, fee: Decimal, deposit: int, size: int, invalid_before: Decimal | None, invalid_hereafter: Decimal | None, treasury_donation: int, tx_out_id: int | None, tx_out_tx_id: int | None, utxo_ix: int | None, tx_out_addr: str | None, tx_out_addr_has_script: bool | None, tx_out_value: Decimal | None, tx_out_data_hash: memoryview | None, tx_out_inline_datum_hash: memoryview | None, tx_out_reference_script_hash: memoryview | None, metadata_count: int, reserve_count: int, treasury_count: int, pot_transfer_count: int, stake_reg_count: int, stake_dereg_count: int, stake_deleg_count: int, withdrawal_count: int, collateral_count: int, reference_input_count: int, collateral_out_count: int, script_count: int, redeemer_count: int, extra_key_witness_count: int, ma_tx_out_id: int | None, ma_tx_out_policy: memoryview | None, ma_tx_out_name: memoryview | None, ma_tx_out_quantity: Decimal | None, ma_tx_mint_id: int | None, ma_tx_mint_policy: memoryview | None, ma_tx_mint_name: memoryview | None, ma_tx_mint_quantity: Decimal | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.TxInDBRow(tx_out_id: int, utxo_ix: int, address: str, value: Decimal, tx_hash: memoryview, reference_script_hash: memoryview | None, reference_script_json: dict | None, reference_script_bytes: memoryview | None, reference_script_type: str | None, ma_tx_out_id: int | None, ma_tx_out_policy: memoryview | None, ma_tx_out_name: memoryview | None, ma_tx_out_quantity: Decimal | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.TxInNoMADBRow(tx_out_id: int, utxo_ix: int, address: str, value: Decimal, tx_hash: memoryview, reference_script_hash: memoryview | None, reference_script_json: dict | None, reference_script_bytes: memoryview | None, reference_script_type: str | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.UTxODBRow(tx_hash: memoryview, utxo_ix: int, payment_address: str, stake_address: str | None, has_script: bool, value: int, data_hash: memoryview | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.VotingProcedureDBRow(id: int, voter_role: str, committee_voter: int | None, drep_voter: int | None, pool_voter: int | None, vote: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_queries.WithdrawalDBRow(tx_id: int, address: str, amount: int)[source]ο
Bases:
object
- cardano_node_tests.utils.dbsync_queries.db_transaction() Iterator[None][source]ο
Transaction manager that works with connection pool.
- cardano_node_tests.utils.dbsync_queries.delete_reserved_pool_tickers() int[source]ο
Delete all records from reserved_pool_ticker and return the number of affected rows.
- cardano_node_tests.utils.dbsync_queries.execute(*, query: str, vars: Sequence = ()) Iterator[cursor][source]ο
- cardano_node_tests.utils.dbsync_queries.query_ada_pots(*, epoch_from: int = 0, epoch_to: int = 99999999) Generator[ADAPotsDBRow, None, None][source]ο
Query ADA pots record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_address_reward(*, address: str, epoch_from: int = 0, epoch_to: int = 99999999) Generator[RewardDBRow, None, None][source]ο
Query reward records for stake address in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_address_reward_rest(*, address: str, epoch_from: int = 0, epoch_to: int = 99999999) Generator[RewardDBRow, None, None][source]ο
Query instant reward records for stake address in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_blocks(*, pool_id_bech32: str = '', epoch_from: int = 0, epoch_to: int = 99999999) Generator[BlockDBRow, None, None][source]ο
Query block records in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_collateral_tx_ins(*, txhash: str) Generator[TxInNoMADBRow, None, None][source]ο
Query transaction collateral txins in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_collateral_tx_outs(*, txhash: str) Generator[CollateralTxOutDBRow, None, None][source]ο
Query transaction collateral txouts in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_committee_deregistration(*, cold_key: str) Generator[CommitteeDeregistrationDBRow, None, None][source]ο
Query committee registration in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_committee_members(*, committee_id: int) Generator[NewCommitteeMemberDBRow, None, None][source]ο
Query committee members in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_committee_registration(*, cold_key: str) Generator[CommitteeRegistrationDBRow, None, None][source]ο
Query committee registration in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_cost_model(*, model_id: int = -1, epoch_no: int = -1) dict[str, dict[str, Any]][source]ο
Query cost model record in db-sync.
If model_id is specified, query the cost model that corresponds to the given id. If epoch_no is specified, query the cost model used in the given epoch. Otherwise query the latest cost model.
- cardano_node_tests.utils.dbsync_queries.query_datum(*, datum_hash: str) Generator[DatumDBRow, None, None][source]ο
Query datum record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_db_size() int[source]ο
Query database size in MB in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_db_sync_progress() float | None[source]ο
Calculate blockchain sync percentage (0-100).
- Returns:
Sync percentage (0-100), or None when there are no blocks in the database.
- cardano_node_tests.utils.dbsync_queries.query_delegation_vote(*, txhash: str) Generator[DelegationVoteDBRow, None, None][source]ο
Query delegation_vote table in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_drep_distr(*, drep_hash: str, epoch_no: int) Generator[DrepDistributionDBRow, None, None][source]ο
Query drep voting power in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_drep_registration(*, drep_hash: str, drep_deposit: int = 2000000) Generator[DrepRegistrationDBRow, None, None][source]ο
Query drep registration in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_epoch(*, epoch_from: int = 0, epoch_to: int = 99999999) Generator[EpochDBRow, None, None][source]ο
Query epoch records in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_epoch_current(*, epoch_from: int = 0, epoch_to: int = 99999999) Generator[EpochDBRow, None, None][source]ο
Query the live epoch_current view in db-sync (since db-sync 13.7.2).
Unlike the public epoch view (finalized rows UNION the live aggregation), this reads the in-progress current-epoch branch directly. It is empty unless live epoch sync is enabled (see query_epoch_sync_enabled).
- cardano_node_tests.utils.dbsync_queries.query_epoch_param(*, epoch_no: int = 0) EpochParamDBRow[source]ο
Query epoch param record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_epoch_stake(*, pool_id_bech32: str, epoch_number: int) Generator[EpochStakeDBRow, None, None][source]ο
Query epoch stake record for a pool in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_epoch_state(*, epoch_no: int) Generator[EpochStateDBRow, None, None][source]ο
Query epoch_state table in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_epoch_sync_enabled() bool[source]ο
Query whether live epoch sync is enabled in db-sync (since db-sync 13.7.2).
When disabled, both the epoch_current and epoch views return no rows by design.
- cardano_node_tests.utils.dbsync_queries.query_extra_key_witness(*, txhash: str) Generator[memoryview, None, None][source]ο
Query extra key witness records in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_gov_action_proposal(*, txhash: str = '', type: str = '') Generator[GovActionProposalDBRow, None, None][source]ο
Query gov_action_proposal table in db-sync.
If type is provided txhash will be ignored.
- cardano_node_tests.utils.dbsync_queries.query_new_committee_info(*, txhash: str) Generator[NewCommitteeInfoDBRow, None, None][source]ο
Query new committee proposed in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_new_constitution(*, txhash: str) Generator[NewConstitutionInfoDBRow, None, None][source]ο
Query new constitution proposed in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_off_chain_pool_data(*, pool_id_bech32: str) Generator[PoolOffChainDataDBRow, None, None][source]ο
Query Off_Chain_Pool_Data record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_off_chain_pool_fetch_error(*, pool_id_bech32: str) Generator[PoolOffChainFetchErrorDBRow, None, None][source]ο
Query Off_Chain_Pool_Fetch_Error record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_off_chain_vote_data(*, data_hash: str) Generator[OffChainVoteDataDBRow, None, None][source]ο
Query the off chain vote data in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_off_chain_vote_drep_data(*, voting_anchor_id: int) Generator[OffChainVoteDrepDataDBRow, None, None][source]ο
Query off_chain_vote_drep_data table in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_off_chain_vote_fetch_error(*, voting_anchor_id: int) Generator[OffChainVoteFetchErrorDBRow, None, None][source]ο
Query off_chain_vote_fetch_error table in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_param_proposal(*, txhash: str = '') ParamProposalDBRow[source]ο
Query param proposal record in db-sync.
If txhash is not provided the query will return the last record available.
- cardano_node_tests.utils.dbsync_queries.query_pool_data(*, pool_id_bech32: str) Generator[PoolDataDBRow, None, None][source]ο
Query pool data record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_redeemers(*, txhash: str) Generator[RedeemerDBRow, None, None][source]ο
Query transaction redeemers in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_reference_tx_ins(*, txhash: str) Generator[TxInNoMADBRow, None, None][source]ο
Query transaction reference txins in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_rows_count(*, table: str, column: str | None = None, condition: str | None = None, lock: bool = False, lock_timeout: str = '5s') int[source]ο
Query row count with optional table locking for atomic snapshots.
- Parameters:
table β Table name
column β Column name (optional)
condition β SQL condition (required if column is provided)
lock β Whether to lock table during query
lock_timeout β PostgreSQL timeout string (e.g., β5sβ, β1minβ)
- Returns:
Count of matching rows (0 if none match or table is empty)
- Raises:
ValueError β For invalid inputs
RuntimeError β If lock times out
- cardano_node_tests.utils.dbsync_queries.query_scripts(*, txhash: str) Generator[ScriptDBRow, None, None][source]ο
Query transaction scripts in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_table_names() list[str][source]ο
Query table names in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_treasury_withdrawal(*, txhash: str) Generator[TreasuryWithdrawalDBRow, None, None][source]ο
Query treasury_withdrawal table in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx(*, txhash: str) Generator[TxDBRow, None, None][source]ο
Query a transaction in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_ins(*, txhash: str) Generator[TxInDBRow, None, None][source]ο
Query transaction txins in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_metadata(*, txhash: str) Generator[MetadataDBRow, None, None][source]ο
Query transaction metadata in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_pot_transfers(*, txhash: str) Generator[PotTransferDBRow, None, None][source]ο
Query transaction MIR certificate records in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_reserve(*, txhash: str) Generator[ADAStashDBRow, None, None][source]ο
Query transaction reserve record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_stake_deleg(*, txhash: str) Generator[StakeDelegDBRow, None, None][source]ο
Query stake registration record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_stake_dereg(*, txhash: str) Generator[StakeAddrDBRow, None, None][source]ο
Query stake deregistration record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_stake_reg(*, txhash: str) Generator[StakeAddrDBRow, None, None][source]ο
Query stake registration record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_treasury(*, txhash: str) Generator[ADAStashDBRow, None, None][source]ο
Query transaction treasury record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_tx_withdrawal(*, txhash: str) Generator[WithdrawalDBRow, None, None][source]ο
Query reward withdrawal record in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_utxo(*, address: str) Generator[UTxODBRow, None, None][source]ο
Query UTxOs for payment address in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_view_names() list[str][source]ο
Query view names in db-sync.
- cardano_node_tests.utils.dbsync_queries.query_voting_procedure(*, txhash: str) Generator[VotingProcedureDBRow, None, None][source]ο
Query voting_procedure table in db-sync.
cardano_node_tests.utils.dbsync_service_manager moduleο
Functionality for managing db-sync service.
- class cardano_node_tests.utils.dbsync_service_manager.DBSyncConfigBuilder[source]ο
Bases:
object- with_governance(*, value: SettingState) Self[source]ο
- with_ledger(*, value: LedgerMode) Self[source]ο
- with_offchain_pool_data(*, value: SettingState) Self[source]ο
- with_pool_stat(*, value: SettingState) Self[source]ο
- with_remove_jsonb_from_schema(*, value: SettingState) Self[source]ο
- with_tx_cbor(*, value: SettingState) Self[source]ο
- class cardano_node_tests.utils.dbsync_service_manager.DBSyncManager[source]ο
Bases:
object- get_config_builder() DBSyncConfigBuilder[source]ο
Get a fresh DBSyncConfigBuilder config builder instance with default config.
- is_db_sync_running() bool[source]ο
Check if the cardano-db-sync service is actively running.
- Returns:
True if the service is running and executable, False otherwise.
- Return type:
bool
- recreate_database() None[source]ο
Reinitializes the PostgreSQL database by running the postgres-setup.sh script.
Warning
This is a DESTRUCTIVE operation! It will delete existing data and recreate the database from scratch.
- restart_with_config(*, custom_config: dict | DBSyncConfigBuilder | None = None) Path[source]ο
Restart cardano-db-sync with a new configuration, ensuring atomic updates.
- Steps:
Stops the service.
Recreates the database.
Applies the new config.
Restarts the service and waits for sync completion.
- Parameters:
custom_config β Either a config dict or DBSyncConfigBuilder instance.
- Returns:
Path to the updated config file.
- update_config(*, config: dict | DBSyncConfigBuilder | None) Path[source]ο
Update the dbsync-config.yaml file with new settings.
- Parameters:
config β Config dict or DBSyncConfigBuilder instance.
- Returns:
Path to the modified config file.
- class cardano_node_tests.utils.dbsync_service_manager.MetadataConfig(enable: bool = True, keys: list[int] | None = None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_service_manager.MultiAssetConfig(enable: bool = True)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_service_manager.PlutusConfig(enable: bool = True)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_service_manager.SettingState(*values)[source]ο
Bases:
StrEnum
- class cardano_node_tests.utils.dbsync_service_manager.ShelleyConfig(enable: bool = True)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_service_manager.Table(*values)[source]ο
Bases:
StrEnumEnum representing all tables in the Cardano db-sync database.
- class cardano_node_tests.utils.dbsync_service_manager.TxOutConfig(value: cardano_node_tests.utils.dbsync_service_manager.TxOutMode = <TxOutMode.ENABLE: 'enable'>, force_tx_in: bool | None = None, use_address_table: bool | None = None)[source]ο
Bases:
object
cardano_node_tests.utils.dbsync_snapshot_service moduleο
- class cardano_node_tests.utils.dbsync_snapshot_service.DBSyncSnapshotService[source]ο
Bases:
objectService class to interact with DB-Sync S3 Snapshots repository.
- get_latest_snapshot(version: str) SnapshotFile[source]ο
Find the latest snapshot file for a given version.
cardano_node_tests.utils.dbsync_types moduleο
Types used in db-sync related functions.
- class cardano_node_tests.utils.dbsync_types.ADAStashRecord(address: str, cert_index: int, amount: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.CommitteeDeregistrationRecord(id: int, tx_id: int, cert_index: int, voting_anchor_id: int, cold_key: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.CommitteeRegistrationRecord(id: int, tx_id: int, cert_index: int, cold_key: str, hot_key: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.DelegationRecord(address: str, pool_id: str, active_epoch_no: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.DrepRegistrationRecord(id: int, tx_id: int, cert_index: int, deposit: int, drep_hash_id: int, voting_anchor_id: int | None, hash_hex: str, hash_bech32: str, has_script: bool)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.GetUTxORecord(utxo_hash: str, utxo_ix: int, has_script: bool, amount: int, data_hash: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.MetadataRecord(key: int, json: Any, bytes: memoryview)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.OffChainVoteDataRecord(id: int, vot_anchor_id: int, hash: str, json: dict, bytes: str, warning: str | None, language: str, comment: str | None, is_valid: bool | None, authors: list[dict[str, Any]], references: list[dict[str, Any]], gov_action_data: dict[str, Any], external_updates: list[dict[str, Any]], voting_anchor: dict[str, Any])[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.PaymentAddrRecord(payment_address: str, stake_address: str | None, amount_sum: int, utxos: list[cardano_node_tests.utils.dbsync_types.GetUTxORecord])[source]ο
Bases:
object- utxos: list[GetUTxORecord][source]ο
- class cardano_node_tests.utils.dbsync_types.PoolDataRecord(id: int, hash: str, view: str, cert_index: int, vrf_key_hash: str, pledge: int, reward_addr: str, active_epoch_no: int, meta_id: int | None, margin: float, fixed_cost: int, registered_tx_id: int, metadata_url: str, metadata_hash: str, owners: list[str], relays: list[dict[str, dict[str, Any]]], retire_cert_index: int | None, retire_announced_tx_id: int | None, retiring_epoch: int | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.PotTransferRecord(treasury: int, reserves: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.RedeemerRecord(unit_mem: int, unit_steps: int, fee: int, purpose: str, script_hash: str, value: dict)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.RewardEpochRecord(amount: int, earned_epoch: int, spendable_epoch: int, type: str, pool_id: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.RewardRecord(address: str, rewards: list[cardano_node_tests.utils.dbsync_types.RewardEpochRecord], reward_sum: int)[source]ο
Bases:
object- rewards: list[RewardEpochRecord][source]ο
- class cardano_node_tests.utils.dbsync_types.ScriptRecord(hash: str, type: str, serialised_size: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.dbsync_types.TxPrelimRecord(utxo_out: list[cardano_node_tests.utils.dbsync_types.UTxORecord], ma_utxo_out: list[cardano_node_tests.utils.dbsync_types.UTxORecord], mint_utxo_out: list[cardano_node_tests.utils.dbsync_types.UTxORecord], last_row: cardano_node_tests.utils.dbsync_queries.TxDBRow)[source]ο
Bases:
object- ma_utxo_out: list[UTxORecord][source]ο
- mint_utxo_out: list[UTxORecord][source]ο
- utxo_out: list[UTxORecord][source]ο
- class cardano_node_tests.utils.dbsync_types.TxRecord(tx_id: int, tx_hash: str, block_id: int, block_index: int, out_sum: int, fee: int, deposit: int, size: int, invalid_before: int | None, invalid_hereafter: int | None, treasury_donation: int, txins: list[cardano_node_tests.utils.dbsync_types.UTxORecord], txouts: list[cardano_node_tests.utils.dbsync_types.UTxORecord], mint: list[cardano_node_tests.utils.dbsync_types.UTxORecord], collaterals: list[cardano_node_tests.utils.dbsync_types.UTxORecord], collateral_outputs: list[cardano_clusterlib.structs.UTXOData], reference_inputs: list[cardano_node_tests.utils.dbsync_types.UTxORecord], scripts: list[cardano_node_tests.utils.dbsync_types.ScriptRecord], redeemers: list[cardano_node_tests.utils.dbsync_types.RedeemerRecord], metadata: list[cardano_node_tests.utils.dbsync_types.MetadataRecord], reserve: list[cardano_node_tests.utils.dbsync_types.ADAStashRecord], treasury: list[cardano_node_tests.utils.dbsync_types.ADAStashRecord], pot_transfers: list[cardano_node_tests.utils.dbsync_types.PotTransferRecord], stake_registration: list[str], stake_deregistration: list[str], stake_delegation: list[cardano_node_tests.utils.dbsync_types.DelegationRecord], withdrawals: list[cardano_clusterlib.structs.TxOut], extra_key_witness: list[str])[source]ο
Bases:
object- collaterals: list[UTxORecord][source]ο
- metadata: list[MetadataRecord][source]ο
- mint: list[UTxORecord][source]ο
- pot_transfers: list[PotTransferRecord][source]ο
- redeemers: list[RedeemerRecord][source]ο
- reference_inputs: list[UTxORecord][source]ο
- reserve: list[ADAStashRecord][source]ο
- scripts: list[ScriptRecord][source]ο
- stake_delegation: list[DelegationRecord][source]ο
- treasury: list[ADAStashRecord][source]ο
- txins: list[UTxORecord][source]ο
- txouts: list[UTxORecord][source]ο
- class cardano_node_tests.utils.dbsync_types.UTxORecord(utxo_hash: str, utxo_ix: int, amount: int, address: str, coin: str = 'lovelace', decoded_coin: str = '', datum_hash: str = '', inline_datum_hash: str = '', inline_datum: str | dict | None = None, reference_script: dict | None = None, reference_script_hash: str = '')[source]ο
Bases:
object
cardano_node_tests.utils.dbsync_utils moduleο
Functionality for interacting with db-sync.
- exception cardano_node_tests.utils.dbsync_utils.DbSyncNoResponseError(detail: str)[source]ο
Bases:
ExceptionRaised when no response is returned from db-sync.
- exception cardano_node_tests.utils.dbsync_utils.DbSyncTimeoutError[source]ο
Bases:
TimeoutErrorRaised when data does not appear in db-sync within a timeout.
Subclasses TimeoutError so existing callers that catch TimeoutError keep working, while letting new code catch db-sync waiting timeouts specifically (a low-level socket.timeout is a TimeoutError too since Python 3.10). Note that TimeoutError subclasses OSError, so a broad except OSError would absorb this error as well.
- cardano_node_tests.utils.dbsync_utils.check_action_data(*, json_anchor_file: dict[str, Any], anchor_data_hash: str, action_txid: str, voting_anchor_id: int | None = None) None[source]ο
Compare anchor json file with off chain actionβs data from db-sync.
The anchor is expected to be valid and CIP-conformant:
is_valid = TRUEis verified, and authors, references and external updates are populated only for such anchors.The check targets the gov actionβs own
off_chain_vote_datarow, as the same content can back several anchors. The function waits for the off-chain data row to appear (db-syncβs fetch loop runs every 300s) and is a no-op when db-sync is not available, so callers do not need any db-sync related logic of their own.- Parameters:
json_anchor_file β Content of the anchor file, to compare the db-sync data against.
anchor_data_hash β Hash of the anchor content.
action_txid β Transaction hash of the transaction that submitted the proposal. Used to resolve
voting_anchor_id, so it is consulted only when the id is not provided.voting_anchor_id β Id of the anchorβs
voting_anchorrow. Pass it when it is already known, otherwise it is resolved from the proposalβs transaction.
- Raises:
AssertionError β When the data doesnβt match or the row is not stored within the wait timeout.
DbSyncTimeoutError β When the gov action proposal does not appear in db-sync while resolving
voting_anchor_id.
- cardano_node_tests.utils.dbsync_utils.check_address_reward(address: str, *, epoch_from: int = 0, epoch_to: int = 99999999) RewardRecord | None[source]ο
Check reward data for stake address in db-sync.
The epoch_from and epoch_to are epochs where the reward can be spent. Return None if db-sync is not available.
- cardano_node_tests.utils.dbsync_utils.check_column_condition(*, table: str, column: str, condition: str, expected_count: int | None = None, lock_timeout: str = '5s') None[source]ο
Validate that all/none rows meet a column condition atomically.
The check is a no-op when db-sync is not available.
- Parameters:
table β Table to check
column β Column to validate
condition β SQL condition (e.g., β= 0β, βIS NOT NULLβ)
expected_count β Require exactly this many matches (default: all must match)
lock_timeout β Max wait for table lock
- cardano_node_tests.utils.dbsync_utils.check_committee_info(*, gov_state: dict, txid: str, action_ix: int = 0) None[source]ο
Check committee info in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_committee_member_deregistration(*, cc_member_cold_key: str) CommitteeDeregistrationRecord | None[source]ο
Check committee member deregistration in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_committee_member_registration(*, cc_member_cold_key: str) CommitteeRegistrationRecord | None[source]ο
Check committee member registration in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_conway_gov_action_proposal_description(*, update_proposal: dict, txhash: str = '', action_ix: int = 0) GovActionProposalDBRow | None[source]ο
Check expected values in the gov_action_proposal table in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_conway_param_update_enactment(*, pparams: dict, epoch_no: int) EpochParamDBRow | None[source]ο
Check params enactment between ledger and epoch param in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_conway_param_update_proposal(*, param_proposal_ledger: dict) ParamProposalDBRow | None[source]ο
Check comparison for param proposal between ledger and db-sync.
- cardano_node_tests.utils.dbsync_utils.check_delegation_vote(*, txhash: str, stake_address: str, drep: str) None[source]ο
Check delegation vote in dbsync.
- cardano_node_tests.utils.dbsync_utils.check_drep_deregistration(*, drep: DRepRegistration) DrepRegistrationRecord | None[source]ο
Check drep deregistration in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_drep_registration(*, drep: DRepRegistration, drep_state: list[list[dict[str, Any]]]) DrepRegistrationRecord | None[source]ο
Check drep registration in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_epoch_state(*, epoch_no: int, txid: str, action_type: ActionTypes) None[source]ο
Check governance stats per epoch in dbsync.
- cardano_node_tests.utils.dbsync_utils.check_off_chain_drep_registration(*, drep_data: DrepRegistrationRecord, metadata: dict) None[source]ο
Check DRep off chain data in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_off_chain_vote_fetch_error(*, voting_anchor_id: int) None[source]ο
Check expected error in off_chain_vote_fetch_error.
- cardano_node_tests.utils.dbsync_utils.check_plutus_cost(*, redeemer_record: RedeemerRecord, cost_record: dict[str, Any]) None[source]ο
Compare cost of Plutus script with data from db-sync.
The check is a no-op when db-sync is not available.
- cardano_node_tests.utils.dbsync_utils.check_plutus_costs(*, redeemer_records: list[RedeemerRecord], cost_records: list[dict[str, Any]]) None[source]ο
Compare cost of multiple Plutus scripts with data from db-sync.
The check is a no-op when db-sync is not available.
- cardano_node_tests.utils.dbsync_utils.check_pool_data(*, ledger_pool_data: dict, pool_id: str) PoolDataRecord | None[source]ο
Check comparison for pool data between ledger and db-sync.
- cardano_node_tests.utils.dbsync_utils.check_pool_deregistration(*, pool_id: str, retiring_epoch: int) PoolDataRecord | None[source]ο
Check pool retirement in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_pool_off_chain_data(*, ledger_pool_data: dict, pool_id: str) PoolOffChainDataDBRow | None[source]ο
Check comparison for pool off chain data between ledger and db-sync.
Return None if db-sync is not available.
- cardano_node_tests.utils.dbsync_utils.check_pool_off_chain_fetch_error(*, ledger_pool_data: dict, pool_id: str) PoolOffChainFetchErrorDBRow | None[source]ο
Check expected error on OffChainPoolFetchError.
Return None if db-sync is not available.
- cardano_node_tests.utils.dbsync_utils.check_proposal_refunds(*, stake_address: str, refunds_num: int) None[source]ο
Check proposal refunds in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_reward_rest(*, stake_address: str, transfer_amts: list[int], type: str = '') None[source]ο
Check reward_rest in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_treasury_withdrawal(*, stake_address: str, transfer_amts: list[int], txhash: str) None[source]ο
Check treasury_withdrawal in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_tx(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, retry_num: int = 3) TxRecord | None[source]ο
Check a transaction in db-sync.
- cardano_node_tests.utils.dbsync_utils.check_tx_phase_2_failure(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, collateral_charged: int, retry_num: int = 3) TxRecord | None[source]ο
Check a transaction in db-sync when a phase 2 failure happens.
- cardano_node_tests.utils.dbsync_utils.check_votes(*, votes: VotedVotes, txhash: str) None[source]ο
Check votes in db-sync.
- cardano_node_tests.utils.dbsync_utils.get_action_data(*, data_hash: str, voting_anchor_id: int) OffChainVoteDataRecord | None[source]ο
Get off chain action data from db-sync.
- Parameters:
data_hash β Hash of the anchor content.
voting_anchor_id β Id of the anchorβs
voting_anchorrow. The same content (samedata_hash) can back several anchors of different types, each with its own row, so the target anchor must be identified explicitly.
- Returns:
The off-chain vote data record, or
Nonewhen db-sync has no row for the hash /voting_anchor_idcombination (e.g. the anchor was not fetched yet).
- cardano_node_tests.utils.dbsync_utils.get_address_reward(address: str, *, epoch_from: int = 0, epoch_to: int = 99999999) RewardRecord[source]ο
Get reward data for stake address from db-sync.
The epoch_from and epoch_to are epochs where the reward can be spent.
- cardano_node_tests.utils.dbsync_utils.get_committee_member(*, cold_key: str) CommitteeRegistrationRecord | None[source]ο
Get committee member data from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_deregistered_committee_member(*, cold_key: str) CommitteeDeregistrationRecord | None[source]ο
Get deregistered committee member data from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_drep(*, drep_hash: str, drep_deposit: int) DrepRegistrationRecord | None[source]ο
Get drep data from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_gov_action_proposals(*, txhash: str = '', type: str = '') list[GovActionProposalDBRow][source]ο
Get government action proposal from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_gov_action_voting_anchor_id(*, txhash: str, timeout: int = 120) int[source]ο
Return the
voting_anchor_iddb-sync assigned to a gov action proposal.The same anchor content can back several anchors (e.g. a gov action and a DRep registration), so callers that assert anchor details use this to target the gov actionβs own
off_chain_vote_datarow. The transaction is expected to carry a single proposal; if it carries more, an arbitrary one is used.- Parameters:
txhash β Transaction hash of the transaction that submitted the proposal.
timeout β Lower bound on how long to wait for the proposal to appear in db-sync, in seconds (retry_query backoff can overshoot it).
- Raises:
DbSyncTimeoutError β When the proposal does not appear in db-sync within the timeout.
- cardano_node_tests.utils.dbsync_utils.get_pool_data(*, pool_id_bech32: str) PoolDataRecord | None[source]ο
Get pool data from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_prelim_tx_record(*, txhash: str) TxPrelimRecord[source]ο
Get first batch of transaction data from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_tx(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput, retry_num: int = 3) TxRecord | None[source]ο
Get a transaction data from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_tx_record(*, txhash: str) TxRecord[source]ο
Get transaction data from db-sync.
Compile data from multiple SQL queries to get as much information about the TX as possible.
- cardano_node_tests.utils.dbsync_utils.get_tx_record_retry(*, txhash: str, retry_num: int = 3) TxRecord[source]ο
Retry get_tx_record when data is anticipated and are not available yet.
Under load it might be necessary to wait a bit and retry the query.
- cardano_node_tests.utils.dbsync_utils.get_txins(*, txhash: str) list[UTxORecord][source]ο
Get txins of a transaction from db-sync.
- cardano_node_tests.utils.dbsync_utils.get_utxo(*, address: str) PaymentAddrRecord[source]ο
Return UTxO info for payment address from db-sync.
- cardano_node_tests.utils.dbsync_utils.map_params_to_db_convention(*, pparams: dict) dict[str, Any][source]ο
- cardano_node_tests.utils.dbsync_utils.retry_query(*, query_func: Callable, timeout: int = 20) Any[source]ο
Wait a bit and retry a query until response is returned.
A generic function that can be used by any query/check that raises DbSyncNoResponseError. The query is repeated until the expected data is returned, or DbSyncTimeoutError is raised when the timeout is reached.
- cardano_node_tests.utils.dbsync_utils.table_empty(*, table: str) bool[source]ο
Check if a database table is empty.
- cardano_node_tests.utils.dbsync_utils.table_exists(*, table: str) bool[source]ο
Check if a table exists in the database.
- cardano_node_tests.utils.dbsync_utils.wait_for_db_sync_completion(*, expected_progress: float = 99.0, timeout: int = 360, polling_interval: int = 5) float[source]ο
Wait for db-sync to reach the expected sync completion.
- Parameters:
expected_progress β Expected completion as percentage, 99% by default
timeout β Maximum total time to wait in seconds
polling_interval β Loop polling time in seconds
- Returns:
Final sync percentage achieved (>= expected_progress)
- Raises:
DbSyncTimeoutError β If sync doesnβt reach the expected progress within timeout
- cardano_node_tests.utils.dbsync_utils.wait_for_off_chain_vote_data(*, data_hash: str, voting_anchor_id: int, timeout: int = 420) OffChainVoteDataRecord[source]ο
Wait until db-sync stores the off-chain vote data for an anchor and return it.
db-syncβs off-chain fetch loop sleeps 300s between passes, so the row can appear up to ~5 minutes after the anchor is on-chain.
A missing row can mean a db-sync regression (the PR #2005 behaviour), a failed download (404, network trouble - recorded by db-sync in
off_chain_vote_fetch_error), or a wrongvoting_anchor_id. On timeout, the failure message includes the recorded fetch errors and a data-presence diagnostic (whether the data appeared late, which other anchor ids hold data for the hash, or that none do), to tell the cases apart.- Parameters:
data_hash β Hash of the anchor content.
voting_anchor_id β Id of the anchorβs
voting_anchorrow. The same content can be referenced by several anchors (e.g. a gov action and a DRep registration share adata_hash), so the target anchor must be identified explicitly.timeout β Lower bound on how long to wait for the row, in seconds. retry_query uses quadratic backoff and checks the deadline only between polls, so the actual wait can exceed this by up to one backoff interval (~25% at the default 420s).
- Returns:
The stored off-chain vote data record.
- Raises:
AssertionError β When the row is not stored within the timeout.
cardano_node_tests.utils.defragment_utxos moduleο
Defragment address UTxOs.
cardano_node_tests.utils.dev_session moduleο
Exclusive use of a dev cluster by a single pytest invocation.
With DEV_CLUSTER_RUNNING, multiple concurrent pytest invocations (possibly from different git worktrees) can target the same dev cluster instance. The cluster management locks live under the invocation-specific pytest temp dir, so they cannot coordinate across invocations. Instead, each invocation records its identity in a claim file next to the dev cluster state dir, and refuses to run when the cluster is already claimed by another live invocation.
cardano_node_tests.utils.faucet moduleο
- cardano_node_tests.utils.faucet.fund_from_faucet(*dst_addrs: AddressRecord, cluster_obj: ClusterLib, faucet_data: dict | None = None, all_faucets: dict[str, dict] | None = None, amount: int | list[int], tx_name: str | None = None, destination_dir: str | Path = '.', force: bool = False) TxRawOutput | None[source]ο
Transfer amount from faucet addr to all dst_addrs.
- cardano_node_tests.utils.faucet.return_funds_to_faucet(*src_addrs: AddressRecord, cluster_obj: ClusterLib, faucet_addr: str, amount: int | list[int] = -1, tx_name: str | None = None, destination_dir: str | Path = '.') None[source]ο
Transfer amount from all src_addrs to faucet_addr.
The amount of β-1β means all available funds.
cardano_node_tests.utils.framework_log moduleο
cardano_node_tests.utils.gh_issue moduleο
Functionality for working with GitHub issues.
- class cardano_node_tests.utils.gh_issue.GHIssue(number: int, repo: str)[source]ο
Bases:
objectGitHub issue.
cardano_node_tests.utils.governance_setup moduleο
- cardano_node_tests.utils.governance_setup.auth_cc_members(*, cluster_obj: ClusterLib, cc_members: list[CCKeyMember], name_template: str, payment_addr: AddressRecord) None[source]ο
Authorize the original CC members.
- cardano_node_tests.utils.governance_setup.create_vote_stake(*, name_template: str, cluster_manager: ClusterManager, cluster_obj: ClusterLib, no_of_addr: int, destination_dir: str | Path = '.') list[PoolUser][source]ο
- cardano_node_tests.utils.governance_setup.get_default_governance(*, cluster_manager: ClusterManager, cluster_obj: ClusterLib) GovernanceRecords[source]ο
Get default governance data for CC members, DReps and SPOs.
- cardano_node_tests.utils.governance_setup.load_committee(*, cluster_obj: ClusterLib) list[CCKeyMember][source]ο
- cardano_node_tests.utils.governance_setup.load_drep_users(*, cluster_obj: ClusterLib) list[PoolUser][source]ο
Load DReps users from the state directory.
- cardano_node_tests.utils.governance_setup.load_dreps(*, cluster_obj: ClusterLib) list[DRepRegistration][source]ο
Load DReps from the state directory.
- cardano_node_tests.utils.governance_setup.refresh_cc_keys(*, cluster_obj: ClusterLib, cc_members: list[CCKeyMember], governance_data: GovernanceRecords) GovernanceRecords[source]ο
Refresh hot certs for original CC members.
- cardano_node_tests.utils.governance_setup.reinstate_committee(*, cluster_obj: ClusterLib, governance_data: GovernanceRecords, name_template: str, pool_user: PoolUser) None[source]ο
Reinstate the original CC members.
- cardano_node_tests.utils.governance_setup.save_default_governance(*, dreps_reg: list[DRepRegistration], drep_delegators: list[PoolUser], cc_members: list[CCKeyMember], pools_cold: list[ColdKeyPair]) GovernanceRecords[source]ο
Save governance data to a pickle, so it can be reused.
This needs to be called either under a file lock (FileLockIfXdist), or in a test that locked whole governance for itself.
- cardano_node_tests.utils.governance_setup.setup(*, cluster_manager: ClusterManager, cluster_obj: ClusterLib) GovernanceRecords[source]ο
cardano_node_tests.utils.governance_utils moduleο
Utilities for Conway governance.
- class cardano_node_tests.utils.governance_utils.AnchorData(url: str, hash: str, data_file: pathlib.Path | None)[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.CCHotKeys(hot_vkey: str = '', hot_vkey_file: str | pathlib.Path = '', hot_vkey_hash: str = '', hot_skey: str = '', hot_skey_file: str | pathlib.Path = '', hot_skey_hash: str = '')[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.CCKeyMember(cc_member: cardano_clusterlib.structs.CCMember, hot_keys: cardano_node_tests.utils.governance_utils.CCHotKeys)[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.CCMemberAuth(auth_cert: pathlib.Path, cold_key_pair: cardano_clusterlib.structs.KeyPair, hot_key_pair: cardano_clusterlib.structs.KeyPair, key_hash: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.DRepRegistration(registration_cert: pathlib.Path, key_pair: cardano_clusterlib.structs.KeyPair, drep_id: str, deposit: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.DRepScriptRegInputs(registration_cert: cardano_clusterlib.structs.ComplexCert, key_pairs: list[cardano_clusterlib.structs.KeyPair], script_type: cardano_node_tests.utils.governance_utils.ScriptTypes)[source]ο
Bases:
object- script_type: ScriptTypes[source]ο
- class cardano_node_tests.utils.governance_utils.DRepScriptRegRecord(registration_cert: pathlib.Path, script_hash: str, deposit: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.DRepScriptRegistration(registration_cert: cardano_clusterlib.structs.ComplexCert, key_pairs: list[cardano_clusterlib.structs.KeyPair], script_hash: str, script_type: cardano_node_tests.utils.governance_utils.ScriptTypes, deposit: int)[source]ο
Bases:
object- script_type: ScriptTypes[source]ο
- class cardano_node_tests.utils.governance_utils.GovernanceRecords(dreps_reg: list[cardano_node_tests.utils.governance_utils.DRepRegistration], drep_delegators: list[cardano_clusterlib.structs.PoolUser], cc_key_members: list[cardano_node_tests.utils.governance_utils.CCKeyMember], pools_cold: list[cardano_clusterlib.structs.ColdKeyPair], drep_scripts_reg: list[cardano_node_tests.utils.governance_utils.DRepScriptRegistration] = <factory>, drep_scripts_delegators: list[cardano_clusterlib.structs.PoolUser] = <factory>)[source]ο
Bases:
object- cc_key_members: list[CCKeyMember][source]ο
- drep_scripts_reg: list[DRepScriptRegistration][source]ο
- dreps_reg: list[DRepRegistration][source]ο
- class cardano_node_tests.utils.governance_utils.PrevActionRec(txid: str, ix: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.StakeDelegation(spo: int, drep: int, total_lovelace: int)[source]ο
Bases:
object
- class cardano_node_tests.utils.governance_utils.VotedVotes(cc: list[cardano_clusterlib.structs.VoteCC], drep: list[cardano_clusterlib.structs.VoteDrep], spo: list[cardano_clusterlib.structs.VoteSPO])[source]ο
Bases:
object
- cardano_node_tests.utils.governance_utils.check_action_view(*, cluster_obj: ClusterLib, action_data: ActionConstitution | ActionHardfork | ActionInfo | ActionNoConfidence | ActionPParamsUpdate | ActionTreasuryWithdrawal | ActionUpdateCommittee, return_addr_vkey_hash: str = '', recv_addr_vkey_hash: str = '') None[source]ο
Check governance action view output.
- cardano_node_tests.utils.governance_utils.check_drep_delegation(*, deleg_state: dict, drep_id: str, stake_addr_hash: str) None[source]ο
- cardano_node_tests.utils.governance_utils.check_drep_stake_distribution(*, distrib_state: dict[str, Any], drep_id: str, min_amount: int) None[source]ο
- cardano_node_tests.utils.governance_utils.check_vote_view(*, cluster_obj: ClusterLib, vote_data: VoteCC | VoteDrep | VoteSPO) None[source]ο
Check governance vote view output.
- cardano_node_tests.utils.governance_utils.create_dreps(*, name_template: str, num: int, cluster_obj: ClusterLib, payment_addr: AddressRecord, pool_users: list[PoolUser], destination_dir: str | Path = '.') tuple[list[DRepRegistration], list[PoolUser]][source]ο
Create DReps with keys.
- cardano_node_tests.utils.governance_utils.create_script_dreps(*, name_template: str, script_inputs: list[DRepScriptRegInputs], cluster_obj: ClusterLib, payment_addr: AddressRecord, pool_users: list[PoolUser], destination_dir: str | Path = '.') tuple[list[DRepScriptRegistration], list[PoolUser]][source]ο
Create DReps with scripts.
- cardano_node_tests.utils.governance_utils.get_anchor_data(*, cluster_obj: ClusterLib, name_template: str, anchor_text: str) AnchorData[source]ο
Publish anchor data and return the URL and data hash.
- cardano_node_tests.utils.governance_utils.get_cc_member_auth_record(*, cluster_obj: ClusterLib, name_template: str, destination_dir: str | Path = '.') CCMemberAuth[source]ο
Get Constitutional Committee Members key authorization record.
- cardano_node_tests.utils.governance_utils.get_default_anchor_data() AnchorData[source]ο
Return the default anchor data.
- cardano_node_tests.utils.governance_utils.get_delegated_stake(*, cluster_obj: ClusterLib) StakeDelegation[source]ο
Get total stake delegated to SPOs and DReps.
- cardano_node_tests.utils.governance_utils.get_drep_cred_name_from_addr_info(*, addr_info: StakeAddrInfo) str[source]ο
- cardano_node_tests.utils.governance_utils.get_drep_reg_record(*, cluster_obj: ClusterLib, name_template: str, deposit_amt: int = -1, drep_metadata_url: str = '', drep_metadata_hash: str = '', destination_dir: str | Path = '.') DRepRegistration[source]ο
Get DRep registration record.
- cardano_node_tests.utils.governance_utils.get_prev_action(*, action_type: PrevGovActionIds, gov_state: dict[str, Any]) PrevActionRec[source]ο
- cardano_node_tests.utils.governance_utils.get_script_drep_reg_record(*, cluster_obj: ClusterLib, name_template: str, script_hash: str, deposit_amt: int = -1, drep_metadata_url: str = '', drep_metadata_hash: str = '', destination_dir: str | Path = '.') DRepScriptRegRecord[source]ο
Get DRep script registration record.
- cardano_node_tests.utils.governance_utils.is_cc_active(*, cc_member_state: dict[str, Any]) bool[source]ο
Check if CC member is active.
- cardano_node_tests.utils.governance_utils.is_drep_active(*, cluster_obj: ClusterLib, drep_state: list[list[dict[str, Any]]], epoch: int = -1) bool[source]ο
Check if DRep is active.
- cardano_node_tests.utils.governance_utils.lookup_expired_actions(*, gov_state: dict[str, Any], action_txid: str, action_ix: int = 0) dict[str, Any][source]ο
- cardano_node_tests.utils.governance_utils.lookup_proposal(*, gov_state: dict[str, Any], action_txid: str, action_ix: int = 0) dict[str, Any][source]ο
cardano_node_tests.utils.helpers moduleο
- exception cardano_node_tests.utils.helpers.CommandExecError[source]ο
Bases:
RuntimeErrorRaised when a command cannot be executed at all (e.g. missing executable or workdir).
- cardano_node_tests.utils.helpers.change_cwd(dir_path: str | Path) Generator[str | Path, None, None][source]ο
Change and restore CWD - context manager.
- cardano_node_tests.utils.helpers.check_cardano_node_socket_path() None[source]ο
Check that CARDANO_NODE_SOCKET_PATH value is valid for use by testing framework.
- cardano_node_tests.utils.helpers.check_dir_arg(dir_path: str) Path | None[source]ο
Check that the dir passed as argparse parameter is a valid existing dir.
- cardano_node_tests.utils.helpers.check_dir_arg_keep(dir_path: str) Path | None[source]ο
Check that the dir passed as argparse parameter is a valid existing dir.
Keep the original path (with ~ expanded) instead of resolving it to absolute.
- cardano_node_tests.utils.helpers.check_file_arg(file_path: str) Path | None[source]ο
Check that the file passed as argparse parameter is a valid existing file.
- cardano_node_tests.utils.helpers.checksum(filename: str | Path) str[source]ο
Return file checksum.
- cardano_node_tests.utils.helpers.decode_bech32(bech32: str) str[source]ο
Convert from bech32 string.
- cardano_node_tests.utils.helpers.encode_bech32(*, prefix: str, data: str) str[source]ο
Convert to bech32 string.
- cardano_node_tests.utils.helpers.environ(env: dict[str, str]) Generator[None, None, None][source]ο
Temporarily set environment variables and restore previous environment afterwards.
- cardano_node_tests.utils.helpers.flatten(iterable: Iterable[Any], *, ltypes: type[Iterable[Any]] | None = None) Generator[Any, None, None][source]ο
Flatten an irregular (arbitrarily nested) iterable of iterables.
- cardano_node_tests.utils.helpers.get_current_commit() str[source]ο
Return the current git commit hash.
Uses the GIT_REVISION env variable when set to a non-empty value, otherwise asks git. Git is run in the repo containing this module, independent of CWD. The result is cached for the lifetime of the process.
- cardano_node_tests.utils.helpers.get_current_line_str() str[source]ο
Get filename#L<lineno> of current line.
NOTE: Reports the location of the immediate caller. Calling through any wrapper (decorator, context manager, functools.partial) reports the wrapperβs location instead.
- cardano_node_tests.utils.helpers.get_env_int(var: str, default: int) int[source]ο
Read an integer environment variable.
Returns
defaultwhen the variable is unset or empty. Raises aValueErrornaming the offending variable when the value is malformed.
- cardano_node_tests.utils.helpers.get_env_path(var: str) Path | None[source]ο
Read a path environment variable.
Returns the resolved
pathlib.Path(with~expanded) when set, otherwiseNone.
- cardano_node_tests.utils.helpers.get_line_str_from_frame(frame: FrameType) str[source]ο
Return filename#L<lineno> string for the given frame.
- cardano_node_tests.utils.helpers.get_pool_param(key: str, *, pool_params: dict) Any[source]ο
Get pool parameter value from pool params dict.
- cardano_node_tests.utils.helpers.get_timestamped_rand_str(rand_str_length: int = 4) str[source]ο
Return random string prefixed with timestamp.
>>> len(get_timestamped_rand_str()) == len("200801_002401314_cinf") True
- cardano_node_tests.utils.helpers.get_vcs_link() str[source]ο
Return link to the current line in GitHub.
- cardano_node_tests.utils.helpers.ignore_interrupt() Generator[None, None, None][source]ο
Ignore the KeyboardInterrupt signal.
- cardano_node_tests.utils.helpers.is_in_interval(num1: float, num2: float, *, frac: float = 0.1) bool[source]ο
Check that the num1 is in the interval defined by num2 and its fraction.
- cardano_node_tests.utils.helpers.is_inputs_spent_err(err_str: str) bool[source]ο
Check if the error message indicates that the Tx inputs were already spent.
The ledger reports this condition with a different error in each era, so all the known variants are accepted. In the Dijkstra era the Conway mempool failure is injected as the dedicated AllInputsAreSpent failure.
- Parameters:
err_str β An error message to check.
- Returns:
True if the error was caused by already spent Tx inputs.
- Return type:
bool
- cardano_node_tests.utils.helpers.is_truthy_env_var(var: str) bool[source]ο
Check if an environment variable is set to a truthy value.
- cardano_node_tests.utils.helpers.prepend_flag(flag: str, contents: Iterable[Any]) list[str][source]ο
Prepend flag to every item of the sequence.
- Parameters:
flag β A flag to prepend to every item of the contents.
contents β A list (iterable) of content to be prepended.
- Returns:
A list of flag followed by content, see below.
- Return type:
list[str]
>>> prepend_flag("--foo", [1, 2, 3]) ['--foo', '1', '--foo', '2', '--foo', '3']
- cardano_node_tests.utils.helpers.run_command(command: str | list[Any], *, workdir: str | Path = '', ignore_fail: bool = False, shell: bool = False, merge_stderr: bool = False, stdin_data: bytes | None = None) bytes[source]ο
Run command.
- Parameters:
command β A command to run - either a string (tokenized with shlex unless shell is used) or a list of arguments (items are converted to str).
workdir β A working directory for the command.
ignore_fail β Donβt raise an exception when the command fails.
shell β Run the command in a shell.
merge_stderr β Redirect stderr to stdout.
stdin_data β Data to pass to stdin of the command.
- Returns:
Content of stdout (with stderr merged in when merge_stderr is used).
- Return type:
bytes
- Raises:
RuntimeError β When the command fails (unless ignore_fail is used).
CommandExecError β When the command cannot be executed at all (e.g. missing or non-executable file). Subclass of RuntimeError.
- cardano_node_tests.utils.helpers.run_in_bash(command: str, *, workdir: str | Path = '') bytes[source]ο
Run command(s) in bash.
- cardano_node_tests.utils.helpers.tool_has(command: str) bool[source]ο
Check if a tool has a subcommand or argument available.
E.g. tool_has(βcardano-cli legacy governanceβ)
- Raises:
CommandExecError β When the tool cannot be executed at all, as its availability cannot be determined in that case.
- cardano_node_tests.utils.helpers.validate_dict_values(dict1: dict[str, Any], dict2: dict[str, Any], *, keys: Iterable[str]) list[str][source]ο
Compare values for specified keys between two dictionaries and return discrepancies.
- Parameters:
dict1 β First dictionary to compare. This represents the expected data.
dict2 β Second dictionary to compare. This represents the actual data.
keys β List of keys to compare between the two dictionaries.
- Returns:
A list of discrepancies, with each discrepancy describing a mismatch between the values in dict1 and dict2 for the specified keys.
cardano_node_tests.utils.http_client moduleο
Global HTTP client.
cardano_node_tests.utils.locking moduleο
File-based locking.
FileLock is a real lock that works regardless of how pytest is invoked - use it when coordination is needed even outside pytest-xdist, e.g. across pytest invocations. FileLockIfXdist degrades to a no-op when not running with pytest-xdist workers.
cardano_node_tests.utils.logfiles moduleο
- class cardano_node_tests.utils.logfiles.RotableLog(logfile: pathlib.Path, seek: int, timestamp: float, inode: int)[source]ο
Bases:
object
- cardano_node_tests.utils.logfiles.add_ignore_rule(*, files_glob: str, regex: str, ignore_file_id: str, skip_after: float = 0.0) None[source]ο
Add ignore rule for expected errors.
- Parameters:
files_glob β A glob matching files that the regex should apply to.
regex β A regex that should be ignored.
ignore_file_id β
The id of a ignore file the ignore rule will be added to.
NOTE: When ignore_file_id matches pytest-xdist worker id (the worker_id fixture), the rule will be deleted during the test teardown.
skip_after β
The time in seconds after which the rule will expire. This is to avoid reporting the ignored errors in subsequent tests. It can take several seconds for the errors to appear in log files and we donβt want to wait for them after each test.
NOTE: The rule will expire only when there are no yet to be searched log messages that were created before the skip_after time.
- Raises:
ValueError β When the rule cannot be stored in the rules file format (β;;β in the file glob, a line break in the file glob or in the regex), when the regex is not valid or cannot be combined with other rules, when the regex matches an empty string (it would suppress all errors for the matching files), or when the skip_after value is not a non-negative finite number.
NOTE: Conflicts between rules that fail compilation of the combined ignore regex (e.g. two rules redefining the same group name) cannot be detected here. Such rules are skipped with a warning when the combined ignore regex is built. Avoid numeric backreferences (e.g. β1β) - group numbers shift in the combined regex, so the backreference can silently bind to a group of a different rule.
- cardano_node_tests.utils.logfiles.check_msgs_presence_in_logs(regex_pairs: list[tuple[str, str]], seek_offsets: Mapping[str, tuple[int, int | None]], state_dir: Path, timestamp: float) list[str][source]ο
Check if the expected messages are present in logs (byte offsets, binary I/O).
An expected message found in an unterminated final line counts as present, unless the regex constrains what follows the match (see _constrains_match_end).
- Parameters:
regex_pairs β (glob, regex) pairs.
seek_offsets β Mapping of absolute log path (str) -> (byte offset, inode or None).
state_dir β Root directory for globs.
timestamp β Passed to _get_rotated_logs.
- Returns:
Error messages for missing entries, for globs that matched no log file, and for log files that could not be searched.
- cardano_node_tests.utils.logfiles.clean_ignore_rules(*, ignore_file_id: str) None[source]ο
Cleanup relevant ignore rules file.
Delete ignore file identified by ignore_file_id when it is no longer valid.
- cardano_node_tests.utils.logfiles.expect_errors(regex_pairs: list[tuple[str, str]], *, worker_id: str) Generator[None, None, None][source]ο
Make sure the expected errors are present in logs.
Context manager.
- Parameters:
regex_pairs β [(glob, regex)] - A list of regexes matching strings that need to be present in files described by the glob.
worker_id β The id of the pytest-xdist worker (the worker_id fixture) that the test is running on.
- cardano_node_tests.utils.logfiles.expect_messages(regex_pairs: list[tuple[str, str]]) Generator[None, None, None][source]ο
Make sure the expected messages are present in logs.
Context manager.
- Parameters:
regex_pairs β [(glob, regex)] - A list of regexes matching strings that need to be present in files described by the glob.
- cardano_node_tests.utils.logfiles.find_msgs_in_logs(*, regex: str, logfile: Path, seek_offset: int, timestamp: float, inode: int | None = None, only_first: bool = False, encoding: str = 'utf-8') list[str][source]ο
Find messages in log using a byte seek offset (binary mode).
Reads in binary for speed, resumes at a line boundary near seek_offset, matches with a bytes regex, and decodes only matching lines.
- Parameters:
regex β Regular expression (interpreted as UTF-8 when compiled to bytes).
logfile β Path to the primary log file.
seek_offset β Byte offset to resume from (start of a line or 0).
timestamp β Timestamp used by _get_rotated_logs(β¦).
inode β Inode of the log file the seek_offset was recorded for (optional).
only_first β If True, return immediately after the first match.
encoding β Text encoding used to decode matched lines (default: βutf-8β).
- Returns:
Matching log lines (decoded to str, without trailing newlines). An unterminated final line of the live log file is not searched, so a truncated line is never returned for it. An unterminated final line of a rotated log file is searched, as it is the fileβs final content.
- Raises:
FileNotFoundError β When the log file keeps getting rotated during the search. Unlike the error-aggregating searches, the failure is propagated - the caller needs the matching lines, and an empty result would be misread as βno matchesβ.
- cardano_node_tests.utils.logfiles.get_logfiles_errors() str[source]ο
Get errors found in cluster artifacts.
- cardano_node_tests.utils.logfiles.search_cluster_logs() list[tuple[Path, str]][source]ο
Search cluster logs for errors.
cardano_node_tests.utils.model_ekg moduleο
- class cardano_node_tests.utils.model_ekg.BytesAllocated(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.BytesCopied(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Cardano(*, node: Node)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.CpuMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.CumulativeBytesUsed(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.CurrentBytesSlop(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.CurrentBytesUsed(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Density(*, real: Real)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Ekg(*, server_timestamp_ms: ServerTimestampMs)[source]ο
Bases:
BaseModel- model_config: ClassVar[ConfigDict] = {}[source]ο
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- server_timestamp_ms: ServerTimestampMs[source]ο
- class cardano_node_tests.utils.model_ekg.Forge(*, node_is_leader: NodeIsLeader, node_not_leader: NodeNotLeader, forged: Forged, adopted: Adopted, forge_about_to_lead: ForgeAboutToLead)[source]ο
Bases:
BaseModel- forge_about_to_lead: ForgeAboutToLead[source]ο
- model_config: ClassVar[ConfigDict] = {}[source]ο
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- node_is_leader: NodeIsLeader[source]ο
- node_not_leader: NodeNotLeader[source]ο
- class cardano_node_tests.utils.model_ekg.Gc(*, bytes_allocated: BytesAllocated, mutator_cpu_ms: MutatorCpuMs, gc_wall_ms: GcWallMs, peak_megabytes_allocated: PeakMegabytesAllocated, par_tot_bytes_copied: ParTotBytesCopied, cumulative_bytes_used: CumulativeBytesUsed, par_max_bytes_copied: ParMaxBytesCopied, init_wall_ms: InitWallMs, max_bytes_used: MaxBytesUsed, bytes_copied: BytesCopied, wall_ms: WallMs, cpu_ms: CpuMs, current_bytes_used: CurrentBytesUsed, gc_cpu_ms: GcCpuMs, mutator_wall_ms: MutatorWallMs, par_avg_bytes_copied: ParAvgBytesCopied, num_gcs: NumGcs, current_bytes_slop: CurrentBytesSlop, num_bytes_usage_samples: NumBytesUsageSamples, max_bytes_slop: MaxBytesSlop, init_cpu_ms: InitCpuMs)[source]ο
Bases:
BaseModel- bytes_allocated: BytesAllocated[source]ο
- bytes_copied: BytesCopied[source]ο
- cumulative_bytes_used: CumulativeBytesUsed[source]ο
- current_bytes_slop: CurrentBytesSlop[source]ο
- current_bytes_used: CurrentBytesUsed[source]ο
- init_wall_ms: InitWallMs[source]ο
- max_bytes_slop: MaxBytesSlop[source]ο
- max_bytes_used: MaxBytesUsed[source]ο
- model_config: ClassVar[ConfigDict] = {}[source]ο
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- mutator_cpu_ms: MutatorCpuMs[source]ο
- mutator_wall_ms: MutatorWallMs[source]ο
- num_bytes_usage_samples: NumBytesUsageSamples[source]ο
- par_avg_bytes_copied: ParAvgBytesCopied[source]ο
- par_max_bytes_copied: ParMaxBytesCopied[source]ο
- par_tot_bytes_copied: ParTotBytesCopied[source]ο
- peak_megabytes_allocated: PeakMegabytesAllocated[source]ο
- class cardano_node_tests.utils.model_ekg.GcCpuMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.GcWallMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.InitCpuMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.InitWallMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int1(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int10(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int11(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int12(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int13(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int14(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int15(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int16(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int17(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int18(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int19(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int2(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int20(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int21(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int22(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int23(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int24(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int25(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int26(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int27(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int28(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int29(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int3(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int30(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int4(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int5(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int6(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int7(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int8(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Int9(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.IohkMonitoringVersion(*, val: str, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.MaxBytesSlop(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.MaxBytesUsed(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Mem(*, resident: Resident)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Metrics(*, nodeIsLeaderNum: NodeIsLeaderNum, blockNum: BlockNum, blocksForgedNum: BlocksForgedNum, epoch: Epoch, Forge: Forge, currentKESPeriod: CurrentKESPeriod, myBlocksUncoupled: MyBlocksUncoupled, txsProcessedNum: TxsProcessedNum, density: Density, nodeStartTime: NodeStartTime, Mem: Mem, operationalCertificateStartKESPeriod: OperationalCertificateStartKESPeriod, operationalCertificateExpiryKESPeriod: OperationalCertificateExpiryKESPeriod, remainingKESPeriods: RemainingKESPeriods, txsInMempool: TxsInMempool, delegMapSize: DelegMapSize, utxoSize: UtxoSize, served: Served, mempoolBytes: MempoolBytes, RTS: RTS, slotInEpoch: SlotInEpoch, slotNum: SlotNum, Stat: Stat)[source]ο
Bases:
BaseModel- blocksForgedNum: BlocksForgedNum[source]ο
- currentKESPeriod: CurrentKESPeriod[source]ο
- delegMapSize: DelegMapSize[source]ο
- mempoolBytes: MempoolBytes[source]ο
- model_config: ClassVar[ConfigDict] = {}[source]ο
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- myBlocksUncoupled: MyBlocksUncoupled[source]ο
- nodeIsLeaderNum: NodeIsLeaderNum[source]ο
- nodeStartTime: NodeStartTime[source]ο
- operationalCertificateExpiryKESPeriod: OperationalCertificateExpiryKESPeriod[source]ο
- operationalCertificateStartKESPeriod: OperationalCertificateStartKESPeriod[source]ο
- remainingKESPeriods: RemainingKESPeriods[source]ο
- slotInEpoch: SlotInEpoch[source]ο
- txsInMempool: TxsInMempool[source]ο
- txsProcessedNum: TxsProcessedNum[source]ο
- class cardano_node_tests.utils.model_ekg.Model(*, iohk_monitoring_version: IohkMonitoringVersion, cardano: Cardano, ekg: Ekg, rts: Rts)[source]ο
Bases:
BaseModel- iohk_monitoring_version: IohkMonitoringVersion[source]ο
- class cardano_node_tests.utils.model_ekg.MutatorCpuMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.MutatorWallMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.MyBlocksUncoupled(*, int: Int10)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.NumBytesUsageSamples(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.NumGcs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.OperationalCertificateExpiryKESPeriod(*, int: Int15)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.OperationalCertificateStartKESPeriod(*, int: Int14)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.ParAvgBytesCopied(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.ParMaxBytesCopied(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.ParTotBytesCopied(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.PeakMegabytesAllocated(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.RTS(*, gcMajorNum: GcMajorNum, gcLiveBytes: GcLiveBytes, gcMinorNum: GcMinorNum, mutticks: Mutticks, gcticks: Gcticks)[source]ο
Bases:
BaseModel- gcLiveBytes: GcLiveBytes[source]ο
- gcMajorNum: GcMajorNum[source]ο
- gcMinorNum: GcMinorNum[source]ο
- class cardano_node_tests.utils.model_ekg.Real(*, val: str, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.RemainingKESPeriods(*, int: Int16)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.ServerTimestampMs(*, val: int, type: str)[source]ο
Bases:
BaseModel
- class cardano_node_tests.utils.model_ekg.Stat(*, cputicks: Cputicks, threads: Threads)[source]ο
Bases:
BaseModel
cardano_node_tests.utils.pytest_utils moduleο
- class cardano_node_tests.utils.pytest_utils.PytestTest(test_function: str, test_file: pathlib.Path, full: str, test_class: str = '', test_params: str = '', stage: str = '')[source]ο
Bases:
object
- cardano_node_tests.utils.pytest_utils.get_current_test() PytestTest[source]ο
Get components (test file, test name, etc.) of current pytest test.
cardano_node_tests.utils.requirements moduleο
Functionality for tracking execution of external requirements.
- class cardano_node_tests.utils.requirements.Req(*, id: str, group: str = '', url: str = '', enabled: bool = True)[source]ο
Bases:
objectMethods for working with external requirements.
- cardano_node_tests.utils.requirements.collect_executed_req(*, base_dir: Path) dict[source]ο
Collect executed requirements.
cardano_node_tests.utils.smash_utils moduleο
- class cardano_node_tests.utils.smash_utils.PoolError(cause: str, pool_hash: str, pool_id: str, retry_count: int, time: str, utc_time: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.smash_utils.PoolMetadata(name: str, description: str, ticker: str, homepage: str)[source]ο
Bases:
object
- class cardano_node_tests.utils.smash_utils.SmashClient(instance_num: int, req_timeout: int = 10)[source]ο
Bases:
objectUtility class for interacting with SMASH via REST API.
- delist_pool(*, pool_id: str) PoolData[source]ο
Delist a stake pool, returning PoolData on success or a RequestException on failure.
- enlist_pool(*, pool_id: str) PoolData[source]ο
Enlist a stake pool, returning PoolData on success or a RequestException on failure.
- get_pool_errors(*, pool_id: str, from_date: str | None = None) list[PoolError][source]ο
Fetch errors for a specific stake pool.
- get_pool_metadata(*, pool_id: str, pool_meta_hash: str) PoolMetadata[source]ο
Fetch stake pool metadata from SMASH, returning a PoolMetadata.
- reserve_ticker(*, ticker_name: str, pool_hash: str) PoolTicker[source]ο
Reserve a ticker for a stake pool.
- class cardano_node_tests.utils.smash_utils.SmashManager[source]ο
Bases:
object- classmethod get_smash_instance() SmashClient[source]ο
Get a singleton instance of SmashClient for the given cluster instance.
- instances: ClassVar[dict[int, SmashClient]] = {}[source]ο
- cardano_node_tests.utils.smash_utils.check_smash_pool_errors(*, pool_id: str, pool_metadata_hash: str) list[PoolError] | None[source]ο
Check if pool errors are correctly reported in SMASH.
- cardano_node_tests.utils.smash_utils.check_smash_pool_retired(*, pool_id: str) list[PoolData] | None[source]ο
Check if pool is correctly reported as retired in SMASH.
- cardano_node_tests.utils.smash_utils.get_client() SmashClient | None[source]ο
Get and cache the SMASH client.
cardano_node_tests.utils.submit_api moduleο
Utilities for cardano-submit-api REST service.
- class cardano_node_tests.utils.submit_api.SubmitApiOut(txid: str, response: requests.models.Response)[source]ο
Bases:
object
- cardano_node_tests.utils.submit_api.is_running() bool[source]ο
Check if cardano-submit-api REST service is running.
- cardano_node_tests.utils.submit_api.post_cbor(*, cbor_file: str | Path, url: str) Response[source]ο
Post binary CBOR representation of Tx to cardano-submit-api service on url.
- cardano_node_tests.utils.submit_api.submit_tx(*, cluster_obj: ClusterLib, tx_file: str | Path, txins: list[UTXOData], wait_blocks: int = 2) str[source]ο
Submit a transaction, resubmit if the transaction didnβt make it to the chain.
- Parameters:
cluster_obj β An instance of clusterlib.ClusterLib.
tx_file β A path to signed transaction file.
txins β An iterable of clusterlib.UTXOData, specifying input UTxOs.
wait_blocks β A number of new blocks to wait for (default = 2).
- cardano_node_tests.utils.submit_api.submit_tx_bare(*, tx_file: str | Path) SubmitApiOut[source]ο
Submit a signed Tx using cardano-submit-api service.
cardano_node_tests.utils.submit_utils moduleο
- cardano_node_tests.utils.submit_utils.is_submit_api_available() bool[source]ο
Check if cardano-submit-api is available.
- cardano_node_tests.utils.submit_utils.submit_tx(*, submit_method: str, cluster_obj: ClusterLib, tx_file: str | Path, txins: list[UTXOData], wait_blocks: int = 2) None[source]ο
Submit a transaction using the selected method.
- Parameters:
submit_method β A method to use for submitting the transaction.
cluster_obj β An instance of clusterlib.ClusterLib.
tx_file β A path to signed transaction file.
txins β An iterable of clusterlib.UTXOData, specifying input UTxOs.
wait_blocks β A number of new blocks to wait for (default = 2).
cardano_node_tests.utils.temptools moduleο
- class cardano_node_tests.utils.temptools.PytestTempDirs[source]ο
Bases:
objectPytest temporary directories that are used accross the framework.
The class is initialized in conftest.py where we have access to the tmp_path_factory fixture.
- cardano_node_tests.utils.temptools.get_basetemp() Path[source]ο
Return base temporary directory for tests artifacts.
- cardano_node_tests.utils.temptools.get_pytest_root_tmp() Path[source]ο
Return root of the Pytest temporary directory for a single Pytest run.
Return shared temporary directory for a single Pytest run.
Temporary directory that can be shared by multiple Pytest workers, e.g. for creating lock files.
cardano_node_tests.utils.testnet_cleanup moduleο
Cleanup a testnet with the help of testing artifacts.
Withdraw rewards
Deregister stake addresses
Retire DReps
Return funds to faucet
- cardano_node_tests.utils.testnet_cleanup.addresses_info(*, cluster_obj: ClusterLib, location: Path) Tuple[int, int][source]ο
Return the total balance and rewards of all addresses in the given location.
- cardano_node_tests.utils.testnet_cleanup.batch_tx_inputs(tx_inputs: list[tuple[list[UTXOData], Path]], *, batch_size: int = 100) Generator[list[tuple[list[UTXOData], Path]], None, None][source]ο
Batch transaction inputs.
- cardano_node_tests.utils.testnet_cleanup.cleanup(*, cluster_obj: ClusterLib, location: str | Path, faucet_address: str = '', faucet_skey_file: str | Path = '') None[source]ο
Cleanup a testnet with the help of testing artifacts.
- cardano_node_tests.utils.testnet_cleanup.cleanup_addresses(*, cluster_obj: ClusterLib, location: Path, faucet_payment: AddressRecord) None[source]ο
Cleanup addresses.
- cardano_node_tests.utils.testnet_cleanup.cleanup_certs(*, cluster_obj: ClusterLib, location: Path, faucet_payment: AddressRecord) None[source]ο
Cleanup certificates.
- cardano_node_tests.utils.testnet_cleanup.create_addr_record(*, addr_file: Path) AddressRecord[source]ο
Return a clusterlib.AddressRecord.
- cardano_node_tests.utils.testnet_cleanup.dedup_addresses(file_paths: Iterator[Path]) Iterator[Path][source]ο
Deduplicate addresses.
- cardano_node_tests.utils.testnet_cleanup.dedup_tx_inputs(tx_inputs: list[tuple[list[UTXOData], Path]]) list[tuple[list[UTXOData], Path]][source]ο
Deduplicate transaction inputs.
- cardano_node_tests.utils.testnet_cleanup.deregister_stake_addr(*, cluster_obj: ClusterLib, payment_addr: AddressRecord, stake_addr: AddressRecord, stake_addr_info: StakeAddrInfo, name_template: str, deposit_amt: int) None[source]ο
Deregister stake address.
- cardano_node_tests.utils.testnet_cleanup.fees_info(*, cluster_obj: ClusterLib, location: Path) int[source]ο
Return the total fees of all signed transactions in the given location.
- cardano_node_tests.utils.testnet_cleanup.filter_addr_files(file_paths: Iterator[Path]) Iterator[Path][source]ο
Skip the β*_pycurrentβ symlinks to pytest temp dirs and faucet address.
- cardano_node_tests.utils.testnet_cleanup.find_addr_files(location: Path) Iterator[Path][source]ο
Find all β*.addrβ files in given location and its subdirectories.
- cardano_node_tests.utils.testnet_cleanup.find_cert_files(location: Path) Iterator[Path][source]ο
Find all β*_drep_reg.certβ files in given location and its subdirectories.
- cardano_node_tests.utils.testnet_cleanup.find_submitted_tx_files(location: Path) Iterator[Path][source]ο
Find all β*.submittedβ files in given location and its subdirectories.
- cardano_node_tests.utils.testnet_cleanup.flatten_tx_inputs(tx_inputs: list[tuple[list[UTXOData], Path]]) Tuple[list[UTXOData], list[Path]][source]ο
Flatten transaction inputs.
- cardano_node_tests.utils.testnet_cleanup.get_tx_inputs(*, cluster_obj: ClusterLib, src_addrs: list[AddressRecord]) list[tuple[list[UTXOData], Path]][source]ο
Return signing keys and transaction inputs for given addresses.
Exclude UTxOs that contain tokens. Donβt exclude UTxOs with datum. All the UTxOs here has βskeyβ, and so the UTxOs with datum are spendable reference inputs.
- cardano_node_tests.utils.testnet_cleanup.is_framework_testnet() bool[source]ο
Determine if the testnet is a testnet started by the testing framework.
- cardano_node_tests.utils.testnet_cleanup.reregister_stake_addr(*, cluster_obj: ClusterLib, payment_addr: AddressRecord, stake_addr: AddressRecord, stake_addr_info: StakeAddrInfo, name_template: str, deposit_amt: int) StakeAddrInfo[source]ο
Re-register stake address.
The address needs to be registered and delegated to a DRep to be able to withdraw rewards.
cardano_node_tests.utils.tx_view moduleο
Checks for transaction view CLI command.
- cardano_node_tests.utils.tx_view.check_tx_view(*, cluster_obj: ClusterLib, tx_raw_output: TxRawOutput) dict[str, Any][source]ο
Check output of the transaction view command.
cardano_node_tests.utils.types moduleο
cardano_node_tests.utils.versions moduleο
Cardano node version, cluster era, transaction era, db-sync version.
- class cardano_node_tests.utils.versions.EraName(*values)[source]ο
Bases:
StrEnumCardano era names.
Members compare equal to their lowercase era name strings (e.g.
EraName.CONWAY == "conway"), so they can be used anywhere an era name string is expected.
- class cardano_node_tests.utils.versions.Versions[source]ο
Bases:
objectProtocol version, cluster era, transaction era, node version info.
Note
cluster_eraholds the current protocol version (set via thePROTOCOL_VERSIONenv var, defaulting toDEFAULT_CLUSTER_ERA), whilecluster_era_nameis the era name that corresponds to that protocol version. The era constants below (e.g.CONWAY) are the latest protocol version associated with each era, and the*_FIRSTconstants (e.g.CONWAY_FIRST) are the first protocol version of each era. Use the*_FIRSTconstants for era membership checks (e.g.transaction_era >= VERSIONS.CONWAY_FIRSTfor βin Conway era or laterβ), so the checks keep working for all protocol versions of an era. Both sets of constants must stay consistent withMAP.
cardano_node_tests.utils.web moduleο
Functionality for publishing content on an internal web server.
- cardano_node_tests.utils.web.create_file(*, name: str, data: str, exist_ok: bool = False) str[source]ο
Create file on an internal web server and return the URL.
- cardano_node_tests.utils.web.get_published_url(*, name: str = '') str[source]ο
Return the URL of the published file.