@@ -1446,8 +1446,9 @@ def test_change_delegation(
14461446 cluster = cluster_rewards
14471447 temp_template = common .get_test_id (cluster )
14481448 deposit_amt = cluster .g_query .get_address_deposit ()
1449- key1 = helpers . get_current_line_str ()
1449+
14501450 # Get first DRep
1451+ key1 = helpers .get_current_line_str ()
14511452 drep1 = get_custom_drep (
14521453 name_template = f"custom_drep_1_{ temp_template } " ,
14531454 cluster_manager = cluster_manager ,
@@ -1456,8 +1457,8 @@ def test_change_delegation(
14561457 caching_key = key1 ,
14571458 )
14581459
1459- key2 = helpers .get_current_line_str ()
14601460 # Get second DRep
1461+ key2 = helpers .get_current_line_str ()
14611462 drep2 = get_custom_drep (
14621463 name_template = f"custom_drep_2_{ temp_template } " ,
14631464 cluster_manager = cluster_manager ,
@@ -1513,8 +1514,9 @@ def _deregister():
15131514 drep_id = drep1 .drep_id
15141515 ), "Votes are NOT delegated to the correct DRep 1"
15151516
1517+ # Change delegation to second DRep
1518+
15161519 reqc .cip086 .start (url = helpers .get_vcs_link ())
1517- # Change delegation to drep2
15181520 deleg_cert = cluster .g_stake_address .gen_vote_delegation_cert (
15191521 addr_name = f"{ temp_template } _addr2" ,
15201522 stake_vkey_file = pool_user_rewards .stake .vkey_file ,
@@ -1542,6 +1544,39 @@ def _deregister():
15421544 ), "Votes are NOT changed to the correct DRep 2"
15431545 reqc .cip086 .success ()
15441546
1547+ # Retire the first DRep
1548+
1549+ ret_cert = cluster .g_conway_governance .drep .gen_retirement_cert (
1550+ cert_name = temp_template ,
1551+ deposit_amt = drep1 .deposit ,
1552+ drep_vkey_file = drep1 .key_pair .vkey_file ,
1553+ )
1554+
1555+ tx_files_ret = clusterlib .TxFiles (
1556+ certificate_files = [ret_cert ],
1557+ signing_key_files = [payment_addr_rewards .skey_file , drep1 .key_pair .skey_file ],
1558+ )
1559+
1560+ clusterlib_utils .build_and_submit_tx (
1561+ cluster_obj = cluster ,
1562+ name_template = f"{ temp_template } _ret" ,
1563+ src_address = payment_addr_rewards .address ,
1564+ tx_files = tx_files_ret ,
1565+ deposit = - drep1 .deposit ,
1566+ )
1567+
1568+ ret_drep_state = cluster .g_conway_governance .query .drep_state (
1569+ drep_vkey_file = drep1 .key_pair .vkey_file
1570+ )
1571+ assert not ret_drep_state , "DRep was not retired"
1572+
1573+ stake_addr_info = cluster .g_query .get_stake_addr_info (pool_user_rewards .stake .address )
1574+ if not stake_addr_info .vote_delegation :
1575+ issues .ledger_4772 .finish_test ()
1576+ assert stake_addr_info .vote_delegation == governance_utils .get_drep_cred_name (
1577+ drep_id = drep2 .drep_id
1578+ ), "Votes are no longer delegated to DRep 2!"
1579+
15451580
15461581class TestDRepActivity :
15471582 """Tests for DReps activity."""
0 commit comments