-
Notifications
You must be signed in to change notification settings - Fork 24
Add an end-to-end test for Dijkstra transaction witnessing #1432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
.changes/20260828_214439_cardano-cli_palas_dijkstra_witnessing_test.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/Transaction/Assemble.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| H.diffFileVsGoldenFile signedTxFile goldenSignedTxFile | ||
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/transaction/assemble_out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "Tx DijkstraEra", | ||
| "description": "Ledger Cddl Format", | ||
| "cborHex": "83a300d901028182582063e6a9a8e58e48cc025cae04daaed9d36fc7b70bc292721d9f5057ae37b2498100018182581d605ebab53d2d9785718cf4105fe7a9e5d6e271e6c4aa0ad934082c19381b00000da475d6a980021a00030d40a100d901028182582048d968a47923d491cbba6548e61cc3e347e658d1818d7bea90cf7d04ca13dbd158403fbd836aa93e48e0b48d7635ce06ce070c1310fd8295fb59423268cb247e36097d52224a98d8cc483c357eeb37fd36f2d951a23cd7f9df7d9f54f8545335ac0bf6" | ||
| } |
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/transaction/witness_out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "TxWitness DijkstraEra", | ||
| "description": "Key Witness ShelleyEra", | ||
| "cborHex": "82582048d968a47923d491cbba6548e61cc3e347e658d1818d7bea90cf7d04ca13dbd158403fbd836aa93e48e0b48d7635ce06ce070c1310fd8295fb59423268cb247e36097d52224a98d8cc483c357eeb37fd36f2d951a23cd7f9df7d9f54f8545335ac0b" | ||
| } |
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/cardano-cli-golden/files/input/dijkstra/keys/utxo_keys/signing_key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.