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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
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.
kind:
- test
pr: 1432
project: cardano-cli
1 change: 1 addition & 0 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{-# 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
--
-- The exact transaction pinned by the golden files below was submitted to and
-- accepted by a local Dijkstra testnet (magic 42).

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"
, "63e6a9a8e58e48cc025cae04daaed9d36fc7b70bc292721d9f5057ae37b24981#0"
, "--tx-out"
, "addr_test1vp0t4dfa9ktc2uvv7sg9leafuhtwyu0xcj4q4kf5pqkpjwqhklklg+15000002800000"
, "--fee"
, "200000"
, "--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/dijkstra/keys/utxo_keys/signing_key"

void $
execCardanoCLI
[ "dijkstra"
, "transaction"
, "witness"
, "--tx-body-file"
, txBodyFile
, "--signing-key-file"
, signingKeyFile
, "--testnet-magic"
, "42"
, "--out-file"
, witnessFile
]

goldenWitnessFile <- H.note "test/cardano-cli-golden/files/golden/dijkstra/transaction/witness_out"
H.diffFileVsGoldenFile witnessFile goldenWitnessFile

-- 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
]

goldenSignedTxFile <-
H.note "test/cardano-cli-golden/files/golden/dijkstra/transaction/assemble_out"
Comment thread
palas marked this conversation as resolved.
H.diffFileVsGoldenFile signedTxFile goldenSignedTxFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Tx DijkstraEra",
"description": "Ledger Cddl Format",
"cborHex": "83a300d901028182582063e6a9a8e58e48cc025cae04daaed9d36fc7b70bc292721d9f5057ae37b2498100018182581d605ebab53d2d9785718cf4105fe7a9e5d6e271e6c4aa0ad934082c19381b00000da475d6a980021a00030d40a100d901028182582048d968a47923d491cbba6548e61cc3e347e658d1818d7bea90cf7d04ca13dbd158403fbd836aa93e48e0b48d7635ce06ce070c1310fd8295fb59423268cb247e36097d52224a98d8cc483c357eeb37fd36f2d951a23cd7f9df7d9f54f8545335ac0bf6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "TxWitness DijkstraEra",
"description": "Key Witness ShelleyEra",
"cborHex": "82582048d968a47923d491cbba6548e61cc3e347e658d1818d7bea90cf7d04ca13dbd158403fbd836aa93e48e0b48d7635ce06ce070c1310fd8295fb59423268cb247e36097d52224a98d8cc483c357eeb37fd36f2d951a23cd7f9df7d9f54f8545335ac0b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "GenesisUTxOSigningKey_ed25519",
"description": "Genesis Initial UTxO Signing Key",
"cborHex": "58201f9d562346236cdb730b5f59ab0e3b8bdbb079583b4b52a44798947a643612ce"
}
Loading