From 14c8de7c9260e98a26f5ee1856b87f401ba37e76 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Wed, 26 Aug 2026 13:28:21 +0000 Subject: [PATCH] Add an end-to-end test for Dijkstra transaction witnessing Exercise the newly enabled Dijkstra transaction commands end to end: build-raw, witness and assemble a transaction, asserting the text envelope types along the way. --- ...ano-cli_palas_dijkstra_witnessing_test.yml | 6 ++ cardano-cli/cardano-cli.cabal | 1 + .../Golden/Dijkstra/Transaction/Assemble.hs | 73 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 .changes/20260828_214439_cardano-cli_palas_dijkstra_witnessing_test.yml create mode 100644 cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/Transaction/Assemble.hs diff --git a/.changes/20260828_214439_cardano-cli_palas_dijkstra_witnessing_test.yml b/.changes/20260828_214439_cardano-cli_palas_dijkstra_witnessing_test.yml new file mode 100644 index 0000000000..09dd55b087 --- /dev/null +++ b/.changes/20260828_214439_cardano-cli_palas_dijkstra_witnessing_test.yml @@ -0,0 +1,6 @@ +description: | + Added an end-to-end test covering Dijkstra transaction witnessing: build-raw, witness and assemble, asserting the text envelope types along the way. +kind: +- test +pr: 1432 +project: cardano-cli diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 76bd2c288e..3291cbf4e6 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -483,6 +483,7 @@ test-suite cardano-cli-golden Test.Golden.CreateStaked Test.Golden.CreateTestnetData Test.Golden.Debug.TransactionView + Test.Golden.Dijkstra.Transaction.Assemble Test.Golden.ErrorsSpec Test.Golden.Genesis.Common Test.Golden.Governance.Action diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/Transaction/Assemble.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/Transaction/Assemble.hs new file mode 100644 index 0000000000..978d3c9094 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/Transaction/Assemble.hs @@ -0,0 +1,73 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.Golden.Dijkstra.Transaction.Assemble where + +import Control.Monad (void) + +import Test.Cardano.CLI.Util + +import Hedgehog (Property) +import Hedgehog.Extras.Test qualified as H + +-- Check that a witness written by `transaction witness` in the Dijkstra era +-- can be read back by `transaction assemble` to form a transaction. +-- Regression test for https://github.com/IntersectMBO/cardano-cli/issues/1422 + +hprop_golden_dijkstra_transaction_assemble_witness_signing_key :: Property +hprop_golden_dijkstra_transaction_assemble_witness_signing_key = + watchdogProp . propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do + txBodyFile <- noteTempFile tempDir "tx-body" + + -- Create tx body file + void $ + execCardanoCLI + [ "dijkstra" + , "transaction" + , "build-raw" + , "--tx-in" + , "2392d2b1200b5139fe555c81261697b29a8ccf561c5c783d46e78a479d977053#0" + , "--tx-out" + , "addr1q94cxl99qvtwunsqqv6g9mgj3zrawtpt4edsgwxkjtwpy5dsezcht90tmwfur7t5hc9fk8hjd3r5vjwec2h8vmk3xh8s7er7t3+100" + , "--fee" + , "12" + , "--tx-body-file" + , txBodyFile + ] + + -- Sign it with a single signing key, as a detached witness file + witnessFile <- noteTempFile tempDir "single-signing-key-witness" + signingKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/conway/keys/payment_keys/signing_key" + + void $ + execCardanoCLI + [ "dijkstra" + , "transaction" + , "witness" + , "--tx-body-file" + , txBodyFile + , "--signing-key-file" + , signingKeyFile + , "--mainnet" + , "--out-file" + , witnessFile + ] + + H.assertFileOccurences 1 "TxWitness DijkstraEra" witnessFile + + -- Assemble the body and the witness back into a signed transaction + signedTxFile <- noteTempFile tempDir "signed-tx" + void $ + execCardanoCLI + [ "dijkstra" + , "transaction" + , "assemble" + , "--tx-body-file" + , txBodyFile + , "--witness-file" + , witnessFile + , "--out-file" + , signedTxFile + ] + + H.assertFileOccurences 1 "Tx DijkstraEra" signedTxFile