diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 1383ec545d..bb86a64ff2 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -364,6 +364,7 @@ test-suite cardano-cli-golden Test.Golden.Byron.UpdateProposal Test.Golden.Byron.Vote Test.Golden.Byron.Witness + Test.Golden.Conway.Transaction.Assemble Test.Golden.EraBased.Governance.AnswerPoll Test.Golden.EraBased.Governance.CreatePoll Test.Golden.EraBased.Governance.VerifyPoll diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 876893be31..74e01afa31 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -603,6 +603,7 @@ readCddlWitness fp = do , FromCDDLWitness "TxWitness MaryEra" CddlWitness , FromCDDLWitness "TxWitness AlonzoEra" CddlWitness , FromCDDLWitness "TxWitness BabbageEra" CddlWitness + , FromCDDLWitness "TxWitness ConwayEra" CddlWitness ] -- Witness handling @@ -860,6 +861,7 @@ readFileInAnyCardanoEra , HasTextEnvelope (thing MaryEra) , HasTextEnvelope (thing AlonzoEra) , HasTextEnvelope (thing BabbageEra) + , HasTextEnvelope (thing ConwayEra) ) => (forall era. AsType era -> AsType (thing era)) -> FileOrPipe @@ -872,6 +874,7 @@ readFileInAnyCardanoEra asThing = , FromSomeType (asThing AsMaryEra) (InAnyCardanoEra MaryEra) , FromSomeType (asThing AsAlonzoEra) (InAnyCardanoEra AlonzoEra) , FromSomeType (asThing AsBabbageEra) (InAnyCardanoEra BabbageEra) + , FromSomeType (asThing AsConwayEra) (InAnyCardanoEra ConwayEra) ] -- | We need a type for handling files that may be actually be things like diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Conway/Transaction/Assemble.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Conway/Transaction/Assemble.hs new file mode 100644 index 0000000000..d2a8c0eced --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Conway/Transaction/Assemble.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.Golden.Conway.Transaction.Assemble where + +import Control.Monad (void) + +import Test.Cardano.CLI.Util + +import Hedgehog (Property) +import qualified Hedgehog.Extras.Test.Base as H +import qualified Hedgehog.Extras.Test.File as H + +{- HLINT ignore "Use camelCase" -} + +-- Check that we can assemble a txbody and a tx witness to form a transaction + +hprop_golden_conwayTransactionAssembleWitness_SigningKey :: Property +hprop_golden_conwayTransactionAssembleWitness_SigningKey = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do + witnessTx <- noteTempFile tempDir "single-signing-key-witness-tx" + txBodyFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/txbody" + signingKeyWitnessFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/singleSigningKeyWitness" + void $ execCardanoCLI + [ "conway", "transaction", "assemble" + , "--tx-body-file", txBodyFile + , "--witness-file", signingKeyWitnessFile + , "--witness-file", signingKeyWitnessFile + , "--out-file", witnessTx + ] + + H.assertFileOccurences 1 "Witnessed Tx ConwayEra" witnessTx diff --git a/cardano-cli/test/cardano-cli-golden/files/input/conway/singleSigningKeyWitness b/cardano-cli/test/cardano-cli-golden/files/input/conway/singleSigningKeyWitness new file mode 100644 index 0000000000..2a09eeed44 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/conway/singleSigningKeyWitness @@ -0,0 +1,5 @@ +{ + "type": "TxWitness ConwayEra", + "description": "Key Witness ShelleyEra", + "cborHex": "825820c16f6bf723e38013f88588539fbbf1cd6b57bbbd8bb2cf318e641f00dcd527875840e62f3050bf7ee1d1547badd6f8346c00957b20c8d8f201fc8cf9d64485b3b3c944392afe00619516a00d98c6ccfa44a7de8c1a093efdc10832bb6fdf4cde8e08" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/conway/txbody b/cardano-cli/test/cardano-cli-golden/files/input/conway/txbody new file mode 100644 index 0000000000..b50f9b7f07 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/conway/txbody @@ -0,0 +1,5 @@ +{ + "type": "Unwitnessed Tx ConwayEra", + "description": "Ledger Cddl Format", + "cborHex": "84a5008182582054b5f2d5ed0fa142e724c9a982864d9e080b10648a66c8f7956eb3cc2cf16c0000018182581d6052e63f22c5107ed776b70f7b92248b02552fd08f3e747bc7450994411b0000000235cfef6d021a0002ff51031a0099d1dd04828a03581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d75820dacc52f2d73542ab0fc3b1f8051d00b0e50f1130935e5a21982bd289705852ae1b000000174876e8001b00000002540be400d81e82010a581de05e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c81581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c818400190bb9447f000001f682783268747470733a2f2f6d792d69702e61742f746573742f636f6e77617974657374706f6f6c2e6d657461646174612e6a736f6e58207cd083e6682892afc2b4e315fca93784f43dccde8bae1daa81db0b587e27155f83028200581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d7a0f5f6" +}