Skip to content

Commit af6862f

Browse files
authored
Merge pull request #1432 from IntersectMBO/add-dijkstra-witnessing-test
Add an end-to-end test for Dijkstra transaction witnessing
2 parents d302ca6 + 62e6b19 commit af6862f

6 files changed

Lines changed: 102 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, pinning the witness and the assembled transaction against golden files; the pinned transaction was submitted to and accepted by a local Dijkstra testnet.
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: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
-- The exact transaction pinned by the golden files below was submitted to and
17+
-- accepted by a local Dijkstra testnet (magic 42).
18+
19+
hprop_golden_dijkstra_transaction_assemble_witness_signing_key :: Property
20+
hprop_golden_dijkstra_transaction_assemble_witness_signing_key =
21+
watchdogProp . propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do
22+
txBodyFile <- noteTempFile tempDir "tx-body"
23+
24+
-- Create tx body file
25+
void $
26+
execCardanoCLI
27+
[ "dijkstra"
28+
, "transaction"
29+
, "build-raw"
30+
, "--tx-in"
31+
, "63e6a9a8e58e48cc025cae04daaed9d36fc7b70bc292721d9f5057ae37b24981#0"
32+
, "--tx-out"
33+
, "addr_test1vp0t4dfa9ktc2uvv7sg9leafuhtwyu0xcj4q4kf5pqkpjwqhklklg+15000002800000"
34+
, "--fee"
35+
, "200000"
36+
, "--tx-body-file"
37+
, txBodyFile
38+
]
39+
40+
-- Sign it with a single signing key, as a detached witness file
41+
witnessFile <- noteTempFile tempDir "single-signing-key-witness"
42+
signingKeyFile <-
43+
noteInputFile "test/cardano-cli-golden/files/input/dijkstra/keys/utxo_keys/signing_key"
44+
45+
void $
46+
execCardanoCLI
47+
[ "dijkstra"
48+
, "transaction"
49+
, "witness"
50+
, "--tx-body-file"
51+
, txBodyFile
52+
, "--signing-key-file"
53+
, signingKeyFile
54+
, "--testnet-magic"
55+
, "42"
56+
, "--out-file"
57+
, witnessFile
58+
]
59+
60+
goldenWitnessFile <- H.note "test/cardano-cli-golden/files/golden/dijkstra/transaction/witness_out"
61+
H.diffFileVsGoldenFile witnessFile goldenWitnessFile
62+
63+
-- Assemble the body and the witness back into a signed transaction
64+
signedTxFile <- noteTempFile tempDir "signed-tx"
65+
void $
66+
execCardanoCLI
67+
[ "dijkstra"
68+
, "transaction"
69+
, "assemble"
70+
, "--tx-body-file"
71+
, txBodyFile
72+
, "--witness-file"
73+
, witnessFile
74+
, "--out-file"
75+
, signedTxFile
76+
]
77+
78+
goldenSignedTxFile <-
79+
H.note "test/cardano-cli-golden/files/golden/dijkstra/transaction/assemble_out"
80+
H.diffFileVsGoldenFile signedTxFile goldenSignedTxFile
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "Tx DijkstraEra",
3+
"description": "Ledger Cddl Format",
4+
"cborHex": "83a300d901028182582063e6a9a8e58e48cc025cae04daaed9d36fc7b70bc292721d9f5057ae37b2498100018182581d605ebab53d2d9785718cf4105fe7a9e5d6e271e6c4aa0ad934082c19381b00000da475d6a980021a00030d40a100d901028182582048d968a47923d491cbba6548e61cc3e347e658d1818d7bea90cf7d04ca13dbd158403fbd836aa93e48e0b48d7635ce06ce070c1310fd8295fb59423268cb247e36097d52224a98d8cc483c357eeb37fd36f2d951a23cd7f9df7d9f54f8545335ac0bf6"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "TxWitness DijkstraEra",
3+
"description": "Key Witness ShelleyEra",
4+
"cborHex": "82582048d968a47923d491cbba6548e61cc3e347e658d1818d7bea90cf7d04ca13dbd158403fbd836aa93e48e0b48d7635ce06ce070c1310fd8295fb59423268cb247e36097d52224a98d8cc483c357eeb37fd36f2d951a23cd7f9df7d9f54f8545335ac0b"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "GenesisUTxOSigningKey_ed25519",
3+
"description": "Genesis Initial UTxO Signing Key",
4+
"cborHex": "58201f9d562346236cdb730b5f59ab0e3b8bdbb079583b4b52a44798947a643612ce"
5+
}

0 commit comments

Comments
 (0)