From ed180abeea16d6f123784904d7db1f2a33f2af71 Mon Sep 17 00:00:00 2001 From: femi Date: Fri, 12 Dec 2025 11:15:17 +0000 Subject: [PATCH 1/7] update compatible tests --- .../tests_conway/test_treasury_withdrawals.py | 91 +++++++++---------- 1 file changed, 42 insertions(+), 49 deletions(-) diff --git a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py index 0f5592f1f..801dc3af2 100644 --- a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py +++ b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py @@ -11,7 +11,6 @@ from cardano_node_tests.tests import common from cardano_node_tests.tests import reqs_conway as reqc from cardano_node_tests.tests.tests_conway import conway_common -from cardano_node_tests.utils import cluster_nodes from cardano_node_tests.utils import clusterlib_utils from cardano_node_tests.utils import configuration from cardano_node_tests.utils import dbsync_utils @@ -720,15 +719,9 @@ def test_expire_treasury_withdrawals( class TestMIRCerts: """Tests for MIR certificates.""" - @pytest.fixture(scope="class") - def skip_on_missing_legacy(self) -> None: - if not clusterlib_utils.cli_has("legacy governance"): - pytest.skip("`legacy governance` commands are not available") - @pytest.fixture def payment_addr( self, - skip_on_missing_legacy: None, # noqa: ARG002 cluster_manager: cluster_management.ClusterManager, cluster: clusterlib.ClusterLib, ) -> clusterlib.AddressRecord: @@ -749,7 +742,6 @@ def payment_addr( @pytest.mark.smoke def test_mir_certificates( self, - skip_on_missing_legacy: None, # noqa: ARG002 cluster: clusterlib.ClusterLib, payment_addr: clusterlib.AddressRecord, mir_cert: str, @@ -759,42 +751,46 @@ def test_mir_certificates( Expect failure. * try and fail to build the Tx using `transaction build` - * successfully build the Tx as Babbage Tx using `transaction build-raw` - * try and fail to submit the Babbage Tx + * successfully build the Tx as Babbage Tx using compatible `signed-transaction` + * try and fail to submit the Babbage Tx (expected era mismatch) """ - # TODO: convert to use `compatible babbage governance create-mir-certificate` temp_template = common.get_test_id(cluster) amount = 1_500_000 reqc.cip070.start(url=helpers.get_vcs_link()) + # Generate MIR certificate using compatible governance commands if mir_cert == "to_treasury": - cert_file = cluster.g_legacy_governance.gen_mir_cert_to_treasury( - transfer=amount, - tx_name=temp_template, + cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + name=temp_template, + subcommand="transfer-to-treasury", + transfer_amt=amount, ) elif mir_cert == "to_rewards": - cert_file = cluster.g_legacy_governance.gen_mir_cert_to_rewards( - transfer=amount, - tx_name=temp_template, + cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + name=temp_template, + subcommand="transfer-to-rewards", + transfer_amt=amount, ) elif mir_cert == "treasury_to_addr": - cert_file = cluster.g_legacy_governance.gen_mir_cert_stake_addr( - tx_name=temp_template, - stake_addr="stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt", + cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + name=temp_template, + subcommand="stake-addresses", + stake_address="stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt", reward=amount, - use_treasury=True, + funds="treasury", ) elif mir_cert == "reserves_to_addr": - cert_file = cluster.g_legacy_governance.gen_mir_cert_stake_addr( - tx_name=temp_template, - stake_addr="stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt", + cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + name=temp_template, + subcommand="stake-addresses", + stake_address="stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt", reward=amount, - use_treasury=False, + funds="reserves", ) else: - _verr = f"Unknown MIR cert scenario: {mir_cert}" - raise ValueError(_verr) + msg = f"Unknown MIR certificate: {mir_cert}" + raise ValueError(msg) tx_files = clusterlib.TxFiles( certificate_files=[cert_file], @@ -804,7 +800,7 @@ def test_mir_certificates( ], ) - # The Tx cannot be build in Conway using `build` + # Conway cannot build MIR Tx using the Conway `build` command, expect failure with pytest.raises(clusterlib.CLIError) as excinfo: cluster.g_transaction.build_tx( tx_name=temp_template, @@ -814,28 +810,25 @@ def test_mir_certificates( err_build = str(excinfo.value) assert "TextEnvelope type error:" in err_build, err_build - # The Tx can be build as Babbage Tx using `build-raw`, but cannot be submitted. - # TODO: convert to use `compatible babbage transaction signed-transaction` - if clusterlib_utils.cli_has("babbage transaction build-raw"): - cluster_babbage = cluster_nodes.get_cluster_type().get_cluster_obj( - command_era="babbage" - ) - tx_output = cluster_babbage.g_transaction.build_raw_tx( - tx_name=temp_template, - src_address=payment_addr.address, - fee=400_000, - tx_files=tx_files, - ) + # Build a Babbage-era signed Tx using compatible signed-transaction + signed_tx = cluster.g_compatible.babbage.transaction.gen_signed_tx( + name=temp_template, + src_address=payment_addr.address, + txouts=[], + tx_files=tx_files, + fee=400_000, + ) - out_file_signed = cluster.g_transaction.sign_tx( - tx_body_file=tx_output.out_file, - signing_key_files=tx_files.signing_key_files, - tx_name=temp_template, + # Submitting this Babbage Tx in Conway should fail (era mismatch expected) + with pytest.raises(clusterlib.CLIError) as excinfo: + cluster.g_transaction.submit_tx( + tx_file=signed_tx.out_file, + txins=signed_tx.txins, ) - - with pytest.raises(clusterlib.CLIError) as excinfo: - cluster.g_transaction.submit_tx(tx_file=out_file_signed, txins=tx_output.txins) - err_submit = str(excinfo.value) - assert "Error: The era of the node and the tx do not match." in err_submit, err_submit + err_submit = str(excinfo.value) + assert "era" in err_submit or "mismatch" in err_submit, err_submit reqc.cip070.success() + + +reqc.cip070.success() From fdf5a43592caf46f8a64a326eea756afec6c913e Mon Sep 17 00:00:00 2001 From: femi Date: Mon, 15 Dec 2025 11:48:53 +0000 Subject: [PATCH 2/7] update compatible tests --- .../tests/tests_conway/test_pparam_update.py | 45 +++------- .../tests_conway/test_treasury_withdrawals.py | 82 ++++++++----------- 2 files changed, 49 insertions(+), 78 deletions(-) diff --git a/cardano_node_tests/tests/tests_conway/test_pparam_update.py b/cardano_node_tests/tests/tests_conway/test_pparam_update.py index aaa35a308..c2e15a036 100644 --- a/cardano_node_tests/tests/tests_conway/test_pparam_update.py +++ b/cardano_node_tests/tests/tests_conway/test_pparam_update.py @@ -1436,27 +1436,16 @@ def test_pparam_keys( class TestLegacyProposals: """Tests for legacy update proposals in Conway.""" - @pytest.fixture(scope="class") - def skip_on_missing_legacy(self) -> None: - if not clusterlib_utils.cli_has("legacy governance"): - pytest.skip("`legacy governance` commands are not available") - @allure.link(helpers.get_vcs_link()) @submit_utils.PARAM_SUBMIT_METHOD @pytest.mark.smoke def test_legacy_proposal_submit( self, - skip_on_missing_legacy: None, # noqa: ARG002 cluster: clusterlib.ClusterLib, payment_addr: clusterlib.AddressRecord, submit_method: str, ): - """Test submitting a legacy update proposal in Conway. - - Expect failure as the legacy update proposals are not supported in Conway. - """ - # TODO: convert to use - # `compatible babbage governance action create-protocol-parameters-update` + """Test that a compatible Babbage pparam proposal cannot be submitted in Conway era.""" temp_template = common.get_test_id(cluster) update_proposals = [ @@ -1468,27 +1457,16 @@ def test_legacy_proposal_submit( ] cli_args = clusterlib_utils.get_pparams_update_args(update_proposals=update_proposals) - out_file = f"{temp_template}_update.proposal" - cluster.cli( - [ - "cardano-cli", - "legacy", - "governance", - "create-update-proposal", - *cli_args, - "--out-file", - str(out_file), - "--epoch", - str(cluster.g_query.get_epoch()), - *helpers.prepend_flag( - "--genesis-verification-key-file", - cluster.g_genesis.genesis_keys.genesis_vkeys, - ), - ], - add_default_args=False, + # NEW: use compatible babbage pparam action + action_file = cluster.g_compatible.babbage.governance.action.gen_pparams_update( + name=temp_template, + epoch=cluster.g_query.get_epoch(), + genesis_vkey_file=cluster.g_genesis.genesis_keys.genesis_vkeys[0], + cli_args=cli_args, ) + # Submitting a Babbage-era proposal in Conway must fail with pytest.raises((clusterlib.CLIError, submit_api.SubmitApiError)) as excinfo: clusterlib_utils.build_and_submit_tx( cluster_obj=cluster, @@ -1496,15 +1474,18 @@ def test_legacy_proposal_submit( src_address=payment_addr.address, submit_method=submit_method, tx_files=clusterlib.TxFiles( - proposal_files=[out_file], + proposal_files=[action_file], signing_key_files=[ *cluster.g_genesis.genesis_keys.delegate_skeys, pl.Path(payment_addr.skey_file), ], ), ) + err_str = str(excinfo.value) - assert 'TextEnvelopeType "UpdateProposalShelley"' in err_str, err_str + assert "era" in err_str or "mismatch" in err_str or "TextEnvelope type error" in err_str, ( + err_str + ) @allure.link(helpers.get_vcs_link()) @pytest.mark.smoke diff --git a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py index 801dc3af2..19cd76540 100644 --- a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py +++ b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py @@ -716,80 +716,70 @@ def test_expire_treasury_withdrawals( [r.success() for r in (reqc.cip032ex, reqc.cip069ex)] +@pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"]) +@pytest.mark.parametrize( + "mir_cert", + ("to_treasury", "to_rewards", "treasury_to_addr", "reserves_to_addr"), +) class TestMIRCerts: - """Tests for MIR certificates.""" + """Tests for MIR certificates in all compatible eras.""" @pytest.fixture - def payment_addr( - self, - cluster_manager: cluster_management.ClusterManager, - cluster: clusterlib.ClusterLib, - ) -> clusterlib.AddressRecord: - """Create new payment address.""" - addr = common.get_payment_addr( + def payment_addr(self, cluster_manager, cluster): + return common.get_payment_addr( name_template=common.get_test_id(cluster), cluster_manager=cluster_manager, cluster_obj=cluster, caching_key=helpers.get_current_line_str(), amount=4_000_000, ) - return addr @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize( - "mir_cert", ("to_treasury", "to_rewards", "treasury_to_addr", "reserves_to_addr") - ) @pytest.mark.smoke - def test_mir_certificates( - self, - cluster: clusterlib.ClusterLib, - payment_addr: clusterlib.AddressRecord, - mir_cert: str, - ): - """Try to use MIR certificates in Conway+ eras. - - Expect failure. + def test_mir_certificates(self, cluster, payment_addr, era, mir_cert): + """ + Try each MIR certificate across all compatible eras. - * try and fail to build the Tx using `transaction build` - * successfully build the Tx as Babbage Tx using compatible `signed-transaction` - * try and fail to submit the Babbage Tx (expected era mismatch) + Expected behavior: + * Conway build fails with MIR (TextEnvelope type error) + * Compatible signed-transaction builds successfully + * Submitting a non-Conway tx in Conway must fail (era mismatch) """ temp_template = common.get_test_id(cluster) amount = 1_500_000 reqc.cip070.start(url=helpers.get_vcs_link()) - # Generate MIR certificate using compatible governance commands + # Get compatible governance for selected era dynamically + gov = getattr(cluster.g_compatible, era).governance + + # Generate cert based on MIR type if mir_cert == "to_treasury": - cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + cert_file = gov.gen_mir_cert_to_treasury( name=temp_template, - subcommand="transfer-to-treasury", - transfer_amt=amount, + transfer=amount, ) elif mir_cert == "to_rewards": - cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + cert_file = gov.gen_mir_cert_to_rewards( name=temp_template, - subcommand="transfer-to-rewards", - transfer_amt=amount, + transfer=amount, ) elif mir_cert == "treasury_to_addr": - cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + cert_file = gov.gen_mir_cert_stake_addr( name=temp_template, - subcommand="stake-addresses", stake_address="stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt", reward=amount, - funds="treasury", + use_treasury=True, ) elif mir_cert == "reserves_to_addr": - cert_file = cluster.g_compatible.babbage.governance.gen_mir_cert( + cert_file = gov.gen_mir_cert_stake_addr( name=temp_template, - subcommand="stake-addresses", stake_address="stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt", reward=amount, - funds="reserves", + use_treasury=False, ) else: - msg = f"Unknown MIR certificate: {mir_cert}" + msg = f"Unknown MIR certificate type: {mir_cert}" raise ValueError(msg) tx_files = clusterlib.TxFiles( @@ -800,18 +790,18 @@ def test_mir_certificates( ], ) - # Conway cannot build MIR Tx using the Conway `build` command, expect failure + # Conway build MUST fail with pytest.raises(clusterlib.CLIError) as excinfo: cluster.g_transaction.build_tx( tx_name=temp_template, src_address=payment_addr.address, tx_files=tx_files, ) - err_build = str(excinfo.value) - assert "TextEnvelope type error:" in err_build, err_build + assert "TextEnvelope type error" in str(excinfo.value) - # Build a Babbage-era signed Tx using compatible signed-transaction - signed_tx = cluster.g_compatible.babbage.transaction.gen_signed_tx( + # Build signed tx using compatible transaction command + tx_builder = getattr(cluster.g_compatible, era).transaction + signed_tx = tx_builder.gen_signed_tx( name=temp_template, src_address=payment_addr.address, txouts=[], @@ -819,14 +809,14 @@ def test_mir_certificates( fee=400_000, ) - # Submitting this Babbage Tx in Conway should fail (era mismatch expected) + # Submitting non-Conway tx in Conway MUST fail with pytest.raises(clusterlib.CLIError) as excinfo: cluster.g_transaction.submit_tx( tx_file=signed_tx.out_file, txins=signed_tx.txins, ) - err_submit = str(excinfo.value) - assert "era" in err_submit or "mismatch" in err_submit, err_submit + err = str(excinfo.value) + assert "era" in err or "mismatch" in err reqc.cip070.success() From b8f8c4f4bbc0327104986755b7e225f1e67d2233 Mon Sep 17 00:00:00 2001 From: femi Date: Tue, 16 Dec 2025 11:48:51 +0000 Subject: [PATCH 3/7] update compatible tests --- .../tests/tests_conway/test_conway.py | 58 ++++++++++++++ .../tests/tests_conway/test_pparam_update.py | 79 ++++++------------- 2 files changed, 84 insertions(+), 53 deletions(-) diff --git a/cardano_node_tests/tests/tests_conway/test_conway.py b/cardano_node_tests/tests/tests_conway/test_conway.py index 94e7dca34..72676abdd 100644 --- a/cardano_node_tests/tests/tests_conway/test_conway.py +++ b/cardano_node_tests/tests/tests_conway/test_conway.py @@ -184,3 +184,61 @@ def test_ratify_state_fields(self, cluster: clusterlib.ClusterLib): missing = expected_fields - set(ratify_state) assert not missing, f"Missing expected fields in ratify-state: {missing}" + + +class TestNegativeLegacyGovernance: + @allure.link(helpers.get_vcs_link()) + @pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"]) + @pytest.mark.smoke + def test_mixed_legacy_govaction_and_conway_vote_cert_fails( + self, + cluster: clusterlib.ClusterLib, + pool_user: clusterlib.PoolUser, + era: str, + ): + """Mixing a legacy governance action with a Conway vote-delegation cert must fail.""" + temp_template = common.get_test_id(cluster) + + payment_rec = pool_user.payment + stake_rec = pool_user.stake + + pool_ids = cluster.g_query.get_stake_pools() + assert pool_ids, "No stake pools available on this testnet" + pool_id = pool_ids[0] + + era_api = getattr(cluster.g_compatible, era) + legacy_prop = era_api.governance.action.gen_pparams_update( + name=temp_template, + epoch=cluster.g_query.get_epoch(), + genesis_vkey_file=cluster.g_genesis.genesis_keys.genesis_vkeys[0], + cli_args=["--max-block-body-size", "65536"], + ) + + conway_vote = cluster.g_stake_address.gen_stake_and_vote_delegation_cert( + addr_name=f"{temp_template}_vote", + stake_vkey_file=stake_rec.vkey_file, + stake_pool_id=pool_id, + always_abstain=True, + ) + + tx_files = clusterlib.TxFiles( + certificate_files=[legacy_prop, conway_vote], + signing_key_files=[payment_rec.skey_file, stake_rec.skey_file], + ) + + with pytest.raises(clusterlib.CLIError) as excinfo: + cluster.g_transaction.send_tx( + src_address=payment_rec.address, + tx_name=f"{temp_template}_mixed_fail", + tx_files=tx_files, + ) + + err = str(excinfo.value) + + print("\n >>>>> ERROR START") + print(err) + print(" >>>>> ERROR END\n") + + assert "TextEnvelope type error" in err, err + assert "Expected: CertificateConway" in err, err + assert "Actual: UpdateProposalShelley" in err, err diff --git a/cardano_node_tests/tests/tests_conway/test_pparam_update.py b/cardano_node_tests/tests/tests_conway/test_pparam_update.py index c2e15a036..16ef8482a 100644 --- a/cardano_node_tests/tests/tests_conway/test_pparam_update.py +++ b/cardano_node_tests/tests/tests_conway/test_pparam_update.py @@ -1433,40 +1433,54 @@ def test_pparam_keys( [r.success() for r in (reqc.cip075, reqc.cip076, reqc.cip077, reqc.cip078)] +ERA_VALID_PPARAM = { + # Allowed in Shelley and mary compatible CLI + "shelley": ("--max-block-body-size", 65536, "maxBlockBodySize"), + "mary": ("--max-block-body-size", 65536, "maxBlockBodySize"), + # Allowed in Alonzo and babbage compatible CLI + "alonzo": ("--max-collateral-inputs", 4, "maxCollateralInputs"), + "babbage": ("--max-collateral-inputs", 4, "maxCollateralInputs"), +} + + class TestLegacyProposals: """Tests for legacy update proposals in Conway.""" @allure.link(helpers.get_vcs_link()) @submit_utils.PARAM_SUBMIT_METHOD + @pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"]) @pytest.mark.smoke def test_legacy_proposal_submit( self, cluster: clusterlib.ClusterLib, payment_addr: clusterlib.AddressRecord, submit_method: str, + era: str, ): - """Test that a compatible Babbage pparam proposal cannot be submitted in Conway era.""" + """Test a compatible-era (Shelley, Mary, Alonzo, Babbage).""" temp_template = common.get_test_id(cluster) + arg, val, name = ERA_VALID_PPARAM[era] + update_proposals = [ clusterlib_utils.UpdateProposal( - arg="--max-collateral-inputs", - value=4, - name="maxCollateralInputs", + arg=arg, + value=val, + name=name, ), ] cli_args = clusterlib_utils.get_pparams_update_args(update_proposals=update_proposals) - # NEW: use compatible babbage pparam action - action_file = cluster.g_compatible.babbage.governance.action.gen_pparams_update( + era_api = getattr(cluster.g_compatible, era) + + action_file = era_api.governance.action.gen_pparams_update( name=temp_template, epoch=cluster.g_query.get_epoch(), genesis_vkey_file=cluster.g_genesis.genesis_keys.genesis_vkeys[0], cli_args=cli_args, ) - # Submitting a Babbage-era proposal in Conway must fail with pytest.raises((clusterlib.CLIError, submit_api.SubmitApiError)) as excinfo: clusterlib_utils.build_and_submit_tx( cluster_obj=cluster, @@ -1483,54 +1497,13 @@ def test_legacy_proposal_submit( ) err_str = str(excinfo.value) - assert "era" in err_str or "mismatch" in err_str or "TextEnvelope type error" in err_str, ( - err_str - ) - - @allure.link(helpers.get_vcs_link()) - @pytest.mark.smoke - def test_legacy_proposal_build( - self, - cluster: clusterlib.ClusterLib, - ): - """Test building a legacy update proposal with Conway cardano-cli. - - Expect failure as the legacy update proposals are not supported in Conway. - """ - temp_template = common.get_test_id(cluster) - - update_proposals = [ - clusterlib_utils.UpdateProposal( - arg="--max-collateral-inputs", - value=4, - name="maxCollateralInputs", - ), - ] - cli_args = clusterlib_utils.get_pparams_update_args(update_proposals=update_proposals) - out_file = f"{temp_template}_update.proposal" + print("\nERROR MESSAGE START") + print(err_str) + print(" ERROR MESSAGE END\n") - with pytest.raises(clusterlib.CLIError) as excinfo: - cluster.cli( - [ - "cardano-cli", - "conway", - "governance", - "create-update-proposal", - *cli_args, - "--out-file", - str(out_file), - "--epoch", - str(cluster.g_query.get_epoch()), - *helpers.prepend_flag( - "--genesis-verification-key-file", - cluster.g_genesis.genesis_keys.genesis_vkeys, - ), - ], - add_default_args=False, - ) - err_str = str(excinfo.value) - assert "Invalid argument `create-update-proposal'" in err_str, err_str + assert "TextEnvelope type error" in err_str + assert "UpdateProposalShelley" in err_str class TestNegativeCostModels: From 898f584020271439df9576c7f81777c06888b347 Mon Sep 17 00:00:00 2001 From: femi Date: Mon, 22 Dec 2025 12:08:36 +0000 Subject: [PATCH 4/7] update compatible tests --- cardano_node_tests/tests/test_pools.py | 144 ++++++++++++++++++ .../tests/tests_conway/test_conway.py | 17 +-- .../tests/tests_conway/test_pparam_update.py | 38 +++-- .../tests_conway/test_treasury_withdrawals.py | 24 ++- 4 files changed, 178 insertions(+), 45 deletions(-) diff --git a/cardano_node_tests/tests/test_pools.py b/cardano_node_tests/tests/test_pools.py index bc80573ba..dffc91191 100644 --- a/cardano_node_tests/tests/test_pools.py +++ b/cardano_node_tests/tests/test_pools.py @@ -2529,6 +2529,150 @@ def test_stake_pool_long_metadata_url( in err_str ) + @allure.link(helpers.get_vcs_link()) + @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.testnets + @pytest.mark.smoke + def test_legacy_pool_registration_rejected_in_conway( + self, + cluster_manager: cluster_management.ClusterManager, + cluster: clusterlib.ClusterLib, + era: str, + ): + """Reject legacy stake pool registration in Conway. + + * Generate a stake pool registration certificate using the compatible CLI + for a legacy era. + * Attempt to submit the legacy certificate in a Conway-era transaction. + * Expect the transaction submission to fail with a TextEnvelope type error. + """ + temp_template = common.get_test_id(cluster) + + pool_users = common.get_pool_users( + name_template=f"{temp_template}_{era}_legacy", + cluster_manager=cluster_manager, + cluster_obj=cluster, + num=1, + fund_idx=[0], + amount=600_000_000, + ) + + node_vrf = cluster.g_node.gen_vrf_key_pair(f"{temp_template}_{era}_vrf") + node_cold = cluster.g_node.gen_cold_key_pair_and_counter(f"{temp_template}_{era}_cold") + + era_api = getattr(cluster.g_compatible, era) + + legacy_pool_reg_cert = era_api.stake_pool.gen_registration_cert( + name=f"{temp_template}_{era}_pool", + pool_data=clusterlib.PoolData( + pool_name=f"{temp_template}_{era}_pool", + pool_pledge=5, + pool_cost=cluster.g_query.get_protocol_params().get("minPoolCost", 500), + pool_margin=0.01, + ), + vrf_vkey_file=node_vrf.vkey_file, + cold_vkey_file=node_cold.vkey_file, + owner_stake_vkey_files=[pool_users[0].stake.vkey_file], + ) + + tx_files = clusterlib.TxFiles( + certificate_files=[legacy_pool_reg_cert], + signing_key_files=[ + pool_users[0].payment.skey_file, + pool_users[0].stake.skey_file, + node_cold.skey_file, + ], + ) + + with pytest.raises(clusterlib.CLIError) as excinfo: + cluster.g_transaction.send_tx( + src_address=pool_users[0].payment.address, + tx_name=f"{temp_template}_{era}_legacy_pool_reg", + tx_files=tx_files, + ) + + err = str(excinfo.value) + + assert "TextEnvelope type error" in err, err + + @allure.link(helpers.get_vcs_link()) + @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.testnets + @pytest.mark.smoke + def test_legacy_pool_registration_plus_conway_delegation_fails( + self, + cluster_manager: cluster_management.ClusterManager, + cluster: clusterlib.ClusterLib, + era: str, + ): + """Reject mixed legacy pool registration and Conway delegation. + + * Generate a legacy stake pool registration certificate using compatible CLI. + * Generate a Conway-era stake address delegation certificate. + * Submit both certificates in a single Conway-era transaction. + * Expect the transaction submission to fail with a TextEnvelope type error. + """ + temp_template = common.get_test_id(cluster) + + # Pool user for funding and signing + pool_users = common.get_pool_users( + name_template=f"{temp_template}_{era}_mixed", + cluster_manager=cluster_manager, + cluster_obj=cluster, + num=1, + fund_idx=[0], + amount=600_000_000, + ) + + payment_rec = pool_users[0].payment + stake_rec = pool_users[0].stake + + # Generate pool keys + node_vrf = cluster.g_node.gen_vrf_key_pair(f"{temp_template}_{era}_vrf") + node_cold = cluster.g_node.gen_cold_key_pair_and_counter(f"{temp_template}_{era}_cold") + + # Legacy (compatible-era) pool registration certificate + era_api = getattr(cluster.g_compatible, era) + legacy_pool_reg_cert = era_api.stake_pool.gen_registration_cert( + name=f"{temp_template}_{era}_legacy_pool", + pool_data=clusterlib.PoolData( + pool_name=f"{temp_template}_{era}_legacy_pool", + pool_pledge=5, + pool_cost=cluster.g_query.get_protocol_params().get("minPoolCost", 500), + pool_margin=0.01, + ), + vrf_vkey_file=node_vrf.vkey_file, + cold_vkey_file=node_cold.vkey_file, + owner_stake_vkey_files=[stake_rec.vkey_file], + ) + + # Conway-era stake delegation certificate + conway_deleg_cert = cluster.g_stake_address.gen_stake_addr_delegation_cert( + addr_name=f"{temp_template}_{era}_deleg", + stake_vkey_file=stake_rec.vkey_file, + cold_vkey_file=node_cold.vkey_file, + ) + + tx_files = clusterlib.TxFiles( + certificate_files=[legacy_pool_reg_cert, conway_deleg_cert], + signing_key_files=[ + payment_rec.skey_file, + stake_rec.skey_file, + node_cold.skey_file, + ], + ) + + with pytest.raises(clusterlib.CLIError) as excinfo: + cluster.g_transaction.send_tx( + src_address=payment_rec.address, + tx_name=f"{temp_template}_{era}_legacy_plus_conway_fail", + tx_files=tx_files, + ) + + err = str(excinfo.value) + + assert "TextEnvelope type error" in err, err + @pytest.mark.skipif( VERSIONS.transaction_era < VERSIONS.CONWAY, reason="runs only with Tx era >= Conway" diff --git a/cardano_node_tests/tests/tests_conway/test_conway.py b/cardano_node_tests/tests/tests_conway/test_conway.py index 72676abdd..ea834f47e 100644 --- a/cardano_node_tests/tests/tests_conway/test_conway.py +++ b/cardano_node_tests/tests/tests_conway/test_conway.py @@ -188,7 +188,7 @@ def test_ratify_state_fields(self, cluster: clusterlib.ClusterLib): class TestNegativeLegacyGovernance: @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"]) + @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) @pytest.mark.smoke def test_mixed_legacy_govaction_and_conway_vote_cert_fails( self, @@ -196,7 +196,13 @@ def test_mixed_legacy_govaction_and_conway_vote_cert_fails( pool_user: clusterlib.PoolUser, era: str, ): - """Mixing a legacy governance action with a Conway vote-delegation cert must fail.""" + """Reject mixed legacy governance action and Conway vote delegation. + + * Generate a legacy governance action using the compatible CLI. + * Generate a Conway-era stake and vote delegation certificate. + * Submit both certificates in a single Conway-era transaction. + * Expect the transaction submission to fail with a TextEnvelope type error. + """ temp_template = common.get_test_id(cluster) payment_rec = pool_user.payment @@ -234,11 +240,4 @@ def test_mixed_legacy_govaction_and_conway_vote_cert_fails( ) err = str(excinfo.value) - - print("\n >>>>> ERROR START") - print(err) - print(" >>>>> ERROR END\n") - assert "TextEnvelope type error" in err, err - assert "Expected: CertificateConway" in err, err - assert "Actual: UpdateProposalShelley" in err, err diff --git a/cardano_node_tests/tests/tests_conway/test_pparam_update.py b/cardano_node_tests/tests/tests_conway/test_pparam_update.py index 16ef8482a..7b507dbee 100644 --- a/cardano_node_tests/tests/tests_conway/test_pparam_update.py +++ b/cardano_node_tests/tests/tests_conway/test_pparam_update.py @@ -1433,22 +1433,12 @@ def test_pparam_keys( [r.success() for r in (reqc.cip075, reqc.cip076, reqc.cip077, reqc.cip078)] -ERA_VALID_PPARAM = { - # Allowed in Shelley and mary compatible CLI - "shelley": ("--max-block-body-size", 65536, "maxBlockBodySize"), - "mary": ("--max-block-body-size", 65536, "maxBlockBodySize"), - # Allowed in Alonzo and babbage compatible CLI - "alonzo": ("--max-collateral-inputs", 4, "maxCollateralInputs"), - "babbage": ("--max-collateral-inputs", 4, "maxCollateralInputs"), -} - - class TestLegacyProposals: """Tests for legacy update proposals in Conway.""" @allure.link(helpers.get_vcs_link()) @submit_utils.PARAM_SUBMIT_METHOD - @pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"]) + @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) @pytest.mark.smoke def test_legacy_proposal_submit( self, @@ -1457,10 +1447,22 @@ def test_legacy_proposal_submit( submit_method: str, era: str, ): - """Test a compatible-era (Shelley, Mary, Alonzo, Babbage).""" + """Reject legacy update proposal submission in Conway. + + * Generate a legacy update proposal using the compatible CLI. + * Attempt to submit the proposal in a Conway-era transaction. + * Expect the transaction submission to fail with a TextEnvelope type error. + """ + era_valid_pparam = { + "shelley": ("--max-block-body-size", 65536, "maxBlockBodySize"), + "mary": ("--max-block-body-size", 65536, "maxBlockBodySize"), + "alonzo": ("--max-collateral-inputs", 4, "maxCollateralInputs"), + "babbage": ("--max-collateral-inputs", 4, "maxCollateralInputs"), + } + temp_template = common.get_test_id(cluster) - arg, val, name = ERA_VALID_PPARAM[era] + arg, val, name = era_valid_pparam[era] update_proposals = [ clusterlib_utils.UpdateProposal( @@ -1496,14 +1498,8 @@ def test_legacy_proposal_submit( ), ) - err_str = str(excinfo.value) - - print("\nERROR MESSAGE START") - print(err_str) - print(" ERROR MESSAGE END\n") - - assert "TextEnvelope type error" in err_str - assert "UpdateProposalShelley" in err_str + err = str(excinfo.value) + assert "TextEnvelope type error" in err, err class TestNegativeCostModels: diff --git a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py index 19cd76540..42009c07a 100644 --- a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py +++ b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py @@ -716,11 +716,6 @@ def test_expire_treasury_withdrawals( [r.success() for r in (reqc.cip032ex, reqc.cip069ex)] -@pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"]) -@pytest.mark.parametrize( - "mir_cert", - ("to_treasury", "to_rewards", "treasury_to_addr", "reserves_to_addr"), -) class TestMIRCerts: """Tests for MIR certificates in all compatible eras.""" @@ -735,15 +730,17 @@ def payment_addr(self, cluster_manager, cluster): ) @allure.link(helpers.get_vcs_link()) - @pytest.mark.smoke + @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize( + "mir_cert", + ("to_treasury", "to_rewards", "treasury_to_addr", "reserves_to_addr"), + ) def test_mir_certificates(self, cluster, payment_addr, era, mir_cert): - """ - Try each MIR certificate across all compatible eras. + """Try each MIR certificate across all compatible eras. - Expected behavior: - * Conway build fails with MIR (TextEnvelope type error) - * Compatible signed-transaction builds successfully - * Submitting a non-Conway tx in Conway must fail (era mismatch) + * Conway build fails with MIR (TextEnvelope type error). + * Compatible-era signed transaction builds successfully. + * Submitting a non-Conway transaction in Conway fails due to era mismatch. """ temp_template = common.get_test_id(cluster) amount = 1_500_000 @@ -819,6 +816,3 @@ def test_mir_certificates(self, cluster, payment_addr, era, mir_cert): assert "era" in err or "mismatch" in err reqc.cip070.success() - - -reqc.cip070.success() From 19461312b017890eaa6138fc944cd84880a8ae2b Mon Sep 17 00:00:00 2001 From: femi Date: Sun, 28 Dec 2025 20:59:32 +0000 Subject: [PATCH 5/7] update compatible tests --- .../tests/test_addr_registration.py | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/cardano_node_tests/tests/test_addr_registration.py b/cardano_node_tests/tests/test_addr_registration.py index 7a48bf7ca..cb3379709 100644 --- a/cardano_node_tests/tests/test_addr_registration.py +++ b/cardano_node_tests/tests/test_addr_registration.py @@ -789,3 +789,57 @@ def _submit_tx( else: err = f"Invalid issue: {issue}" raise ValueError(err) + + @allure.link(helpers.get_vcs_link()) + @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.testnets + @pytest.mark.smoke + def test_legacy_stake_addr_registration_rejected_in_conway( + self, + cluster_manager: cluster_management.ClusterManager, + cluster: clusterlib.ClusterLib, + era: str, + ): + """Reject legacy stake address registration in Conway. + + * Generate a stake address registration certificate using the compatible CLI + for a legacy era. + * Attempt to submit the legacy certificate in a Conway-era transaction. + * Expect the transaction submission to fail with a TextEnvelope type error. + """ + temp_template = common.get_test_id(cluster) + + pool_users = common.get_pool_users( + name_template=f"{temp_template}_{era}_legacy", + cluster_manager=cluster_manager, + cluster_obj=cluster, + num=1, + fund_idx=[0], + amount=600_000_000, + ) + + era_api = getattr(cluster.g_compatible, era) + + legacy_stake_reg_cert = era_api.stake_address.gen_registration_cert( + name=f"{temp_template}_{era}_stake", + stake_vkey_file=pool_users[0].stake.vkey_file, + ) + + tx_files = clusterlib.TxFiles( + certificate_files=[legacy_stake_reg_cert], + signing_key_files=[ + pool_users[0].payment.skey_file, + pool_users[0].stake.skey_file, + ], + ) + + with pytest.raises(clusterlib.CLIError) as excinfo: + cluster.g_transaction.send_tx( + src_address=pool_users[0].payment.address, + tx_name=f"{temp_template}_{era}_legacy_stake_reg", + tx_files=tx_files, + ) + + err = str(excinfo.value) + + assert "TextEnvelope type error" in err, err From 6641b43892f239ccd039e6d9cdf25a16436bfc68 Mon Sep 17 00:00:00 2001 From: femi Date: Mon, 29 Dec 2025 12:07:28 +0000 Subject: [PATCH 6/7] update compatible tests --- cardano_node_tests/tests/test_delegation.py | 70 +++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/cardano_node_tests/tests/test_delegation.py b/cardano_node_tests/tests/test_delegation.py index f4cc27aed..4e0f9252e 100644 --- a/cardano_node_tests/tests/test_delegation.py +++ b/cardano_node_tests/tests/test_delegation.py @@ -1249,3 +1249,73 @@ def test_delegatee_not_registered( "DelegateeNotRegisteredDELEG" in err_msg # Before cardano-node 10.0.0 or "DelegateeStakePoolNotRegisteredDELEG" in err_msg ), err_msg + + @allure.link(helpers.get_vcs_link()) + @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.testnets + @pytest.mark.smoke + def test_legacy_stake_delegation_rejected_in_conway( + self, + cluster_manager: cluster_management.ClusterManager, + cluster: clusterlib.ClusterLib, + era: str, + ): + """Reject legacy stake address delegation in Conway. + + * Register stake address using Conway-era commands. + * Generate a stake address delegation certificate using the compatible CLI + for a legacy era. + * Attempt to submit the legacy certificate in a Conway-era transaction. + * Expect the transaction submission to fail with a TextEnvelope type error. + """ + temp_template = common.get_test_id(cluster) + + # Create funded pool user + pool_users = common.get_pool_users( + name_template=f"{temp_template}_{era}_legacy", + cluster_manager=cluster_manager, + cluster_obj=cluster, + num=1, + fund_idx=[0], + amount=600_000_000, + ) + pool_user = pool_users[0] + + # Register stake address using Conway commands + clusterlib_utils.register_stake_address( + cluster_obj=cluster, + pool_user=pool_user, + name_template=f"{temp_template}_{era}_reg", + deposit_amt=cluster.g_query.get_address_deposit(), + ) + + # Use an EXISTING registered pool + pool_ids = cluster.g_query.get_stake_pools() + assert pool_ids, "No registered stake pools available on this testnet" + pool_id = pool_ids[0] + + # Generate legacy delegation cert via compatible CLI + era_api = getattr(cluster.g_compatible, era) + legacy_stake_deleg_cert = era_api.stake_address.gen_delegation_cert( + name=f"{temp_template}_{era}_deleg", + stake_vkey_file=pool_user.stake.vkey_file, + stake_pool_id=pool_id, + ) + + tx_files = clusterlib.TxFiles( + certificate_files=[legacy_stake_deleg_cert], + signing_key_files=[ + pool_user.payment.skey_file, + pool_user.stake.skey_file, + ], + ) + + with pytest.raises(clusterlib.CLIError) as excinfo: + cluster.g_transaction.send_tx( + src_address=pool_user.payment.address, + tx_name=f"{temp_template}_{era}_legacy_deleg", + tx_files=tx_files, + ) + + err = str(excinfo.value) + assert "TextEnvelope type error" in err, err From fff33c51395191d06879821b12bf6464df76a7bb Mon Sep 17 00:00:00 2001 From: femi Date: Wed, 7 Jan 2026 03:06:16 +0000 Subject: [PATCH 7/7] update compatible tests --- cardano_node_tests/tests/test_addr_registration.py | 2 +- cardano_node_tests/tests/test_delegation.py | 2 +- cardano_node_tests/tests/test_pools.py | 4 ++-- cardano_node_tests/tests/tests_conway/test_conway.py | 4 ++-- cardano_node_tests/tests/tests_conway/test_pparam_update.py | 5 +++-- .../tests/tests_conway/test_treasury_withdrawals.py | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cardano_node_tests/tests/test_addr_registration.py b/cardano_node_tests/tests/test_addr_registration.py index cb3379709..07ef67ff8 100644 --- a/cardano_node_tests/tests/test_addr_registration.py +++ b/cardano_node_tests/tests/test_addr_registration.py @@ -791,7 +791,7 @@ def _submit_tx( raise ValueError(err) @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) @pytest.mark.testnets @pytest.mark.smoke def test_legacy_stake_addr_registration_rejected_in_conway( diff --git a/cardano_node_tests/tests/test_delegation.py b/cardano_node_tests/tests/test_delegation.py index 4e0f9252e..eb8e6bf89 100644 --- a/cardano_node_tests/tests/test_delegation.py +++ b/cardano_node_tests/tests/test_delegation.py @@ -1251,7 +1251,7 @@ def test_delegatee_not_registered( ), err_msg @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) @pytest.mark.testnets @pytest.mark.smoke def test_legacy_stake_delegation_rejected_in_conway( diff --git a/cardano_node_tests/tests/test_pools.py b/cardano_node_tests/tests/test_pools.py index dffc91191..718ea8361 100644 --- a/cardano_node_tests/tests/test_pools.py +++ b/cardano_node_tests/tests/test_pools.py @@ -2530,7 +2530,7 @@ def test_stake_pool_long_metadata_url( ) @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) @pytest.mark.testnets @pytest.mark.smoke def test_legacy_pool_registration_rejected_in_conway( @@ -2596,7 +2596,7 @@ def test_legacy_pool_registration_rejected_in_conway( assert "TextEnvelope type error" in err, err @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) @pytest.mark.testnets @pytest.mark.smoke def test_legacy_pool_registration_plus_conway_delegation_fails( diff --git a/cardano_node_tests/tests/tests_conway/test_conway.py b/cardano_node_tests/tests/tests_conway/test_conway.py index ea834f47e..d0d4fe9d2 100644 --- a/cardano_node_tests/tests/tests_conway/test_conway.py +++ b/cardano_node_tests/tests/tests_conway/test_conway.py @@ -188,7 +188,7 @@ def test_ratify_state_fields(self, cluster: clusterlib.ClusterLib): class TestNegativeLegacyGovernance: @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) @pytest.mark.smoke def test_mixed_legacy_govaction_and_conway_vote_cert_fails( self, @@ -213,7 +213,7 @@ def test_mixed_legacy_govaction_and_conway_vote_cert_fails( pool_id = pool_ids[0] era_api = getattr(cluster.g_compatible, era) - legacy_prop = era_api.governance.action.gen_pparams_update( + legacy_prop = era_api.governance.gen_pparams_update( name=temp_template, epoch=cluster.g_query.get_epoch(), genesis_vkey_file=cluster.g_genesis.genesis_keys.genesis_vkeys[0], diff --git a/cardano_node_tests/tests/tests_conway/test_pparam_update.py b/cardano_node_tests/tests/tests_conway/test_pparam_update.py index 7b507dbee..a1cec6c37 100644 --- a/cardano_node_tests/tests/tests_conway/test_pparam_update.py +++ b/cardano_node_tests/tests/tests_conway/test_pparam_update.py @@ -1438,7 +1438,7 @@ class TestLegacyProposals: @allure.link(helpers.get_vcs_link()) @submit_utils.PARAM_SUBMIT_METHOD - @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) @pytest.mark.smoke def test_legacy_proposal_submit( self, @@ -1455,6 +1455,7 @@ def test_legacy_proposal_submit( """ era_valid_pparam = { "shelley": ("--max-block-body-size", 65536, "maxBlockBodySize"), + "allegra": ("--max-block-body-size", 65536, "maxBlockBodySize"), "mary": ("--max-block-body-size", 65536, "maxBlockBodySize"), "alonzo": ("--max-collateral-inputs", 4, "maxCollateralInputs"), "babbage": ("--max-collateral-inputs", 4, "maxCollateralInputs"), @@ -1476,7 +1477,7 @@ def test_legacy_proposal_submit( era_api = getattr(cluster.g_compatible, era) - action_file = era_api.governance.action.gen_pparams_update( + action_file = era_api.governance.gen_pparams_update( name=temp_template, epoch=cluster.g_query.get_epoch(), genesis_vkey_file=cluster.g_genesis.genesis_keys.genesis_vkeys[0], diff --git a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py index 42009c07a..80a192c53 100644 --- a/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py +++ b/cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py @@ -730,7 +730,7 @@ def payment_addr(self, cluster_manager, cluster): ) @allure.link(helpers.get_vcs_link()) - @pytest.mark.parametrize("era", ("shelley", "mary", "alonzo", "babbage")) + @pytest.mark.parametrize("era", ("shelley", "allegra", "mary", "alonzo", "babbage")) @pytest.mark.parametrize( "mir_cert", ("to_treasury", "to_rewards", "treasury_to_addr", "reserves_to_addr"),