cardano_node_tests.tests.tests_conway package

Submodules

cardano_node_tests.tests.tests_conway.conftest module

cardano_node_tests.tests.tests_conway.conftest.cluster_lock_governance(cluster_manager: ClusterManager) Tuple[ClusterLib, GovernanceRecords][source]

Mark governance as “locked” and return instance of clusterlib.ClusterLib.

cardano_node_tests.tests.tests_conway.conftest.cluster_use_committee(cluster_manager: ClusterManager) Tuple[ClusterLib, GovernanceRecords][source]

Mark governance committee as “in use” and return instance of clusterlib.ClusterLib.

cardano_node_tests.tests.tests_conway.conftest.cluster_use_dreps(cluster_manager: ClusterManager) Tuple[ClusterLib, GovernanceRecords][source]

Mark governance DReps as “in use” and return instance of clusterlib.ClusterLib.

cardano_node_tests.tests.tests_conway.conftest.cluster_use_governance(cluster_manager: ClusterManager) Tuple[ClusterLib, GovernanceRecords][source]

Mark governance as “in use” and return instance of clusterlib.ClusterLib.

cardano_node_tests.tests.tests_conway.conway_common module

Common functionality for Conway governance tests.

class cardano_node_tests.tests.tests_conway.conway_common.PParamPropRec(proposals: List[cardano_node_tests.utils.clusterlib_utils.UpdateProposal], action_txid: str, action_ix: int, proposal_names: Set[str], future_pparams: Dict[str, Any])[source]

Bases: object

action_ix: int[source]
action_txid: str[source]
future_pparams: Dict[str, Any][source]
proposal_names: Set[str][source]
proposals: List[UpdateProposal][source]
cardano_node_tests.tests.tests_conway.conway_common.cast_vote(cluster_obj: ClusterLib, governance_data: GovernanceRecords, name_template: str, payment_addr: AddressRecord, action_txid: str, action_ix: int, approve_cc: bool | None = None, approve_drep: bool | None = None, approve_spo: bool | None = None, cc_skip_votes: bool = False, drep_skip_votes: bool = False, spo_skip_votes: bool = False, use_build_cmd: bool = True, witness_count_add: int = 0) VotedVotes[source]

Cast a vote.

cardano_node_tests.tests.tests_conway.conway_common.get_committee_val(data: Dict[str, Any]) Dict[str, Any][source]

Get the committee value from the data.

The key can be either correctly “committee”, or with typo “commitee”. TODO: Remove this function when the typo is fixed in the ledger.

cardano_node_tests.tests.tests_conway.conway_common.get_no_abstain_vote(idx: int) Votes[source]

Check that votes of DReps who abstained are not considered as “No” votes.

cardano_node_tests.tests.tests_conway.conway_common.get_registered_pool_user(cluster_manager: ClusterManager, name_template: str, cluster_obj: ClusterLib, caching_key: str = '', fund_amount: int = 1000000000) PoolUser[source]

Create a registered pool user.

cardano_node_tests.tests.tests_conway.conway_common.get_yes_abstain_vote(idx: int) Votes[source]

Check that votes of DReps who abstained are not considered as “No” votes.

cardano_node_tests.tests.tests_conway.conway_common.is_in_bootstrap(cluster_obj: ClusterLib) bool[source]

Check if the cluster is in bootstrap period.

cardano_node_tests.tests.tests_conway.conway_common.possible_rem_issue(gov_state: Dict[str, Any], epoch: int) bool[source]

Check if the unexpected removed action situation can be result of known ledger issue.

When the issue manifests, only single expired action gets removed and all other expired or ratified actions are ignored int the given epoch.

See https://github.com/IntersectMBO/cardano-ledger/issues/3979

cardano_node_tests.tests.tests_conway.conway_common.propose_change_constitution(cluster_obj: ClusterLib, name_template: str, anchor_url: str, anchor_data_hash: str, constitution_url: str, constitution_hash: str, pool_user: PoolUser, constitution_script_hash: str = '') Tuple[ActionConstitution, str, int][source]

Propose a constitution change.

cardano_node_tests.tests.tests_conway.conway_common.propose_pparams_update(cluster_obj: ClusterLib, name_template: str, anchor_url: str, anchor_data_hash: str, pool_user: PoolUser, proposals: List[UpdateProposal], prev_action_rec: PrevActionRec | None = None) PParamPropRec[source]

Propose a pparams update.

cardano_node_tests.tests.tests_conway.conway_common.resign_ccs(cluster_obj: ClusterLib, name_template: str, ccs_to_resign: List[CCMember], payment_addr: AddressRecord) TxRawOutput[source]

