2525from cardano_node_tests .utils import helpers
2626from cardano_node_tests .utils import submit_api
2727from cardano_node_tests .utils import submit_utils
28+ from cardano_node_tests .utils import web
2829from cardano_node_tests .utils .versions import VERSIONS
2930
3031LOGGER = logging .getLogger (__name__ )
@@ -180,8 +181,12 @@ def test_update_committee_action(
180181 ]
181182
182183 deposit_amt = cluster .conway_genesis ["govActionDeposit" ]
183- anchor_url = "http://www.cc-update.com"
184- anchor_data_hash = "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d"
184+ anchor_text = f"Update committee action, temp ID { temp_template } "
185+ anchor_data = conway_common .get_anchor_data (
186+ cluster_obj = cluster ,
187+ name_template = temp_template ,
188+ anchor_text = anchor_text ,
189+ )
185190 prev_action_rec = governance_utils .get_prev_action (
186191 action_type = governance_utils .PrevGovActionIds .COMMITTEE ,
187192 gov_state = cluster .g_conway_governance .query .gov_state (),
@@ -191,8 +196,8 @@ def test_update_committee_action(
191196 update_action = cluster .g_conway_governance .action .update_committee (
192197 action_name = temp_template ,
193198 deposit_amt = deposit_amt ,
194- anchor_url = anchor_url ,
195- anchor_data_hash = anchor_data_hash ,
199+ anchor_url = anchor_data . url ,
200+ anchor_data_hash = anchor_data . hash ,
196201 threshold = threshold ,
197202 add_cc_members = cc_members ,
198203 prev_action_txid = prev_action_rec .txid ,
@@ -458,9 +463,11 @@ def _auth_hot_keys() -> None:
458463
459464 def _add_members () -> tuple [clusterlib .ActionUpdateCommittee , str , int ]:
460465 """Add new CC members."""
461- anchor_url_add = "http://www.cc-add.com"
462- anchor_data_hash_add = (
463- "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d"
466+ anchor_text_add = f"Add CC member action, temp ID { temp_template } "
467+ anchor_data_add = conway_common .get_anchor_data (
468+ cluster_obj = cluster ,
469+ name_template = f"{ temp_template } _add" ,
470+ anchor_text = anchor_text_add ,
464471 )
465472 prev_action_rec = governance_utils .get_prev_action (
466473 action_type = governance_utils .PrevGovActionIds .COMMITTEE ,
@@ -472,8 +479,8 @@ def _add_members() -> tuple[clusterlib.ActionUpdateCommittee, str, int]:
472479 add_cc_action = cluster .g_conway_governance .action .update_committee (
473480 action_name = f"{ temp_template } _add" ,
474481 deposit_amt = deposit_amt ,
475- anchor_url = anchor_url_add ,
476- anchor_data_hash = anchor_data_hash_add ,
482+ anchor_url = anchor_data_add . url ,
483+ anchor_data_hash = anchor_data_add . hash ,
477484 threshold = str (cluster .conway_genesis ["committee" ]["threshold" ]),
478485 add_cc_members = [* cc_members , cc_members [0 ]], # test adding the same member twice
479486 prev_action_txid = prev_action_rec .txid ,
@@ -532,11 +539,19 @@ def _resign_member(res_member: clusterlib.CCMember) -> None:
532539 _url = helpers .get_vcs_link ()
533540 [r .start (url = _url ) for r in (reqc .cli007 , reqc .cip012 )]
534541
542+ res_metadata_file = pl .Path (f"{ temp_template } _res_metadata.json" )
543+ res_metadata_content = {"name" : "The DRep" , "ranking" : "uno" }
544+ helpers .write_json (out_file = res_metadata_file , content = res_metadata_content )
545+ res_metadata_hash = cluster .g_conway_governance .get_anchor_data_hash (
546+ file_text = res_metadata_file
547+ )
548+ res_metadata_url = web .publish (file_path = res_metadata_file )
549+
535550 res_cert = cluster .g_conway_governance .committee .gen_cold_key_resignation_cert (
536551 key_name = temp_template ,
537552 cold_vkey_file = res_member .cold_vkey_file ,
538- resignation_metadata_url = "http://www.cc-resign.com" ,
539- resignation_metadata_hash = "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d" ,
553+ resignation_metadata_url = res_metadata_url ,
554+ resignation_metadata_hash = res_metadata_hash ,
540555 )
541556 reqc .cli007 .success ()
542557
@@ -574,17 +589,19 @@ def _remove_member(
574589 rem_member : clusterlib .CCMember , prev_action_txid : str , prev_action_ix : int
575590 ) -> tuple [clusterlib .ActionUpdateCommittee , str , int ]:
576591 """Remove a CC member."""
577- anchor_url_rem = "http://www.cc-rem.com"
578- anchor_data_hash_rem = (
579- "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d"
592+ anchor_text_rem = f"Rem CC member action, temp ID { temp_template } "
593+ anchor_data_rem = conway_common .get_anchor_data (
594+ cluster_obj = cluster ,
595+ name_template = f"{ temp_template } _rem" ,
596+ anchor_text = anchor_text_rem ,
580597 )
581598
582599 reqc .cip005 .start (url = helpers .get_vcs_link ())
583600 rem_cc_action = cluster .g_conway_governance .action .update_committee (
584601 action_name = f"{ temp_template } _rem" ,
585602 deposit_amt = deposit_amt ,
586- anchor_url = anchor_url_rem ,
587- anchor_data_hash = anchor_data_hash_rem ,
603+ anchor_url = anchor_data_rem . url ,
604+ anchor_data_hash = anchor_data_rem . hash ,
588605 threshold = str (cluster .conway_genesis ["committee" ]["threshold" ]),
589606 rem_cc_members = [rem_member ],
590607 prev_action_txid = prev_action_txid ,
@@ -646,14 +663,25 @@ def _resign_active():
646663 cluster_obj = cluster , start = 1 , stop = common .EPOCH_STOP_SEC_BUFFER
647664 )
648665
666+ def _get_res_cert (idx : int , cc_auth : governance_utils .CCMemberAuth ) -> pl .Path :
667+ res_metadata_file = pl .Path (f"{ temp_template } _{ idx } _res_metadata.json" )
668+ res_metadata_content = {"name" : "The DRep" , "ranking" : "uno" , "idx" : idx }
669+ helpers .write_json (out_file = res_metadata_file , content = res_metadata_content )
670+ res_metadata_hash = cluster .g_conway_governance .get_anchor_data_hash (
671+ file_text = res_metadata_file
672+ )
673+ res_metadata_url = web .publish (file_path = res_metadata_file )
674+ cert = cluster .g_conway_governance .committee .gen_cold_key_resignation_cert (
675+ key_name = f"{ temp_template } _res{ idx } " ,
676+ cold_vkey_file = cc_auth .cold_key_pair .vkey_file ,
677+ resignation_metadata_url = res_metadata_url ,
678+ resignation_metadata_hash = res_metadata_hash ,
679+ )
680+ return cert
681+
649682 auth_committee_state = cluster .g_conway_governance .query .committee_state ()
650683 res_certs = [
651- cluster .g_conway_governance .committee .gen_cold_key_resignation_cert (
652- key_name = f"{ temp_template } _res{ i } " ,
653- cold_vkey_file = r .cold_key_pair .vkey_file ,
654- resignation_metadata_url = "http://www.cc-resign.com" ,
655- resignation_metadata_hash = "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d" ,
656- )
684+ _get_res_cert (idx = i , cc_auth = r )
657685 for i , r in enumerate ((cc_auth_record1 , cc_auth_record2 , cc_auth_record3 ))
658686 if governance_utils .is_cc_active (
659687 auth_committee_state ["committee" ].get (f"keyHash-{ r .key_hash } " ) or {}
@@ -1072,8 +1100,12 @@ def test_empty_committee(
10721100
10731101 def _set_zero_committee_pparam () -> conway_common .PParamPropRec :
10741102 """Set the `committeeMinSize` pparam to 0."""
1075- anchor_url = "http://www.pparam-cc-min-size.com"
1076- anchor_data_hash = "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d"
1103+ anchor_text = f"Set `committeeMinSize` pparam to 0, temp ID { temp_template } "
1104+ anchor_data = conway_common .get_anchor_data (
1105+ cluster_obj = cluster ,
1106+ name_template = f"{ temp_template } _zero_cc" ,
1107+ anchor_text = anchor_text ,
1108+ )
10771109
10781110 update_proposals = [
10791111 clusterlib_utils .UpdateProposal (
@@ -1086,17 +1118,19 @@ def _set_zero_committee_pparam() -> conway_common.PParamPropRec:
10861118 return conway_common .propose_pparams_update (
10871119 cluster_obj = cluster ,
10881120 name_template = f"{ temp_template } _zero_cc" ,
1089- anchor_url = anchor_url ,
1090- anchor_data_hash = anchor_data_hash ,
1121+ anchor_url = anchor_data . url ,
1122+ anchor_data_hash = anchor_data . hash ,
10911123 pool_user = pool_user_lg ,
10921124 proposals = update_proposals ,
10931125 )
10941126
10951127 def _rem_committee () -> tuple [clusterlib .ActionUpdateCommittee , str , int ]:
10961128 """Remove all CC members."""
1097- anchor_url_rem = "http://www.cc-rem-all.com"
1098- anchor_data_hash_rem = (
1099- "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d"
1129+ anchor_text = f"Remove all CC members, temp ID { temp_template } "
1130+ anchor_data = conway_common .get_anchor_data (
1131+ cluster_obj = cluster ,
1132+ name_template = f"{ temp_template } _rem" ,
1133+ anchor_text = anchor_text ,
11001134 )
11011135 prev_action_rec = governance_utils .get_prev_action (
11021136 action_type = governance_utils .PrevGovActionIds .COMMITTEE ,
@@ -1106,8 +1140,8 @@ def _rem_committee() -> tuple[clusterlib.ActionUpdateCommittee, str, int]:
11061140 rem_cc_action = cluster .g_conway_governance .action .update_committee (
11071141 action_name = f"{ temp_template } _rem" ,
11081142 deposit_amt = deposit_amt ,
1109- anchor_url = anchor_url_rem ,
1110- anchor_data_hash = anchor_data_hash_rem ,
1143+ anchor_url = anchor_data . url ,
1144+ anchor_data_hash = anchor_data . hash ,
11111145 threshold = "0.0" ,
11121146 rem_cc_members = [r .cc_member for r in governance_data .cc_key_members ],
11131147 prev_action_txid = prev_action_rec .txid ,
@@ -1371,8 +1405,12 @@ def test_update_committee_threshold_out_of_range(
13711405 temp_template = f"{ common .get_test_id (cluster )} _{ common .unique_time_str ()} "
13721406
13731407 deposit_amt = cluster .conway_genesis ["govActionDeposit" ]
1374- anchor_url = "http://www.cc-update.com"
1375- anchor_data_hash = "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d"
1408+ anchor_text = f"Update committee action, temp ID { temp_template } "
1409+ anchor_data = conway_common .get_anchor_data (
1410+ cluster_obj = cluster ,
1411+ name_template = temp_template ,
1412+ anchor_text = anchor_text ,
1413+ )
13761414 prev_action_rec = governance_utils .get_prev_action (
13771415 action_type = governance_utils .PrevGovActionIds .COMMITTEE ,
13781416 gov_state = cluster .g_conway_governance .query .gov_state (),
@@ -1382,8 +1420,8 @@ def test_update_committee_threshold_out_of_range(
13821420 cluster .g_conway_governance .action .update_committee (
13831421 action_name = temp_template ,
13841422 deposit_amt = deposit_amt ,
1385- anchor_url = anchor_url ,
1386- anchor_data_hash = anchor_data_hash ,
1423+ anchor_url = anchor_data . url ,
1424+ anchor_data_hash = anchor_data . hash ,
13871425 threshold = str (threshold ),
13881426 prev_action_txid = prev_action_rec .txid ,
13891427 prev_action_ix = prev_action_rec .ix ,
@@ -1453,8 +1491,12 @@ def _check_rat_enact_state(
14531491 assert prev_action_rec .txid == action_txid , "Action not enacted"
14541492
14551493 deposit_amt = cluster .conway_genesis ["govActionDeposit" ]
1456- anchor_url = "http://www.cc-update.com"
1457- anchor_data_hash = "5d372dca1a4cc90d7d16d966c48270e33e3aa0abcb0e78f0d5ca7ff330d2245d"
1494+ anchor_text = f"Update committee action, temp ID { temp_template } "
1495+ anchor_data = conway_common .get_anchor_data (
1496+ cluster_obj = cluster ,
1497+ name_template = temp_template ,
1498+ anchor_text = anchor_text ,
1499+ )
14581500 prev_action_rec = governance_utils .get_prev_action (
14591501 action_type = governance_utils .PrevGovActionIds .COMMITTEE ,
14601502 gov_state = cluster .g_conway_governance .query .gov_state (),
@@ -1464,8 +1506,8 @@ def _check_rat_enact_state(
14641506 update_threshold_action = cluster .g_conway_governance .action .update_committee (
14651507 action_name = temp_template ,
14661508 deposit_amt = deposit_amt ,
1467- anchor_url = anchor_url ,
1468- anchor_data_hash = anchor_data_hash ,
1509+ anchor_url = anchor_data . url ,
1510+ anchor_data_hash = anchor_data . hash ,
14691511 threshold = "0" ,
14701512 prev_action_txid = prev_action_rec .txid ,
14711513 prev_action_ix = prev_action_rec .ix ,
0 commit comments