1111from cardano_node_tests .tests import common
1212from cardano_node_tests .tests import reqs_conway as reqc
1313from cardano_node_tests .tests .tests_conway import conway_common
14- from cardano_node_tests .utils import cluster_nodes
1514from cardano_node_tests .utils import clusterlib_utils
1615from cardano_node_tests .utils import configuration
1716from cardano_node_tests .utils import dbsync_utils
@@ -720,15 +719,9 @@ def test_expire_treasury_withdrawals(
720719class TestMIRCerts :
721720 """Tests for MIR certificates."""
722721
723- @pytest .fixture (scope = "class" )
724- def skip_on_missing_legacy (self ) -> None :
725- if not clusterlib_utils .cli_has ("legacy governance" ):
726- pytest .skip ("`legacy governance` commands are not available" )
727-
728722 @pytest .fixture
729723 def payment_addr (
730724 self ,
731- skip_on_missing_legacy : None , # noqa: ARG002
732725 cluster_manager : cluster_management .ClusterManager ,
733726 cluster : clusterlib .ClusterLib ,
734727 ) -> clusterlib .AddressRecord :
@@ -749,7 +742,6 @@ def payment_addr(
749742 @pytest .mark .smoke
750743 def test_mir_certificates (
751744 self ,
752- skip_on_missing_legacy : None , # noqa: ARG002
753745 cluster : clusterlib .ClusterLib ,
754746 payment_addr : clusterlib .AddressRecord ,
755747 mir_cert : str ,
@@ -759,42 +751,46 @@ def test_mir_certificates(
759751 Expect failure.
760752
761753 * try and fail to build the Tx using `transaction build`
762- * successfully build the Tx as Babbage Tx using `transaction build-raw `
763- * try and fail to submit the Babbage Tx
754+ * successfully build the Tx as Babbage Tx using compatible `signed-transaction `
755+ * try and fail to submit the Babbage Tx (expected era mismatch)
764756 """
765- # TODO: convert to use `compatible babbage governance create-mir-certificate`
766757 temp_template = common .get_test_id (cluster )
767758 amount = 1_500_000
768759
769760 reqc .cip070 .start (url = helpers .get_vcs_link ())
770761
762+ # Generate MIR certificate using compatible governance commands
771763 if mir_cert == "to_treasury" :
772- cert_file = cluster .g_legacy_governance .gen_mir_cert_to_treasury (
773- transfer = amount ,
774- tx_name = temp_template ,
764+ cert_file = cluster .g_compatible .babbage .governance .gen_mir_cert (
765+ name = temp_template ,
766+ subcommand = "transfer-to-treasury" ,
767+ transfer_amt = amount ,
775768 )
776769 elif mir_cert == "to_rewards" :
777- cert_file = cluster .g_legacy_governance .gen_mir_cert_to_rewards (
778- transfer = amount ,
779- tx_name = temp_template ,
770+ cert_file = cluster .g_compatible .babbage .governance .gen_mir_cert (
771+ name = temp_template ,
772+ subcommand = "transfer-to-rewards" ,
773+ transfer_amt = amount ,
780774 )
781775 elif mir_cert == "treasury_to_addr" :
782- cert_file = cluster .g_legacy_governance .gen_mir_cert_stake_addr (
783- tx_name = temp_template ,
784- stake_addr = "stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt" ,
776+ cert_file = cluster .g_compatible .babbage .governance .gen_mir_cert (
777+ name = temp_template ,
778+ subcommand = "stake-addresses" ,
779+ stake_address = "stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt" ,
785780 reward = amount ,
786- use_treasury = True ,
781+ funds = "treasury" ,
787782 )
788783 elif mir_cert == "reserves_to_addr" :
789- cert_file = cluster .g_legacy_governance .gen_mir_cert_stake_addr (
790- tx_name = temp_template ,
791- stake_addr = "stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt" ,
784+ cert_file = cluster .g_compatible .babbage .governance .gen_mir_cert (
785+ name = temp_template ,
786+ subcommand = "stake-addresses" ,
787+ stake_address = "stake_test1uzy5myemjnne3gr0jp7yhtznxx2lvx4qgv730jktsu46v5gaw7rmt" ,
792788 reward = amount ,
793- use_treasury = False ,
789+ funds = "reserves" ,
794790 )
795791 else :
796- _verr = f"Unknown MIR cert scenario : { mir_cert } "
797- raise ValueError (_verr )
792+ msg = f"Unknown MIR certificate : { mir_cert } "
793+ raise ValueError (msg )
798794
799795 tx_files = clusterlib .TxFiles (
800796 certificate_files = [cert_file ],
@@ -804,7 +800,7 @@ def test_mir_certificates(
804800 ],
805801 )
806802
807- # The Tx cannot be build in Conway using `build`
803+ # Conway cannot build MIR Tx using the Conway `build` command, expect failure
808804 with pytest .raises (clusterlib .CLIError ) as excinfo :
809805 cluster .g_transaction .build_tx (
810806 tx_name = temp_template ,
@@ -814,28 +810,25 @@ def test_mir_certificates(
814810 err_build = str (excinfo .value )
815811 assert "TextEnvelope type error:" in err_build , err_build
816812
817- # The Tx can be build as Babbage Tx using `build-raw`, but cannot be submitted.
818- # TODO: convert to use `compatible babbage transaction signed-transaction`
819- if clusterlib_utils .cli_has ("babbage transaction build-raw" ):
820- cluster_babbage = cluster_nodes .get_cluster_type ().get_cluster_obj (
821- command_era = "babbage"
822- )
823- tx_output = cluster_babbage .g_transaction .build_raw_tx (
824- tx_name = temp_template ,
825- src_address = payment_addr .address ,
826- fee = 400_000 ,
827- tx_files = tx_files ,
828- )
813+ # Build a Babbage-era signed Tx using compatible signed-transaction
814+ signed_tx = cluster .g_compatible .babbage .transaction .gen_signed_tx (
815+ name = temp_template ,
816+ src_address = payment_addr .address ,
817+ txouts = [],
818+ tx_files = tx_files ,
819+ fee = 400_000 ,
820+ )
829821
830- out_file_signed = cluster .g_transaction .sign_tx (
831- tx_body_file = tx_output .out_file ,
832- signing_key_files = tx_files .signing_key_files ,
833- tx_name = temp_template ,
822+ # Submitting this Babbage Tx in Conway should fail (era mismatch expected)
823+ with pytest .raises (clusterlib .CLIError ) as excinfo :
824+ cluster .g_transaction .submit_tx (
825+ tx_file = signed_tx .out_file ,
826+ txins = signed_tx .txins ,
834827 )
835-
836- with pytest .raises (clusterlib .CLIError ) as excinfo :
837- cluster .g_transaction .submit_tx (tx_file = out_file_signed , txins = tx_output .txins )
838- err_submit = str (excinfo .value )
839- assert "Error: The era of the node and the tx do not match." in err_submit , err_submit
828+ err_submit = str (excinfo .value )
829+ assert "era" in err_submit or "mismatch" in err_submit , err_submit
840830
841831 reqc .cip070 .success ()
832+
833+
834+ reqc .cip070 .success ()
0 commit comments