Resign multiple CC Members.

cardano_node_tests.tests.tests_conway.conway_common.save_committee_state(committee_state: Dict[str, Any], name_template: str) None[source]

Save CC state to a file.

cardano_node_tests.tests.tests_conway.conway_common.save_drep_state(drep_state: List[List[Dict[str, Any]]], name_template: str) None[source]

Save DRep state to a file.

cardano_node_tests.tests.tests_conway.conway_common.save_gov_state(gov_state: Dict[str, Any], name_template: str) None[source]

Save governance state to a file.

cardano_node_tests.tests.tests_conway.conway_common.submit_vote(cluster_obj: ClusterLib, name_template: str, payment_addr: AddressRecord, votes: List[VoteCC | VoteDrep | VoteSPO], keys: List[str | Path], script_votes: List[ScriptVote] | Tuple[()] = (), submit_method: str = '', use_build_cmd: bool = True, witness_count_add: int = 0) TxRawOutput[source]

Submit a Tx with votes.

cardano_node_tests.tests.tests_conway.test_committee module

Tests for Conway governance Constitutional Committee functionality.

class cardano_node_tests.tests.tests_conway.test_committee.TestCommittee[source]

Bases: object

Tests for Constitutional Committee.

test_add_rm_committee_members(cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser, testfile_temp_dir: Path, request: FixtureRequest)[source]

Test adding and removing CC members.

  • authorize hot keys of 3 new potential CC members

  • create the first “update committee” action to add 2 of the 3 new potential CC members

    • the first CC member is listed twice to test that it’s not possible to add the same member multiple times

    • the first CC member expires in 3 epochs, the second and third in 5 epochs

    • vote to disapprove the action

    • vote to approve the action

    • check that CC members votes have no effect

    • check that the action is ratified

    • try to disapprove the ratified action, this shouldn’t have any effect

    • check that the action is enacted

    • check that the new CC members were added

    • check that it’s not possible to vote on enacted action

  • check that the first CC member has expired as expected

  • create the second “update committee” action to remove the second CC member

    • propose the action at the same epoch as the first action

    • use the first action as previous action

    • vote to disapprove the action

    • vote to approve the action in the same epoch as the first action was approved

    • check that CC members votes have no effect

    • check that the action is ratified

    • try to disapprove the ratified action, this shouldn’t have any effect

    • check that the action is enacted one epoch after the first action, due to the ratification delay

    • check that the second CC member was removed

    • check that it’s not possible to vote on enacted action

  • resign the third CC member

  • check output of votes and action view commands

  • check deposit is returned to user reward account after enactment

  • (optional) check committee members in db-sync

test_committee_zero_threshold(cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser)[source]

Test that actions that require CC approval can be ratified when threshold == 0.

Even if the CC disapprove the action.

  • set CC threshold to zero

  • submit a “create constitution” action

  • vote to disapprove the action by the CC and approve by the DReps

  • check that the action is ratified

  • check that the action is enacted

test_empty_committee(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser)[source]

Test electing empty Constitutional Committee.

  • create “protocol parameters update” action to set committeeMinSize to 0

    • vote to approve the action

    • check that the action is ratified

    • check that the action is enacted

    • check that the committeeMinSize pparam was set to 0

  • create an “update committee” action to remove all CC members

    • vote to approve the action

    • check that the action is ratified

    • check that the action is enacted

    • check that all CC members were removed

  • create a “create constitution” action
    • vote to approve the action without needing CC members votes

    • check that the action is ratified

    • check that the action is enacted

test_register_hot_key_no_cc_member(cluster_use_committee: Tuple[ClusterLib, GovernanceRecords], payment_addr_comm: AddressRecord, use_build_cmd: bool, submit_method: str)[source]

Try to submit a Hot Credential Authorization certificate without being a CC member.

Expect failure.

test_update_committee_action(cluster: ClusterLib, pool_user: PoolUser, use_build_cmd: bool, submit_method: str, threshold_type: str)[source]

Test update committee action.

  • add CC Members

  • update committee threshold

  • check that the proposed changes are correct in query gov-state

test_update_committee_threshold_out_of_range(cluster: ClusterLib, pool_user: PoolUser) None[source]

Test update committee threshold with a value out of range [0,1].

Expect failure.

cardano_node_tests.tests.tests_conway.test_committee.payment_addr_comm(cluster_manager: ClusterManager, cluster_use_committee: Tuple[ClusterLib, GovernanceRecords]) AddressRecord[source]

Create new payment address.

cardano_node_tests.tests.tests_conway.test_committee.pool_user(cluster_manager: ClusterManager, cluster: ClusterLib) PoolUser[source]

