From bdc603ba7b78196f6868dce6f40f1e22300afad0 Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Thu, 21 May 2026 17:18:39 +0200 Subject: [PATCH] fix(tests): switch tx-view test to Conway-era tx Babbage-era transactions no longer supported by `cardano-cli transaction view`. Regenerate golden files from Conway txs and drop the CLI 799 issue probe. Strip the legacy `update proposal` field from view output before comparing, since newer cardano-cli omits it. --- .../tests/data/test_tx_metadata_both_tx.body | 5 --- .../data/test_tx_metadata_both_tx.signed | 5 --- .../test_tx_metadata_both_tx_conway.signed | 5 +++ ..._tx_metadata_both_tx_conway_body_json.out} | 19 ++++++---- ... test_tx_metadata_both_tx_conway_json.out} | 23 ++++++----- cardano_node_tests/tests/test_cli.py | 38 ++++++++++--------- 6 files changed, 49 insertions(+), 46 deletions(-) delete mode 100644 cardano_node_tests/tests/data/test_tx_metadata_both_tx.body delete mode 100644 cardano_node_tests/tests/data/test_tx_metadata_both_tx.signed create mode 100644 cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway.signed rename cardano_node_tests/tests/data/{test_tx_metadata_both_tx_body_json.out => test_tx_metadata_both_tx_conway_body_json.out} (63%) rename cardano_node_tests/tests/data/{test_tx_metadata_both_tx_json.out => test_tx_metadata_both_tx_conway_json.out} (52%) diff --git a/cardano_node_tests/tests/data/test_tx_metadata_both_tx.body b/cardano_node_tests/tests/data/test_tx_metadata_both_tx.body deleted file mode 100644 index fc234b9cf..000000000 --- a/cardano_node_tests/tests/data/test_tx_metadata_both_tx.body +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "Unwitnessed Tx BabbageEra", - "description": "Ledger Cddl Format", - "cborHex": "84a40081825820dd104594a4931043f7ef36013f242d4970b9a29fc6b830287da8d76672aa94f700018182581d60074ed88f9b967cb8af9f417c1f3f79933d928664f2316de353b482af1a3b97e2b9021a0002e74707582083f9c606d3db46759c0ffb0b1f12fc8fd03460de7a4099f9ee797cdbb790beafa0f5d90103a100a50163666f6f0263626172036362617a056763617264616e6f066572756c6573" -} diff --git a/cardano_node_tests/tests/data/test_tx_metadata_both_tx.signed b/cardano_node_tests/tests/data/test_tx_metadata_both_tx.signed deleted file mode 100644 index 5070d929e..000000000 --- a/cardano_node_tests/tests/data/test_tx_metadata_both_tx.signed +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "Witnessed Tx BabbageEra", - "description": "Ledger Cddl Format", - "cborHex": "84a40081825820dd104594a4931043f7ef36013f242d4970b9a29fc6b830287da8d76672aa94f700018182581d60074ed88f9b967cb8af9f417c1f3f79933d928664f2316de353b482af1a3b97e2b9021a0002e74707582083f9c606d3db46759c0ffb0b1f12fc8fd03460de7a4099f9ee797cdbb790beafa10081825820c1e17fce61b04af4db756abc51c5079c1fe2ebeeb6b8aeb7d0f5befbd95dc5975840c4e90ada7bdd904ce91eb529a1c2047c88b54c0dd7d72afd3d452d065eca4bb3f66d3338cd23a4cf34954e6247812b2220c0a7828e9cf8492b9d71a4f39e3a0bf5d90103a100a50163666f6f0263626172036362617a056763617264616e6f066572756c6573" -} diff --git a/cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway.signed b/cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway.signed new file mode 100644 index 000000000..24df15066 --- /dev/null +++ b/cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway.signed @@ -0,0 +1,5 @@ +{ + "type": "Tx ConwayEra", + "description": "Ledger Cddl Format", + "cborHex": "84a400d90102818258204ad2df9b1f1202220d1ab47a94453ea76383f80aa5c74850d9883ed9bd9a51b300018182581d607f3a4205d7ab4e208210ba4d6193a2ca882e62aa6da8ded2da3d63231a08ee035f021a0002ce2107582083f9c606d3db46759c0ffb0b1f12fc8fd03460de7a4099f9ee797cdbb790beafa100d901028182582030d6dabd81a036a78a2995f4c2e62fe03bf958a4a353d0e8da75b0d22c27ec6058402c97662e1fd4f5ef3b7f494596901e133393b3438ad18b3e351c19a7d613d1c472bbd6023b6c841cb7217fc88c676aa4f21566efc21832236d26129e65f09d0bf5d90103a100a50163666f6f0263626172036362617a056763617264616e6f066572756c6573" +} diff --git a/cardano_node_tests/tests/data/test_tx_metadata_both_tx_body_json.out b/cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway_body_json.out similarity index 63% rename from cardano_node_tests/tests/data/test_tx_metadata_both_tx_body_json.out rename to cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway_body_json.out index 22e483f9d..574201ed6 100644 --- a/cardano_node_tests/tests/data/test_tx_metadata_both_tx_body_json.out +++ b/cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway_body_json.out @@ -2,11 +2,13 @@ "auxiliary scripts": null, "certificates": null, "collateral inputs": [], + "currentTreasuryValue": null, "datums": [], - "era": "Babbage", - "fee": "190279 Lovelace", + "era": "Conway", + "fee": "183841 Lovelace", + "governance actions": [], "inputs": [ - "dd104594a4931043f7ef36013f242d4970b9a29fc6b830287da8d76672aa94f7#0" + "09dc7193a34e99ec75abb398ce6dad49d6a5d403bead3bc5bafdc03a364859f8#0" ], "metadata": { "1": "foo", @@ -18,13 +20,13 @@ "mint": null, "outputs": [ { - "address": "addr_test1vqr5aky0nwt8ew90naqhc8el0xfnmy5xvnerzm0r2w6g9tcsug7hk", + "address": "addr_test1vzfgl2n7hauuhrxdeascef33c3jn5m34hvpt0yhf3maq0ngt6rpls", "address era": "Shelley", "amount": { - "lovelace": 999809721 + "lovelace": 149816159 }, "network": "Testnet", - "payment credential key hash": "074ed88f9b967cb8af9f417c1f3f79933d928664f2316de353b482af", + "payment credential key hash": "928faa7ebf79cb8ccdcf618ca631c4653a6e35bb02b792e98efa07cd", "reference script": null, "stake reference": null } @@ -35,10 +37,11 @@ "return collateral": null, "scripts": [], "total collateral": null, - "update proposal": null, + "treasuryDonation": 0, "validity range": { "lower bound": null, "upper bound": null }, + "voters": {}, "withdrawals": null -} +} \ No newline at end of file diff --git a/cardano_node_tests/tests/data/test_tx_metadata_both_tx_json.out b/cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway_json.out similarity index 52% rename from cardano_node_tests/tests/data/test_tx_metadata_both_tx_json.out rename to cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway_json.out index 0f267c823..47f25297c 100644 --- a/cardano_node_tests/tests/data/test_tx_metadata_both_tx_json.out +++ b/cardano_node_tests/tests/data/test_tx_metadata_both_tx_conway_json.out @@ -2,11 +2,13 @@ "auxiliary scripts": null, "certificates": null, "collateral inputs": [], + "currentTreasuryValue": null, "datums": [], - "era": "Babbage", - "fee": "190279 Lovelace", + "era": "Conway", + "fee": "183841 Lovelace", + "governance actions": [], "inputs": [ - "dd104594a4931043f7ef36013f242d4970b9a29fc6b830287da8d76672aa94f7#0" + "4ad2df9b1f1202220d1ab47a94453ea76383f80aa5c74850d9883ed9bd9a51b3#0" ], "metadata": { "1": "foo", @@ -18,13 +20,13 @@ "mint": null, "outputs": [ { - "address": "addr_test1vqr5aky0nwt8ew90naqhc8el0xfnmy5xvnerzm0r2w6g9tcsug7hk", + "address": "addr_test1vpln5ss96745ugyzzzay6cvn5t9gstnz4fk63hkjmg7kxgc3j0r9m", "address era": "Shelley", "amount": { - "lovelace": 999809721 + "lovelace": 149816159 }, "network": "Testnet", - "payment credential key hash": "074ed88f9b967cb8af9f417c1f3f79933d928664f2316de353b482af", + "payment credential key hash": "7f3a4205d7ab4e208210ba4d6193a2ca882e62aa6da8ded2da3d6323", "reference script": null, "stake reference": null } @@ -35,16 +37,17 @@ "return collateral": null, "scripts": [], "total collateral": null, - "update proposal": null, + "treasuryDonation": 0, "validity range": { "lower bound": null, "upper bound": null }, + "voters": {}, "withdrawals": null, "witnesses": [ { - "key": "VKey (VerKeyEd25519DSIGN \"c1e17fce61b04af4db756abc51c5079c1fe2ebeeb6b8aeb7d0f5befbd95dc597\")", - "signature": "SignedDSIGN (SigEd25519DSIGN \"c4e90ada7bdd904ce91eb529a1c2047c88b54c0dd7d72afd3d452d065eca4bb3f66d3338cd23a4cf34954e6247812b2220c0a7828e9cf8492b9d71a4f39e3a0b\")" + "key": "VKey (VerKeyEd25519DSIGN \"30d6dabd81a036a78a2995f4c2e62fe03bf958a4a353d0e8da75b0d22c27ec60\")", + "signature": "SignedDSIGN (SigEd25519DSIGN \"2c97662e1fd4f5ef3b7f494596901e133393b3438ad18b3e351c19a7d613d1c472bbd6023b6c841cb7217fc88c676aa4f21566efc21832236d26129e65f09d0b\")" } ] -} +} \ No newline at end of file diff --git a/cardano_node_tests/tests/test_cli.py b/cardano_node_tests/tests/test_cli.py index 53e1eeaf1..d0272130a 100644 --- a/cardano_node_tests/tests/test_cli.py +++ b/cardano_node_tests/tests/test_cli.py @@ -35,11 +35,10 @@ class TestCLI: """Tests for cardano-cli.""" - TX_BODY_FILE = DATA_DIR / "test_tx_metadata_both_tx.body" TX_BODY_FILE_CONWAY = DATA_DIR / "test_tx_metadata_both_tx_conway.body" - TX_FILE = DATA_DIR / "test_tx_metadata_both_tx.signed" - TX_BODY_OUT_JSON = DATA_DIR / "test_tx_metadata_both_tx_body_json.out" - TX_OUT_JSON = DATA_DIR / "test_tx_metadata_both_tx_json.out" + TX_FILE_CONWAY = DATA_DIR / "test_tx_metadata_both_tx_conway.signed" + TX_BODY_OUT_JSON_CONWAY = DATA_DIR / "test_tx_metadata_both_tx_conway_body_json.out" + TX_OUT_JSON_CONWAY = DATA_DIR / "test_tx_metadata_both_tx_conway_json.out" @allure.link(helpers.get_vcs_link()) @pytest.mark.smoke @@ -225,32 +224,35 @@ def test_tx_view(self, cluster: clusterlib.ClusterLib): body and signed transaction files. * Execute `cardano-cli transaction view --tx-body-file` command - * Check output includes redeemers and datums fields * Compare transaction body JSON output with golden file * Execute `cardano-cli transaction view --tx-file` command for signed transaction * Compare signed transaction JSON output with golden file + + We no longer test the CLI 799 issue (`issues.cli_799`), Babbage-era transactions + are not supported by the `transaction view` anymore. """ common.get_test_id(cluster) - tx_body = cluster.g_transaction.view_tx(tx_body_file=self.TX_BODY_FILE) + def _sanitize(tx_view_out: str) -> str: + # The legacy "update proposal" is not present in the output produced + # by newer versions of `cardano-cli`. + return "\n".join( + line + for line in tx_view_out.splitlines() + if not line.strip().startswith('"update proposal":') + ).strip() - if '"redeemers":' not in tx_body: - pytest.skip("unsupported old output format") - if '"datums":' not in tx_body: - pytest.skip("unsupported old output format") + tx_body = cluster.g_transaction.view_tx(tx_body_file=self.TX_BODY_FILE_CONWAY) - with open(self.TX_BODY_OUT_JSON, encoding="utf-8") as infile: + with open(self.TX_BODY_OUT_JSON_CONWAY, encoding="utf-8") as infile: tx_body_golden = infile.read() - assert tx_body == tx_body_golden.strip() - - tx = cluster.g_transaction.view_tx(tx_file=self.TX_FILE) + assert _sanitize(tx_body) == tx_body_golden.strip() - if '"governance actions":' in tx: - issues.cli_799.finish_test() + tx = cluster.g_transaction.view_tx(tx_file=self.TX_FILE_CONWAY) - with open(self.TX_OUT_JSON, encoding="utf-8") as infile: + with open(self.TX_OUT_JSON_CONWAY, encoding="utf-8") as infile: tx_golden = infile.read() - assert tx == tx_golden.strip() + assert _sanitize(tx) == tx_golden.strip() @allure.link(helpers.get_vcs_link()) @pytest.mark.smoke