Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cardano_node_tests/tests/data/test_tx_metadata_both_tx.body

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Tx ConwayEra",
"description": "Ledger Cddl Format",
"cborHex": "84a400d90102818258204ad2df9b1f1202220d1ab47a94453ea76383f80aa5c74850d9883ed9bd9a51b300018182581d607f3a4205d7ab4e208210ba4d6193a2ca882e62aa6da8ded2da3d63231a08ee035f021a0002ce2107582083f9c606d3db46759c0ffb0b1f12fc8fd03460de7a4099f9ee797cdbb790beafa100d901028182582030d6dabd81a036a78a2995f4c2e62fe03bf958a4a353d0e8da75b0d22c27ec6058402c97662e1fd4f5ef3b7f494596901e133393b3438ad18b3e351c19a7d613d1c472bbd6023b6c841cb7217fc88c676aa4f21566efc21832236d26129e65f09d0bf5d90103a100a50163666f6f0263626172036362617a056763617264616e6f066572756c6573"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
}
Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
}
Expand All @@ -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\")"
}
]
}
}
38 changes: 20 additions & 18 deletions cardano_node_tests/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Comment thread
mkoura marked this conversation as resolved.

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
Expand Down
Loading