Create a pool user.

cardano_node_tests.tests.tests_conway.test_committee.pool_user_lg(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

cardano_node_tests.tests.tests_conway.test_constitution module

Tests for Conway governance constitution.

class cardano_node_tests.tests.tests_conway.test_constitution.TestConstitution[source]

Bases: object

Tests for constitution.

test_change_constitution(cluster_lock_gov_script: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser, governance_w_scripts_lg: GovernanceRecords)[source]

Test enactment of change of constitution.

  • submit a “create constitution” action

  • check that SPOs cannot vote on a “create constitution” action

  • vote to disapprove the action

  • vote to approve the action

  • check that the action is ratified

  • try to disapprove the ratified action, this shouldn’t have any effect

  • check that the action is enacted

  • check that it’s not possible to vote on enacted action

cardano_node_tests.tests.tests_conway.test_constitution.cluster_lock_gov_script(cluster_manager: ClusterManager) Tuple[ClusterLib, GovernanceRecords][source]

Mark governance as “locked” and return instance of clusterlib.ClusterLib.

Lock also the PlutusV3 script that is registered as DRep in the test.

cardano_node_tests.tests.tests_conway.test_constitution.governance_w_scripts_lg(cluster_lock_gov_script: Tuple[ClusterLib, GovernanceRecords], script_dreps_lg: Tuple[List[DRepScriptRegistration], List[PoolUser]]) GovernanceRecords[source]

Create a governance records with script DReps.

cardano_node_tests.tests.tests_conway.test_constitution.pool_user_lg(cluster_manager: ClusterManager, cluster_lock_gov_script: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

cardano_node_tests.tests.tests_conway.test_constitution.script_dreps_lg(cluster_manager: ClusterManager, cluster_lock_gov_script: Tuple[ClusterLib, GovernanceRecords], testfile_temp_dir: Path) Generator[Tuple[List[DRepScriptRegistration], List[PoolUser]], None, None][source]

Create script DReps for “lock governance”.

cardano_node_tests.tests.tests_conway.test_conway module

Tests for Conway features that doesn’t fit into any more specific file.

class cardano_node_tests.tests.tests_conway.test_conway.TestConway[source]

Bases: object

General tests for Conway era.

test_genesis_cert_not_available(cluster: ClusterLib)[source]

Check that the create-genesis-key-delegation-certificate command is not available.

cardano_node_tests.tests.tests_conway.test_drep module

Tests for Conway governance DRep functionality.

class cardano_node_tests.tests.tests_conway.test_drep.DRepRatRecord(id: str, ratified: bool)[source]

Bases: object

id: str[source]
ratified: bool[source]
class cardano_node_tests.tests.tests_conway.test_drep.DRepStateRecord(epoch_no: int, id: str, drep_state: List[List[Dict[str, Any]]])[source]

Bases: object

drep_state: List[List[Dict[str, Any]]][source]
epoch_no: int[source]
id: str[source]
class cardano_node_tests.tests.tests_conway.test_drep.TestDRepActivity[source]

Bases: object

Tests for DReps activity.

pool_user_lg(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

This fixture is NOT cached, as it is used only in one test.

test_drep_inactivity(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser)[source]

Test DRep inactivity.

  • Create the first DRep and delegate to it.

  • Update the dRepActivity parameter to 1.

  • Create the second DRep and delegate to it.

  • Update DRep activity again so there is a proposal to vote for. The newly created DReps will not vote. The action will not be ratified, because the newly created DReps didn’t vote and their delegated stake is > 51% (threshold).

  • Update DRep activity again so there is a proposal to vote for. The newly created DRep1 will vote. The action will be ratified, because the newly created DRep1 voted and together with the original DReps their delegated stake is > 51% (threshold).

  • Update DRep activity again so there is a proposal to vote for. The newly created DReps will not vote. The action will be ratified, because the newly created DReps are inactive and so their delegated stake does not count towards the active voting stake.

  • Wait for another epoch without submitting any proposal, to see if “expire” counters are incremented.

  • Update DRep activity again so there is a proposal to vote for. The newly created DRep2 will vote. The action will be ratified, because the newly created DRep2 voted and together with the original DReps their delegated stake is > 51% (threshold).

  • Check DRep activity records using saved DRep status data.

class cardano_node_tests.tests.tests_conway.test_drep.TestDReps[source]

Bases: object

Tests for DReps.

test_drep_id_is_blake2b_224_of_drep_vkey(cluster: ClusterLib)[source]

Test proper drep id is being generated.

  • Register a drep

  • Hash drep vkey using blake2b_224

  • Check drep ID generated from cli is same as blake2b_224 hash of drep vkey

test_register_and_retire_drep(cluster: ClusterLib, payment_addr: AddressRecord, use_build_cmd: bool, submit_method: str)[source]

Test DRep registration and retirement.

  • register DRep

  • check that DRep was registered

  • retire DRep

  • check that DRep was retired

  • check that deposit was returned to source address

test_register_wrong_metadata(cluster: ClusterLib, payment_addr: AddressRecord, testfile_temp_dir: Path, request: FixtureRequest)[source]

Register a DRep with wrong metadata url.

  • register DRep with mismatch url metadata vs metadata file

  • check that DRep was registered

  • verify that dbsync is returning an error

class cardano_node_tests.tests.tests_conway.test_drep.TestDelegDReps[source]

Bases: object

Tests for votes delegation to DReps.

test_change_delegation(cluster_rewards: ClusterLib, cluster_manager: ClusterManager, payment_addr_rewards: AddressRecord, pool_user_rewards: PoolUser, testfile_temp_dir: Path, request: FixtureRequest)[source]

Test Change delegation to different dreps.

  • Create 2 Dreps

  • Create vote delegation certifcate for first drep

  • Submit certificate

  • check that the delegation is of correct drep id

  • Change delegation to drep2 and submit certificate

  • Check vote delegation is updated to second drep

test_cli_drep_status_consistency(cluster_use_dreps: Tuple[ClusterLib, GovernanceRecords])[source]

Test consistency of cardano-cli conway query drep-state output.

  • List status of all DReps

  • List status of selected DReps

  • Compare the output to check that it is consistent

test_dreps_and_spo_delegation(cluster_and_pool_and_rewards: Tuple[ClusterLib, str], payment_addr_wpr: AddressRecord, pool_user_wpr: PoolUser, custom_drep_wpr: DRepRegistration, testfile_temp_dir: Path, request: FixtureRequest, use_build_cmd: bool, submit_method: str, drep: str)[source]

Test delegating to DRep and SPO using single certificate.

  • register stake address

  • delegate stake to a stake pool and to following DReps:

    • always-abstain

    • always-no-confidence

    • custom DRep

  • check that the stake address is registered and delegated

test_dreps_delegation(cluster_rewards: ClusterLib, payment_addr_rewards: AddressRecord, pool_user_rewards: PoolUser, custom_drep_rewards: DRepRegistration, testfile_temp_dir: Path, request: FixtureRequest, use_build_cmd: bool, submit_method: str, drep: str)[source]

Test delegating to DReps.

  • register stake address

  • delegate stake to following DReps:

    • always-abstain

    • always-no-confidence

    • custom DRep

  • check that the stake address is registered

class cardano_node_tests.tests.tests_conway.test_drep.TestNegativeDReps[source]

Bases: object

Tests for DReps where we test failing condition.

test_drep_no_multiple_registration(cluster: ClusterLib, payment_addr: AddressRecord, use_build_cmd: bool, submit_method: str)[source]

Test Drep cannot be registered multiple time.

  • Generate drep keys

  • Create a drep registration certificate

  • Submit the registration certificate twice

  • Expect ConwayDRepAlreadyRegistered on the second time

test_drep_no_retirement_before_register(cluster: ClusterLib, payment_addr: AddressRecord, use_build_cmd: bool, submit_method: str)[source]

Test No Drep retirement before register.

  • Create a retirement certificate without registering

  • Submit certificate

  • check it is not possible to retire before register

test_no_delegation_without_stake_registration(cluster: ClusterLib, payment_addr: AddressRecord, pool_user: PoolUser, custom_drep: DRepRegistration, drep: str)[source]

Test No voting delegation without registering stake address first.

  • Use a wallet without registered stake address

  • Create vote delegation certifcate using unregistered wallet stake key

  • Submit the certificate

  • Expect error StakeKeyNotRegisteredDELEG

test_no_multiple_delegation(cluster_rewards: ClusterLib, cluster_manager: ClusterManager, payment_addr_rewards: AddressRecord, pool_user_rewards: PoolUser, testfile_temp_dir: Path, request: FixtureRequest)[source]

Test No multiple delegation to different dreps.

  • Create 2 Dreps

  • Create vote delegation certifcate to both dreps

  • Submit both certificates

  • check that the Drep certificate placed at last of the certificates is delegated to

test_no_witness_register_and_retire(cluster: ClusterLib, payment_addr: AddressRecord, use_build_cmd: bool)[source]

Test DRep registration and retirement without needing an skey as witness.

There was a ledger issue that allowed a DRep to be registered without needing the corresponding skey witness.

  • try to register DRep without skey, expect failure

  • register DRep

  • check that DRep was registered

  • try to retire DRep without skey, expect failure

  • retire DRep

  • check that DRep was retired

cardano_node_tests.tests.tests_conway.test_drep.cluster_and_pool_and_rewards(cluster_manager: ClusterManager) Tuple[ClusterLib, str][source]
cardano_node_tests.tests.tests_conway.test_drep.cluster_rewards(cluster_manager: ClusterManager) ClusterLib[source]
cardano_node_tests.tests.tests_conway.test_drep.create_drep(name_template: str, cluster_obj: ClusterLib, payment_addr: AddressRecord) DRepRegistration[source]

Create a DRep.

cardano_node_tests.tests.tests_conway.test_drep.custom_drep(cluster_manager: ClusterManager, cluster: ClusterLib, payment_addr: AddressRecord) DRepRegistration[source]
cardano_node_tests.tests.tests_conway.test_drep.custom_drep_rewards(cluster_manager: ClusterManager, cluster_rewards: ClusterLib, payment_addr_rewards: AddressRecord) DRepRegistration[source]
cardano_node_tests.tests.tests_conway.test_drep.custom_drep_wpr(cluster_manager: ClusterManager, cluster_and_pool_and_rewards: Tuple[ClusterLib, str], payment_addr_wpr: AddressRecord) DRepRegistration[source]
cardano_node_tests.tests.tests_conway.test_drep.get_custom_drep(name_template: str, cluster_manager: ClusterManager, cluster_obj: ClusterLib, payment_addr: AddressRecord, caching_key: str) DRepRegistration[source]

Create a custom DRep and cache it.

cardano_node_tests.tests.tests_conway.test_drep.get_payment_addr(name_template: str, cluster_manager: ClusterManager, cluster_obj: ClusterLib, caching_key: str) AddressRecord[source]

Create new payment address.

cardano_node_tests.tests.tests_conway.test_drep.get_pool_user(name_template: str, cluster_manager: ClusterManager, cluster_obj: ClusterLib, caching_key: str) PoolUser[source]

Create a pool user.

cardano_node_tests.tests.tests_conway.test_drep.payment_addr(cluster_manager: ClusterManager, cluster: ClusterLib) AddressRecord[source]
cardano_node_tests.tests.tests_conway.test_drep.payment_addr_rewards(cluster_manager: ClusterManager, cluster_rewards: ClusterLib) AddressRecord[source]
cardano_node_tests.tests.tests_conway.test_drep.payment_addr_wpr(cluster_manager: ClusterManager, cluster_and_pool_and_rewards: Tuple[ClusterLib, str]) AddressRecord[source]
cardano_node_tests.tests.tests_conway.test_drep.pool_user(cluster_manager: ClusterManager, cluster: ClusterLib) PoolUser[source]
cardano_node_tests.tests.tests_conway.test_drep.pool_user_rewards(cluster_manager: ClusterManager, cluster_rewards: ClusterLib) PoolUser[source]
cardano_node_tests.tests.tests_conway.test_drep.pool_user_wpr(cluster_manager: ClusterManager, cluster_and_pool_and_rewards: Tuple[ClusterLib, str]) PoolUser[source]

cardano_node_tests.tests.tests_conway.test_guardrails module

Tests for Conway governance guardrails.

class cardano_node_tests.tests.tests_conway.test_guardrails.ClusterWithConstitutionRecord(cluster: ClusterLib, constitution_script_file: Path, constitution_script_hash: str, default_constitution: Dict[str, Any], pool_user: PoolUser, payment_addr: AddressRecord, collaterals: List[UTXOData])[source]

Bases: object

Class to store the cluster with constitution record.

cluster: ClusterLib[source]
collaterals: List[UTXOData][source]
constitution_script_file: Path[source]
constitution_script_hash: str[source]
default_constitution: Dict[str, Any][source]
payment_addr: AddressRecord[source]
pool_user: PoolUser[source]
class cardano_node_tests.tests.tests_conway.test_guardrails.GuardrailTestParam(param_key: str, param_cli_arg: str, param_name: str, param_lower_limit: int | None = None, param_upper_limit: int | None = None)[source]

Bases: object

Class to store parameter information for the guardrail test.

param_cli_arg: str[source]
param_key: str[source]
param_lower_limit: int | None = None[source]
param_name: str[source]
param_upper_limit: int | None = None[source]
exception cardano_node_tests.tests.tests_conway.test_guardrails.PredicateNotSupportedError(predicate: dict)[source]

Bases: Exception

class cardano_node_tests.tests.tests_conway.test_guardrails.TestGovernanceGuardrails[source]

Bases: object

test_guardrails(cluster_with_constitution: ClusterWithConstitutionRecord, subtests: SubTests)[source]

Test governance guardrails using plutus script constitution.

  • Enact a new constitution with a plutus script

  • Propose parameter change for different guardrail checks

  • Check that the guardrails are enforced

  • Expecting plutus error in case of invalid proposals

  • Expecting valid proposals to be accepted

  • Data file used : data/defaultConstitution.json

cardano_node_tests.tests.tests_conway.test_guardrails.check_invalid_proposals(cluster_with_constitution: ClusterWithConstitutionRecord, proposals: List[UpdateProposal])[source]

Check that the guardrails are enforced.

cardano_node_tests.tests.tests_conway.test_guardrails.check_max_value_proposals(cluster_with_constitution: ClusterWithConstitutionRecord, param: GuardrailTestParam, max_value: int | float, dependent_proposals: List[UpdateProposal] | Tuple, type_upper_limit: int)[source]

Check invalid proposals for max value predicate (must not exceed).

cardano_node_tests.tests.tests_conway.test_guardrails.check_min_value_proposals(cluster_with_constitution: ClusterWithConstitutionRecord, param: GuardrailTestParam, min_value: int | float, dependent_proposals: List[UpdateProposal] | Tuple)[source]

Check invalid proposals for min value predicate (must not be lower than).

cardano_node_tests.tests.tests_conway.test_guardrails.check_valid_proposals(cluster_with_constitution: ClusterWithConstitutionRecord, proposals: List[UpdateProposal])[source]
cardano_node_tests.tests.tests_conway.test_guardrails.cluster_guardrails(cluster_manager: ClusterManager) Tuple[ClusterLib, GovernanceRecords][source]

Mark governance as “locked” and return instance of clusterlib.ClusterLib.

Also mark guardrails tests with “guardrails” marker. As such, all the tests will run on the same cluster instance where the initial setup was already done (by the first test).

Cleanup (== respin the cluster instance) after the tests are finished.

cardano_node_tests.tests.tests_conway.test_guardrails.cluster_with_constitution(cluster_guardrails: Tuple[ClusterLib, GovernanceRecords], pool_user: PoolUser, payment_addr: AddressRecord) ClusterWithConstitutionRecord[source]

Enact the constitution with guardrails plutus script and return constitution data.

cardano_node_tests.tests.tests_conway.test_guardrails.get_subtests() Generator[Callable, None, None][source]

Get the guardrails scenarios.

The scenarios are executed as subtests in the test_guardrails test.

cardano_node_tests.tests.tests_conway.test_guardrails.get_upper_limit_according_to_type(type: str) int[source]

Check the value of type and return upper limit accordingly.

cardano_node_tests.tests.tests_conway.test_guardrails.payment_addr(cluster_manager: ClusterManager, cluster_guardrails: Tuple[ClusterLib, GovernanceRecords]) AddressRecord[source]

Create new payment address.

cardano_node_tests.tests.tests_conway.test_guardrails.perform_predicates_check(cluster_with_constitution: ClusterWithConstitutionRecord, param: GuardrailTestParam, dependent_proposals: List[UpdateProposal] | Tuple = ())[source]

Check for predicates defined in the constitution.

  • Check invalid proposals from the predicates

  • Check valid proposals using the valid range of values

cardano_node_tests.tests.tests_conway.test_guardrails.perform_predicates_check_with_dependent_params(cluster_with_constitution: ClusterWithConstitutionRecord, param: GuardrailTestParam, dependent_params: List[GuardrailTestParam])[source]

Check for predicates defined in the constitution with dependent parameters.

Eg: executionUnitPrices[priceMemory] and executionUnitPrices[priceSteps] are dependent parameters.

cardano_node_tests.tests.tests_conway.test_guardrails.pool_user(cluster_manager: ClusterManager, cluster_guardrails: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

cardano_node_tests.tests.tests_conway.test_guardrails.propose_param_changes(cluster_with_constitution: ClusterWithConstitutionRecord, proposals: List[UpdateProposal]) str[source]

Build and submit update pparams action with specified proposals.

cardano_node_tests.tests.tests_conway.test_hardfork module

Tests for Conway hard-fork.

class cardano_node_tests.tests.tests_conway.test_hardfork.TestHardfork[source]

Bases: object

Tests for hard-fork.

skip_hf_command()[source]
test_hardfork(skip_hf_command: None, cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser)[source]

Test hardfork action.

  • create a “hardfork” action

  • check that DReps cannot vote during the bootstrap period

  • vote to disapprove the action

  • vote to approve the action

  • check that the action is ratified

  • try to disapprove the ratified action, this shouldn’t have any effect

  • check that the action is enacted

  • check that it’s not possible to vote on enacted action

cardano_node_tests.tests.tests_conway.test_hardfork.pool_user_lg(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

cardano_node_tests.tests.tests_conway.test_info module

Tests for Conway governance info.

class cardano_node_tests.tests.tests_conway.test_info.TestInfo[source]

Bases: object

Tests for info.

GOV_ACTION_ANCHOR_FILE = PosixPath('/home/martink/Source/repos/cardano-node-tests/cardano_node_tests/tests/data/governance_action_anchor.json')[source]
test_info(cluster_use_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_ug: PoolUser)[source]

Test voting on info action.

  • submit an “info” action

  • vote on the action

  • check the votes

  • check for deposit return

cardano_node_tests.tests.tests_conway.test_info.pool_user_ug(cluster_manager: ClusterManager, cluster_use_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “use governance”.

cardano_node_tests.tests.tests_conway.test_no_confidence module

Tests for Conway governance state of no confidence.

class cardano_node_tests.tests.tests_conway.test_no_confidence.TestNoConfidence[source]

Bases: object

Tests for state of no confidence.

test_committee_min_size(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser)[source]

Test that actions cannot be ratified when the number of CC members < committeeMinSize.

Only update-committee and no-confidence governance actions can be ratified.

  • resign all CC Members but one

  • try to ratify a “create constitution” action

  • check that the action is not ratified

  • reinstate the original CC members

test_no_confidence_action(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser)[source]

Test enactment of no confidence action.

  • create a “no confidence” action

  • vote to disapprove the action

  • vote to approve the action

  • check that CC members votes have no effect

  • check that the action is ratified

  • try to disapprove the ratified action, this shouldn’t have any effect

  • check that the action is enacted

  • check that it’s not possible to vote on enacted action

cardano_node_tests.tests.tests_conway.test_no_confidence.pool_user_lg(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

cardano_node_tests.tests.tests_conway.test_pparam_update module

Tests for Conway governance protocol parameters update.

class cardano_node_tests.tests.tests_conway.test_pparam_update.TestLegacyProposals[source]

Bases: object

Tests for legacy update proposals in Conway.

payment_addr(cluster_manager: ClusterManager, cluster: ClusterLib) AddressRecord[source]

Create new payment address.

test_legacy_proposal_build(cluster: ClusterLib)[source]

Test building a legacy update proposal with Conway cardano-cli.

Expect failure as the legacy update proposals are not supported in Conway.

test_legacy_proposal_submit(cluster: ClusterLib, payment_addr: AddressRecord, submit_method: str)[source]

Test submitting a legacy update proposal in Conway.

Expect failure as the legacy update proposals are not supported in Conway.

class cardano_node_tests.tests.tests_conway.test_pparam_update.TestPParamData[source]

Bases: object

Tests for checking protocol parameters keys and values.

test_pparam_keys(cluster: ClusterLib)[source]

Test presence of expected protocol parameters keys.

class cardano_node_tests.tests.tests_conway.test_pparam_update.TestPParamUpdate[source]

Bases: object

Tests for protocol parameters update.

pool_user_lg(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

test_pparam_negative_value(cluster: ClusterLib)[source]

Test creation of pparam update with negative value.

test_pparam_update(cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_lg: PoolUser)[source]

Test enactment of protocol parameter update.

  • submit multiple “protocol parameters update” action

    • one action for each parameter group

    • one action with multiple proposals from different groups

  • vote to disapprove the actions

  • submit a “protocol parameters update” action that will be enacted

  • check that SPOs cannot vote on a “protocol parameters update” action that doesn’t change security parameters

  • vote to approve the action

  • check that the action is ratified

  • try to disapprove the ratified action, this shouldn’t have any effect

  • check that the action is enacted

  • check that only the ratified action that got accepted first to the chain gets enacted

  • check that it’s not possible to vote on enacted action

  • check that all deposit required for actions is returned back for both expired and enacted actions

cardano_node_tests.tests.tests_conway.test_treasury_donation module

Tests for treasury donation.

class cardano_node_tests.tests.tests_conway.test_treasury_donation.TestTreasuryDonation[source]

Bases: object

Test treasury donation - transferring donation, check treasury state in pots.

test_dbsync_transfer_treasury_donation(cluster_singleton: ClusterLib, payment_addr_singleton: AddressRecord)[source]

Send funds from payment address to the treasury and check the amounts in db-sync.

The test is a singleton (the only test that can run on a testnet at a time) so that the pots are not modified by other tests.

  • send funds from 1 source address to to the treasury

  • check expected balances for both source addresses and treasury

  • check transactions and ADA pots in db-sync

test_transfer_treasury_donation(cluster_treasury: ClusterLib, payment_addr_treasury: AddressRecord, use_build_cmd: bool, submit_method: str)[source]

Send funds from payment address to the treasury.

The test doesn’t check the actual treasury balance, only that the transaction can be built and submitted.

  • send funds from 1 source address to to the treasury

  • check expected balances

cardano_node_tests.tests.tests_conway.test_treasury_donation.cluster_treasury(cluster_manager: ClusterManager) ClusterLib[source]
cardano_node_tests.tests.tests_conway.test_treasury_donation.payment_addr_singleton(cluster_manager: ClusterManager, cluster_singleton: ClusterLib) AddressRecord[source]

Create new payment address.

This fixture is used by single test, so it is not cached.

cardano_node_tests.tests.tests_conway.test_treasury_donation.payment_addr_treasury(cluster_manager: ClusterManager, cluster_treasury: ClusterLib) AddressRecord[source]

Create new payment address.

cardano_node_tests.tests.tests_conway.test_treasury_withdrawals module

Tests for Conway governance treasury withdrawals.

class cardano_node_tests.tests.tests_conway.test_treasury_withdrawals.TestTreasuryWithdrawals[source]

Bases: object

Tests for treasury withdrawals.

test_enact_treasury_withdrawals(cluster_use_governance_lock_treasury: Tuple[ClusterLib, GovernanceRecords], pool_user_ug_treasury: PoolUser)[source]

Test enactment of multiple treasury withdrawals in single epoch.

Use transaction build for building the transactions. When available, use cardano-submit-api for votes submission.

  • submit multiple “treasury withdrawal” actions

  • check that SPOs cannot vote on a “treasury withdrawal” action

  • vote to approve the actions

  • check that the actions are ratified

  • try to disapprove the ratified action, this shouldn’t have any effect

  • check that the action are enacted

  • check that it’s not possible to vote on enacted action

test_expire_treasury_withdrawals(cluster_use_governance: Tuple[ClusterLib, GovernanceRecords], pool_user_ug: PoolUser)[source]

Test expiration of treasury withdrawals.

Use transaction build-raw for building the transactions. When available, use cardano-submit-api for proposal submission.

  • submit multiple “treasury withdrawal” actions

  • vote in a way that the actions are not approved

    • first action is approved by CC and disapproved by DReps

    • second action is disapproved by CC and approved by DReps

    • third action is disapproved by both CC and DReps

  • check that the actions are not ratified

  • check that the actions expire and action deposits are returned

test_mir_certificates(cluster: ClusterLib, mir_cert: str)[source]

Try to withdraw funds from the treasury using MIR certificates.

Expect failure.

cardano_node_tests.tests.tests_conway.test_treasury_withdrawals.cluster_use_governance_lock_treasury(cluster_manager: ClusterManager) Tuple[ClusterLib, GovernanceRecords][source]

Mark governance as “in use”, treasury pot as locked.

Return instance of clusterlib.ClusterLib.

cardano_node_tests.tests.tests_conway.test_treasury_withdrawals.pool_user_ug(cluster_manager: ClusterManager, cluster_use_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “use governance”.

cardano_node_tests.tests.tests_conway.test_treasury_withdrawals.pool_user_ug_treasury(cluster_manager: ClusterManager, cluster_use_governance_lock_treasury: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “use governance, lock treasury”.

cardano_node_tests.tests.tests_conway.test_update_plutusv2_builtins module

Tests for updating PlutusV2 built-ins in Conway.

class cardano_node_tests.tests.tests_conway.test_update_plutusv2_builtins.TestUpdateBuiltIns[source]

Bases: object

Tests for updating PlutusV2 built-ins.

test_update_in_pv9(cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords], payment_addrs_lg: List[AddressRecord], pool_user_lg: PoolUser)[source]

Test updating PlutusV2 cost model in PV9.

Checks behavior with PlutusV2 script that uses built-ins added from PlutusV3. So far the new built-ins are enabled only in PV10, and are expected to fail in PV9.

  • check that Plutus script fails as expected in PV9

  • update the PlutusV2 cost model

  • check again that the Plutus script fails as expected in PV9

cardano_node_tests.tests.tests_conway.test_update_plutusv2_builtins.payment_addrs_lg(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords]) List[AddressRecord][source]

Create new payment address.

cardano_node_tests.tests.tests_conway.test_update_plutusv2_builtins.pool_user_lg(cluster_manager: ClusterManager, cluster_lock_governance: Tuple[ClusterLib, GovernanceRecords]) PoolUser[source]

Create a pool user for “lock governance”.

Module contents