Skip to content

Commit dcea5da

Browse files
committed
feat: use deposit queries
Replace reading deposit values from genesis files with deposit query functions that get the deposit values from current pparams.
1 parent 22adadb commit dcea5da

14 files changed

+42
-40
lines changed

cardano_node_tests/tests/test_node_upgrade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_hardfork(
215215
governance_utils.wait_delayed_ratification(cluster_obj=cluster)
216216

217217
# Create an action
218-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
218+
deposit_amt = cluster.g_query.get_gov_action_deposit()
219219
anchor_data = governance_utils.get_default_anchor_data()
220220
prev_action_rec = governance_utils.get_prev_action(
221221
action_type=governance_utils.PrevGovActionIds.HARDFORK,

cardano_node_tests/tests/tests_conway/conway_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def propose_change_constitution(
427427
constitution_script_hash: str = "",
428428
) -> tuple[clusterlib.ActionConstitution, str, int]:
429429
"""Propose a constitution change."""
430-
deposit_amt = cluster_obj.conway_genesis["govActionDeposit"]
430+
deposit_amt = cluster_obj.g_query.get_gov_action_deposit()
431431

432432
prev_action_rec = governance_utils.get_prev_action(
433433
action_type=governance_utils.PrevGovActionIds.CONSTITUTION,
@@ -503,7 +503,7 @@ def propose_pparams_update(
503503
prev_action_rec: governance_utils.PrevActionRec | None = None,
504504
) -> PParamPropRec:
505505
"""Propose a pparams update."""
506-
deposit_amt = cluster_obj.conway_genesis["govActionDeposit"]
506+
deposit_amt = cluster_obj.g_query.get_gov_action_deposit()
507507

508508
prev_action_rec = prev_action_rec or governance_utils.get_prev_action(
509509
action_type=governance_utils.PrevGovActionIds.PPARAM_UPDATE,

cardano_node_tests/tests/tests_conway/test_committee.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def test_invalid_cc_member_vote( # noqa: C901
172172
"""
173173
cluster, governance_data = cluster_use_governance
174174
temp_template = common.get_test_id(cluster)
175+
deposit_amt = cluster.g_query.get_gov_action_deposit()
175176

176177
submit_methods = [submit_utils.SubmitMethods.CLI]
177178
if submit_utils.is_submit_api_available():
@@ -278,7 +279,6 @@ def _submit_vote(scenario: str, build_method: str, submit_method: str) -> None:
278279
return
279280

280281
def _propose_new_member() -> None:
281-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
282282
anchor_data = governance_utils.get_default_anchor_data()
283283
prev_action_rec = governance_utils.get_prev_action(
284284
action_type=governance_utils.PrevGovActionIds.COMMITTEE,
@@ -446,7 +446,7 @@ def test_update_committee_action(
446446
for r in cc_auth_records
447447
]
448448

449-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
449+
deposit_amt = cluster.g_query.get_gov_action_deposit()
450450
anchor_data = governance_utils.get_default_anchor_data()
451451
prev_action_rec = governance_utils.get_prev_action(
452452
action_type=governance_utils.PrevGovActionIds.COMMITTEE,
@@ -598,7 +598,7 @@ def test_add_rm_committee_members( # noqa: C901
598598
pool_user_lg.stake.address
599599
).reward_account_balance
600600

601-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
601+
deposit_amt = cluster.g_query.get_gov_action_deposit()
602602

603603
# Check if total delegated stake is below the threshold. This can be used to check that
604604
# undelegated stake is treated as Abstain. If undelegated stake was treated as No, it
@@ -1345,7 +1345,7 @@ def test_empty_committee(
13451345
if conway_common.is_in_bootstrap(cluster_obj=cluster):
13461346
pytest.skip("Cannot run during bootstrap period.")
13471347

1348-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
1348+
deposit_amt = cluster.g_query.get_gov_action_deposit()
13491349

13501350
def _set_zero_committee_pparam() -> conway_common.PParamPropRec:
13511351
"""Set the `committeeMinSize` pparam to 0."""
@@ -1725,7 +1725,7 @@ def _check_rat_enact_state(
17251725

17261726
assert prev_action_rec.txid == action_txid, "Action not enacted"
17271727

1728-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
1728+
deposit_amt = cluster.g_query.get_gov_action_deposit()
17291729
anchor_data = governance_utils.get_default_anchor_data()
17301730
prev_action_rec = governance_utils.get_prev_action(
17311731
action_type=governance_utils.PrevGovActionIds.COMMITTEE,

cardano_node_tests/tests/tests_conway/test_constitution.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def test_change_constitution(
341341
rand_str = clusterlib.get_rand_str(4)
342342
governance_data = governance_w_scripts_lg
343343
temp_template = f"{common.get_test_id(cluster)}_{rand_str}"
344+
deposit_amt = cluster.g_query.get_gov_action_deposit()
344345

345346
init_return_account_balance = cluster.g_query.get_stake_addr_info(
346347
pool_user_lg.stake.address
@@ -535,10 +536,9 @@ def _check_cli_query():
535536
pool_user_lg.stake.address
536537
).reward_account_balance
537538

538-
assert (
539-
enact_deposit_returned
540-
== init_return_account_balance + cluster.conway_genesis["govActionDeposit"]
541-
), "Incorrect return account balance"
539+
assert enact_deposit_returned == init_return_account_balance + deposit_amt, (
540+
"Incorrect return account balance"
541+
)
542542

543543
reqc.cip027.start(url=helpers.get_vcs_link())
544544
# Try to withdraw the deposit from stake address that is not delegated to a DRep

cardano_node_tests/tests/tests_conway/test_drep.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def test_register_and_retire_drep(
353353
* Check that deposit was returned to source address
354354
"""
355355
temp_template = common.get_test_id(cluster)
356-
deposit_drep_amt = cluster.conway_genesis["dRepDeposit"]
356+
deposit_drep_amt = cluster.g_query.get_drep_deposit()
357357

358358
# Make sure there's enought funds on the payment address on long running
359359
# testnets where the DRep deposit is higher.
@@ -629,7 +629,7 @@ def test_no_witness_register_and_retire( # noqa: C901
629629
* Check that DRep was retired
630630
"""
631631
temp_template = common.get_test_id(cluster)
632-
deposit_drep_amt = cluster.conway_genesis["dRepDeposit"]
632+
deposit_drep_amt = cluster.g_query.get_drep_deposit()
633633

634634
# Make sure there's enought funds on the payment address on long running
635635
# testnets where the DRep deposit is higher.
@@ -772,8 +772,9 @@ def test_no_multiple_delegation(
772772
"""
773773
cluster = cluster_rewards
774774
temp_template = common.get_test_id(cluster)
775-
deposit_address_amt = cluster.g_query.get_address_deposit()
776-
deposit_drep_amt = cluster.conway_genesis["dRepDeposit"]
775+
pparams = cluster.g_query.get_protocol_params()
776+
deposit_address_amt = cluster.g_query.get_address_deposit(pparams=pparams)
777+
deposit_drep_amt = cluster.g_query.get_drep_deposit(pparams=pparams)
777778

778779
# Make sure there's enought funds on the payment address on long running
779780
# testnets where the DRep deposit is higher.
@@ -927,7 +928,7 @@ def test_drep_no_retirement_before_register(
927928
* Check that it is not possible to retire before registering the DRep
928929
"""
929930
temp_template = common.get_test_id(cluster)
930-
deposit_drep_amt = cluster.conway_genesis["dRepDeposit"]
931+
deposit_drep_amt = cluster.g_query.get_drep_deposit()
931932

932933
drep_keys = cluster.g_conway_governance.drep.gen_key_pair(
933934
key_name=temp_template, destination_dir="."
@@ -981,7 +982,7 @@ def test_drep_no_multiple_registration(
981982
* Expect ConwayDRepAlreadyRegistered on the second time
982983
"""
983984
temp_template = common.get_test_id(cluster)
984-
deposit_drep_amt = cluster.conway_genesis["dRepDeposit"]
985+
deposit_drep_amt = cluster.g_query.get_drep_deposit()
985986

986987
# Make sure there's enought funds on the payment address on long running
987988
# testnets where the DRep deposit is higher.
@@ -1445,8 +1446,9 @@ def test_change_delegation(
14451446
"""
14461447
cluster = cluster_rewards
14471448
temp_template = common.get_test_id(cluster)
1448-
deposit_address_amt = cluster.g_query.get_address_deposit()
1449-
deposit_drep_amt = cluster.conway_genesis["dRepDeposit"]
1449+
pparams = cluster.g_query.get_protocol_params()
1450+
deposit_address_amt = cluster.g_query.get_address_deposit(pparams=pparams)
1451+
deposit_drep_amt = cluster.g_query.get_drep_deposit(pparams=pparams)
14501452

14511453
# Make sure there's enought funds on the payment address on long running
14521454
# testnets where the DRep deposit is higher.

cardano_node_tests/tests/tests_conway/test_guardrails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def propose_param_changes(
225225

226226
temp_template = common.get_test_id(cluster)
227227
anchor_data = governance_utils.get_default_anchor_data()
228-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
228+
deposit_amt = cluster.g_query.get_gov_action_deposit()
229229
prev_action_rec = governance_utils.get_prev_action(
230230
action_type=governance_utils.PrevGovActionIds.PPARAM_UPDATE,
231231
gov_state=cluster.g_conway_governance.query.gov_state(),

cardano_node_tests/tests/tests_conway/test_hardfork.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_hardfork(
7474
).reward_account_balance
7575

7676
# Create an action
77-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
77+
deposit_amt = cluster.g_query.get_gov_action_deposit()
7878
anchor_data = governance_utils.get_default_anchor_data()
7979
prev_action_rec = governance_utils.get_prev_action(
8080
action_type=governance_utils.PrevGovActionIds.HARDFORK,

cardano_node_tests/tests/tests_conway/test_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_info(
6868
"""
6969
cluster, governance_data = cluster_use_governance
7070
temp_template = common.get_test_id(cluster)
71-
action_deposit_amt = cluster.conway_genesis["govActionDeposit"]
71+
action_deposit_amt = cluster.g_query.get_gov_action_deposit()
7272

7373
# Get initial return account balance
7474
init_return_account_balance = cluster.g_query.get_stake_addr_info(

cardano_node_tests/tests/tests_conway/test_no_confidence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_no_confidence_action(
9898
).reward_account_balance
9999

100100
# Create an action
101-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
101+
deposit_amt = cluster.g_query.get_gov_action_deposit()
102102
anchor_data = governance_utils.get_default_anchor_data()
103103

104104
_url = helpers.get_vcs_link()

cardano_node_tests/tests/tests_conway/test_pparam_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ def _check_state(state: dict):
12721272
# Check that deposit is returned for the enacted pparam proposal right after enactment.
12731273
# Check that deposit is returned also for pparam proposals that are no longer valid
12741274
# (all the remaining pparam proposals in our case).
1275-
deposit_amt = cluster.conway_genesis["govActionDeposit"]
1275+
deposit_amt = cluster.g_query.get_gov_action_deposit()
12761276
total_deposit_return = cluster.g_query.get_stake_addr_info(
12771277
pool_user_lgp.stake.address
12781278
).reward_account_balance

0 commit comments

Comments
 (0)