Skip to content

Commit b8f8c4f

Browse files
update compatible tests
1 parent fdf5a43 commit b8f8c4f

File tree

2 files changed

+84
-53
lines changed

2 files changed

+84
-53
lines changed

cardano_node_tests/tests/tests_conway/test_conway.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,61 @@ def test_ratify_state_fields(self, cluster: clusterlib.ClusterLib):
184184

185185
missing = expected_fields - set(ratify_state)
186186
assert not missing, f"Missing expected fields in ratify-state: {missing}"
187+
188+
189+
class TestNegativeLegacyGovernance:
190+
@allure.link(helpers.get_vcs_link())
191+
@pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"])
192+
@pytest.mark.smoke
193+
def test_mixed_legacy_govaction_and_conway_vote_cert_fails(
194+
self,
195+
cluster: clusterlib.ClusterLib,
196+
pool_user: clusterlib.PoolUser,
197+
era: str,
198+
):
199+
"""Mixing a legacy governance action with a Conway vote-delegation cert must fail."""
200+
temp_template = common.get_test_id(cluster)
201+
202+
payment_rec = pool_user.payment
203+
stake_rec = pool_user.stake
204+
205+
pool_ids = cluster.g_query.get_stake_pools()
206+
assert pool_ids, "No stake pools available on this testnet"
207+
pool_id = pool_ids[0]
208+
209+
era_api = getattr(cluster.g_compatible, era)
210+
legacy_prop = era_api.governance.action.gen_pparams_update(
211+
name=temp_template,
212+
epoch=cluster.g_query.get_epoch(),
213+
genesis_vkey_file=cluster.g_genesis.genesis_keys.genesis_vkeys[0],
214+
cli_args=["--max-block-body-size", "65536"],
215+
)
216+
217+
conway_vote = cluster.g_stake_address.gen_stake_and_vote_delegation_cert(
218+
addr_name=f"{temp_template}_vote",
219+
stake_vkey_file=stake_rec.vkey_file,
220+
stake_pool_id=pool_id,
221+
always_abstain=True,
222+
)
223+
224+
tx_files = clusterlib.TxFiles(
225+
certificate_files=[legacy_prop, conway_vote],
226+
signing_key_files=[payment_rec.skey_file, stake_rec.skey_file],
227+
)
228+
229+
with pytest.raises(clusterlib.CLIError) as excinfo:
230+
cluster.g_transaction.send_tx(
231+
src_address=payment_rec.address,
232+
tx_name=f"{temp_template}_mixed_fail",
233+
tx_files=tx_files,
234+
)
235+
236+
err = str(excinfo.value)
237+
238+
print("\n >>>>> ERROR START")
239+
print(err)
240+
print(" >>>>> ERROR END\n")
241+
242+
assert "TextEnvelope type error" in err, err
243+
assert "Expected: CertificateConway" in err, err
244+
assert "Actual: UpdateProposalShelley" in err, err

cardano_node_tests/tests/tests_conway/test_pparam_update.py

