Skip to content

Commit 14c8de7

Browse files
committed
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.
1 parent 045fe41 commit 14c8de7

3 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
description: |
2+
Added an end-to-end test covering Dijkstra transaction witnessing: build-raw, witness and assemble, asserting the text envelope types along the way.
3+
kind:
4+
- test
5+
pr: 1432
6+
project: cardano-cli

cardano-cli/cardano-cli.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ test-suite cardano-cli-golden
483483
Test.Golden.CreateStaked
484484
Test.Golden.CreateTestnetData
485485
Test.Golden.Debug.TransactionView
486+
Test.Golden.Dijkstra.Transaction.Assemble
486487
Test.Golden.ErrorsSpec
487488
Test.Golden.Genesis.Common
488489
Test.Golden.Governance.Action
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
module Test.Golden.Dijkstra.Transaction.Assemble where
4+
5+
import Control.Monad (void)
6+
7+
import Test.Cardano.CLI.Util
8+
9+
import Hedgehog (Property)
10+
import Hedgehog.Extras.Test qualified as H
11+
12+
-- Check that a witness written by `transaction witness` in the Dijkstra era
13+
-- can be read back by `transaction assemble` to form a transaction.
14+
-- Regression test for https://github.com/IntersectMBO/cardano-cli/issues/1422
15+
16+
hprop_golden_dijkstra_transaction_assemble_witness_signing_key :: Property
17+
hprop_golden_dijkstra_transaction_assemble_witness_signing_key =
18+
watchdogProp . propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do
19+
txBodyFile <- noteTempFile tempDir "tx-body"
20+
21+
-- Create tx body file
22+
void $
23+
execCardanoCLI
24+
[ "dijkstra"
25+
, "transaction"
26+
, "build-raw"
27+
, "--tx-in"
28+
, "2392d2b1200b5139fe555c81261697b29a8ccf561c5c783d46e78a479d977053#0"
29+
, "--tx-out"
30+
, "addr1q94cxl99qvtwunsqqv6g9mgj3zrawtpt4edsgwxkjtwpy5dsezcht90tmwfur7t5hc9fk8hjd3r5vjwec2h8vmk3xh8s7er7t3+100"
31+
, "--fee"
32+
, "12"
33+
, "--tx-body-file"
34+
, txBodyFile
35+
]
36+
37+
-- Sign it with a single signing key, as a detached witness file
38+
witnessFile <- noteTempFile tempDir "single-signing-key-witness"
39+
signingKeyFile <-
40+
noteInputFile "test/cardano-cli-golden/files/input/conway/keys/payment_keys/signing_key"
41+
42+
void $
43+
execCardanoCLI
44+
[ "dijkstra"
45+
, "transaction"
46+
, "witness"
47+
, "--tx-body-file"
48+
, txBodyFile
49+
, "--signing-key-file"
50+
, signingKeyFile
51+
, "--mainnet"
52+
, "--out-file"
53+
, witnessFile
54+
]
55+
56+
H.assertFileOccurences 1 "TxWitness DijkstraEra" witnessFile
57+
58+
-- Assemble the body and the witness back into a signed transaction
59+
signedTxFile <- noteTempFile tempDir "signed-tx"
60+
void $
61+
execCardanoCLI
62+
[ "dijkstra"
63+
, "transaction"
64+
, "assemble"
65+
, "--tx-body-file"
66+
, txBodyFile
67+
, "--witness-file"
68+
, witnessFile
69+
, "--out-file"
70+
, signedTxFile
71+
]
72+
73+
H.assertFileOccurences 1 "Tx DijkstraEra" signedTxFile

0 commit comments

Comments
 (0)