Skip to content

Commit 70f2598

Browse files
Check Ratify State (#3175)
* Check Ratify State --------- Co-authored-by: Martin Kourim <[email protected]>
1 parent 1114d13 commit 70f2598

14 files changed

+48
-34
lines changed

cardano_node_tests/tests/test_node_upgrade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _check_models(cost_models: dict):
185185
)
186186

187187
rat_action = governance_utils.lookup_ratified_actions(
188-
gov_state=rat_gov_state, action_txid=prop_rec.action_txid
188+
state=rat_gov_state, action_txid=prop_rec.action_txid
189189
)
190190
assert rat_action, "Action not found in ratified actions"
191191

@@ -302,7 +302,7 @@ def test_hardfork(
302302
gov_state=rat_gov_state, name_template=f"{temp_template}_rat_{rat_epoch}"
303303
)
304304
rat_action = governance_utils.lookup_ratified_actions(
305-
gov_state=rat_gov_state, action_txid=action_txid
305+
state=rat_gov_state, action_txid=action_txid
306306
)
307307
assert rat_action, "Action not found in ratified actions"
308308

cardano_node_tests/tests/tests_conway/test_committee.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,10 +1100,9 @@ def _check_resign_dbsync(res_member: clusterlib.CCMember) -> None:
11001100
gov_state=rat_add_gov_state, name_template=f"{temp_template}_rat_add_{rat_epoch}"
11011101
)
11021102
rat_action = governance_utils.lookup_ratified_actions(
1103-
gov_state=rat_add_gov_state, action_txid=action_add_txid
1103+
state=rat_add_gov_state, action_txid=action_add_txid
11041104
)
11051105
assert rat_action, "Action not found in ratified actions"
1106-
11071106
# Disapprove ratified add action, the voting shouldn't have any effect
11081107
conway_common.cast_vote(
11091108
cluster_obj=cluster,
@@ -1204,7 +1203,7 @@ def _check_resign_dbsync(res_member: clusterlib.CCMember) -> None:
12041203
# time as the add action is enacted, because ratification of new actions was delayed by
12051204
# the add action.
12061205
rat_action = governance_utils.lookup_ratified_actions(
1207-
gov_state=enact_add_gov_state, action_txid=action_rem_txid
1206+
state=enact_add_gov_state, action_txid=action_rem_txid
12081207
)
12091208
assert rat_action, "Action not found in ratified actions"
12101209
reqc.cip038_01.success()
@@ -1468,7 +1467,7 @@ def _check_rat_gov_state(
14681467
gov_state=gov_state, name_template=f"{name_template}_{epoch_no}"
14691468
)
14701469
rat_action = governance_utils.lookup_ratified_actions(
1471-
gov_state=gov_state, action_txid=action_txid, action_ix=action_ix
1470+
state=gov_state, action_txid=action_txid, action_ix=action_ix
14721471
)
14731472
assert rat_action, "Action not found in ratified actions"
14741473
return gov_state
@@ -1724,15 +1723,12 @@ def _check_rat_enact_state(
17241723
# Check ratification
17251724
epoch_rat = cluster.wait_for_epoch(epoch_no=approval_epoch + 1, padding_seconds=5)
17261725

1727-
rat_gov_state = cluster.g_query.get_gov_state()
1728-
conway_common.save_gov_state(
1729-
gov_state=rat_gov_state, name_template=f"{name_template}_rat_{epoch_rat}"
1730-
)
1731-
1732-
rat_action = governance_utils.lookup_ratified_actions(
1733-
gov_state=rat_gov_state, action_txid=action_txid
1726+
rat_state = cluster.g_query.get_ratify_state()
1727+
rat_action_direct = governance_utils.lookup_ratified_actions(
1728+
state=rat_state,
1729+
action_txid=action_txid,
17341730
)
1735-
assert rat_action, "Action not found in ratified actions"
1731+
assert rat_action_direct, "Action not found in ratified actions (ratify-state)"
17361732

17371733
# Wait for enactment
17381734
epoch_enact = cluster.wait_for_epoch(epoch_no=epoch_rat + 1, padding_seconds=5)

cardano_node_tests/tests/tests_conway/test_constitution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def _check_cli_query():
484484
gov_state=rat_gov_state, name_template=f"{temp_template}_rat_{rat_epoch}"
485485
)
486486
rat_action = governance_utils.lookup_ratified_actions(
487-
gov_state=rat_gov_state, action_txid=action_txid
487+
state=rat_gov_state, action_txid=action_txid
488488
)
489489
assert rat_action, "Action not found in ratified actions"
490490

cardano_node_tests/tests/tests_conway/test_conway.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,18 @@ def test_action_build_unreg_deposit_addr(
169169
pool_user=pool_user,
170170
build_method=clusterlib_utils.BuildMethods.BUILD,
171171
)
172+
173+
@allure.link(helpers.get_vcs_link())
174+
@pytest.mark.smoke
175+
def test_ratify_state_fields(self, cluster: clusterlib.ClusterLib):
176+
"""Check that 'cardano-cli query ratify-state' output has the expected fields."""
177+
ratify_state = cluster.g_query.get_ratify_state()
178+
expected_fields = {
179+
"enactedGovActions",
180+
"expiredGovActions",
181+
"nextEnactState",
182+
"ratificationDelayed",
183+
}
184+
185+
missing = expected_fields - set(ratify_state)
186+
assert not missing, f"Missing expected fields in ratify-state: {missing}"

cardano_node_tests/tests/tests_conway/test_drep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ def _check_ratification(
18251825
name_template=f"{temp_template}_{action_id}_drep_activity_rat_{rat_epoch}",
18261826
)
18271827
rat_action = governance_utils.lookup_ratified_actions(
1828-
gov_state=rat_gov_state, action_txid=action_txid
1828+
state=rat_gov_state, action_txid=action_txid
18291829
)
18301830

18311831
rat_records[action_id] = DRepRatRecord(id=action_id, ratified=bool(rat_action))

cardano_node_tests/tests/tests_conway/test_guardrails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def _enact_script_constitution():
172172
cluster.wait_for_epoch(epoch_no=approve_epoch + 1, padding_seconds=5)
173173
rat_gov_state = cluster.g_query.get_gov_state()
174174
rat_action = governance_utils.lookup_ratified_actions(
175-
gov_state=rat_gov_state, action_txid=action_txid
175+
state=rat_gov_state, action_txid=action_txid
176176
)
177177
assert rat_action, "Action not found in ratified actions"
178178

cardano_node_tests/tests/tests_conway/test_hardfork.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_hardfork(
206206
gov_state=rat_gov_state, name_template=f"{temp_template}_rat_{rat_epoch}"
207207
)
208208
rat_action = governance_utils.lookup_ratified_actions(
209-
gov_state=rat_gov_state, action_txid=action_txid
209+
state=rat_gov_state, action_txid=action_txid
210210
)
211211
assert rat_action, "Action not found in ratified actions"
212212
reqc.cip043_01.success()

cardano_node_tests/tests/tests_conway/test_info.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,18 +248,18 @@ def test_info(
248248
conway_common.save_gov_state(
249249
gov_state=approved_gov_state, name_template=f"{temp_template}_approved_{approved_epoch}"
250250
)
251-
rat_info_action = governance_utils.lookup_ratified_actions(
252-
gov_state=approved_gov_state,
251+
252+
rat_state = cluster.g_query.get_ratify_state()
253+
rat_action = governance_utils.lookup_ratified_actions(
254+
state=rat_state,
253255
action_txid=action_txid,
254-
action_ix=action_ix,
255256
)
256-
assert not rat_info_action, "Action found in ratified actions"
257+
assert not rat_action, "Action found in ratified actions"
257258
reqc.cip053.success()
258259

260+
# Check ratification delay flag
259261
reqc.cip038_05.start(url=helpers.get_vcs_link())
260-
assert not approved_gov_state["nextRatifyState"]["ratificationDelayed"], (
261-
"Ratification is delayed unexpectedly"
262-
)
262+
assert not rat_state["ratificationDelayed"], "Ratification is delayed unexpectedly"
263263
reqc.cip038_05.success()
264264

265265
# Check deposit is returned

cardano_node_tests/tests/tests_conway/test_no_confidence.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def test_no_confidence_action(
230230
gov_state=rat_gov_state, name_template=f"{temp_template}_rat_{rat_epoch}"
231231
)
232232
rat_action = governance_utils.lookup_ratified_actions(
233-
gov_state=rat_gov_state, action_txid=action_txid
233+
state=rat_gov_state, action_txid=action_txid
234234
)
235235
assert rat_action, "Action not found in ratified actions"
236236

@@ -426,7 +426,7 @@ def test_committee_min_size(
426426

427427
# Check that the action is not ratified
428428
rat_const_action = governance_utils.lookup_ratified_actions(
429-
gov_state=approved_gov_state,
429+
state=approved_gov_state,
430430
action_txid=const_action_txid,
431431
action_ix=const_action_ix,
432432
)

cardano_node_tests/tests/tests_conway/test_pparam_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ def _check_state(state: dict):
12121212
)
12131213

12141214
rat_action = governance_utils.lookup_ratified_actions(
1215-
gov_state=rat_gov_state, action_txid=fin_prop_rec.action_txid
1215+
state=rat_gov_state, action_txid=fin_prop_rec.action_txid
12161216
)
12171217
assert rat_action, "Action not found in ratified actions"
12181218
# Disapprove ratified action, the voting shouldn't have any effect

0 commit comments

Comments
 (0)