Lines changed: 26 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,40 +1433,54 @@ def test_pparam_keys(
14331433
[r.success() for r in (reqc.cip075, reqc.cip076, reqc.cip077, reqc.cip078)]
14341434

14351435

1436+
ERA_VALID_PPARAM = {
1437+
# Allowed in Shelley and mary compatible CLI
1438+
"shelley": ("--max-block-body-size", 65536, "maxBlockBodySize"),
1439+
"mary": ("--max-block-body-size", 65536, "maxBlockBodySize"),
1440+
# Allowed in Alonzo and babbage compatible CLI
1441+
"alonzo": ("--max-collateral-inputs", 4, "maxCollateralInputs"),
1442+
"babbage": ("--max-collateral-inputs", 4, "maxCollateralInputs"),
1443+
}
1444+
1445+
14361446
class TestLegacyProposals:
14371447
"""Tests for legacy update proposals in Conway."""
14381448

14391449
@allure.link(helpers.get_vcs_link())
14401450
@submit_utils.PARAM_SUBMIT_METHOD
1451+
@pytest.mark.parametrize("era", ["shelley", "mary", "alonzo", "babbage"])
14411452
@pytest.mark.smoke
14421453
def test_legacy_proposal_submit(
14431454
self,
14441455
cluster: clusterlib.ClusterLib,
14451456
payment_addr: clusterlib.AddressRecord,
14461457
submit_method: str,
1458+
era: str,
14471459
):
1448-
"""Test that a compatible Babbage pparam proposal cannot be submitted in Conway era."""
1460+
"""Test a compatible-era (Shelley, Mary, Alonzo, Babbage)."""
14491461
temp_template = common.get_test_id(cluster)
14501462

1463+
arg, val, name = ERA_VALID_PPARAM[era]
1464+
14511465
update_proposals = [
14521466
clusterlib_utils.UpdateProposal(
1453-
arg="--max-collateral-inputs",
1454-
value=4,
1455-
name="maxCollateralInputs",
1467+
arg=arg,
1468+
value=val,
1469+
name=name,
14561470
),
14571471
]
14581472

14591473
cli_args = clusterlib_utils.get_pparams_update_args(update_proposals=update_proposals)
14601474

1461-
# NEW: use compatible babbage pparam action
1462-
action_file = cluster.g_compatible.babbage.governance.action.gen_pparams_update(
1475+
era_api = getattr(cluster.g_compatible, era)
1476+
1477+
action_file = era_api.governance.action.gen_pparams_update(
14631478
name=temp_template,
14641479
epoch=cluster.g_query.get_epoch(),
14651480
genesis_vkey_file=cluster.g_genesis.genesis_keys.genesis_vkeys[0],
14661481
cli_args=cli_args,
14671482
)
14681483

1469-
# Submitting a Babbage-era proposal in Conway must fail
14701484
with pytest.raises((clusterlib.CLIError, submit_api.SubmitApiError)) as excinfo:
14711485
clusterlib_utils.build_and_submit_tx(
14721486
cluster_obj=cluster,
@@ -1483,54 +1497,13 @@ def test_legacy_proposal_submit(
14831497
)
14841498

14851499
err_str = str(excinfo.value)
1486-
assert "era" in err_str or "mismatch" in err_str or "TextEnvelope type error" in err_str, (
1487-
err_str
1488-
)
1489-
1490-
@allure.link(helpers.get_vcs_link())
1491-
@pytest.mark.smoke
1492-
def test_legacy_proposal_build(
1493-
self,
1494-
cluster: clusterlib.ClusterLib,
1495-
):
1496-
"""Test building a legacy update proposal with Conway cardano-cli.
1497-
1498-
Expect failure as the legacy update proposals are not supported in Conway.
1499-
"""
1500-
temp_template = common.get_test_id(cluster)
1501-
1502-
update_proposals = [
1503-
clusterlib_utils.UpdateProposal(
1504-
arg="--max-collateral-inputs",
1505-
value=4,
1506-
name="maxCollateralInputs",
1507-
),
1508-
]
15091500

1510-
cli_args = clusterlib_utils.get_pparams_update_args(update_proposals=update_proposals)
1511-
out_file = f"{temp_template}_update.proposal"
1501+
print("\nERROR MESSAGE START")
1502+
print(err_str)
1503+
print(" ERROR MESSAGE END\n")
15121504

1513-
with pytest.raises(clusterlib.CLIError) as excinfo:
1514-
cluster.cli(
1515-
[
1516-
"cardano-cli",
1517-
"conway",
1518-
"governance",
1519-
"create-update-proposal",
1520-
*cli_args,
1521-
"--out-file",
1522-
str(out_file),
1523-
"--epoch",
1524-
str(cluster.g_query.get_epoch()),
1525-
*helpers.prepend_flag(
1526-
"--genesis-verification-key-file",
1527-
cluster.g_genesis.genesis_keys.genesis_vkeys,
1528-
),
1529-
],
1530-
add_default_args=False,
1531-
)
1532-
err_str = str(excinfo.value)
1533-
assert "Invalid argument `create-update-proposal'" in err_str, err_str
1505+
assert "TextEnvelope type error" in err_str
1506+
assert "UpdateProposalShelley" in err_str
15341507

15351508

15361509
class TestNegativeCostModels:

0 commit comments

Comments
 (0)