From 3e2996c90b005afd448b369944c91a682c008f95 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 30 Jun 2020 09:30:55 +0100 Subject: [PATCH] Add tx & certificate related golden tests using hedgehog --- cardano-api/src/Cardano/Api/Typed.hs | 2 - cardano-cli/cardano-cli.cabal | 24 +++- .../Byron/TextEnvelope/Golden/PaymentKeys.hs | 6 +- .../Test/CLI/Byron/TextEnvelope/Golden/Tx.hs | 13 ++ .../CLI/Byron/TextEnvelope/Golden/TxBody.hs | 13 ++ .../CLI/Byron/TextEnvelope/Golden/Witness.hs | 13 ++ .../GenesisDelegationCertificate.hs | 17 +++ .../Golden/Certificates/MIRCertificate.hs | 58 ++++++++ .../Certificates/OperationalCertificate.hs | 76 +++++++++++ .../Certificates/StakeAddressCertificates.hs | 88 +++++++++++++ .../Certificates/StakePoolCertificates.hs | 124 ++++++++++++++++++ .../Golden/{ => Keys}/GenesisDelegateKeys.hs | 17 ++- .../Golden/{ => Keys}/GenesisKeys.hs | 15 +-- .../Golden/{ => Keys}/GenesisUTxOKeys.hs | 15 +-- .../TextEnvelope/Golden/{ => Keys}/KESKeys.hs | 15 +-- .../Golden/{ => Keys}/PaymentKeys.hs | 15 +-- .../Golden/{ => Keys}/StakeKeys.hs | 17 ++- .../TextEnvelope/Golden/{ => Keys}/VRFKeys.hs | 17 ++- .../CLI/Shelley/TextEnvelope/Golden/Tests.hs | 59 +++++++-- .../CLI/Shelley/TextEnvelope/Golden/Tx/Tx.hs | 76 +++++++++++ .../Shelley/TextEnvelope/Golden/Tx/TxBody.hs | 50 +++++++ .../Shelley/TextEnvelope/Golden/Tx/Witness.hs | 17 +++ cardano-cli/test/Test/ITN.hs | 2 - cardano-cli/test/Test/OptParse.hs | 18 ++- cardano-cli/test/Test/Pioneers/Exercise1.hs | 11 +- cardano-cli/test/Test/Pioneers/Exercise2.hs | 3 - cardano-cli/test/Test/Pioneers/Exercise3.hs | 3 - cardano-cli/test/Test/Pioneers/Exercise4.hs | 2 - .../shelley/certificates/mir_certificate | 4 + .../certificates/operational_certificate | 7 + .../stake_address_deregistration_certificate | 4 + .../stake_address_registration_certificate | 4 + .../stake_pool_deregistration_certificate | 4 + .../stake_pool_registration_certificate | 7 + .../operational_certificate_counter | 0 .../genesis_delegate_keys/signing_key | 0 .../genesis_delegate_keys/verification_key | 0 .../{ => keys}/genesis_keys/signing_key | 0 .../{ => keys}/genesis_keys/verification_key | 0 .../{ => keys}/genesis_utxo_keys/signing_key | 0 .../genesis_utxo_keys/verification_key | 0 .../shelley/{ => keys}/kes_keys/signing_key | 0 .../{ => keys}/kes_keys/verification_key | 0 .../{ => keys}/payment_keys/signing_key | 0 .../{ => keys}/payment_keys/verification_key | 0 .../shelley/{ => keys}/stake_keys/signing_key | 0 .../{ => keys}/stake_keys/verification_key | 0 .../shelley/{ => keys}/vrf_keys/signing_key | 0 .../{ => keys}/vrf_keys/verification_key | 0 cardano-cli/test/Test/golden/shelley/tx/tx | 8 ++ .../test/Test/golden/shelley/tx/txbody | 6 + cardano-cli/test/cardano-cli-pioneers.hs | 6 +- 52 files changed, 726 insertions(+), 110 deletions(-) create mode 100644 cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Tx.hs create mode 100644 cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/TxBody.hs create mode 100644 cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Witness.hs create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/GenesisDelegationCertificate.hs create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/MIRCertificate.hs create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/OperationalCertificate.hs create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakeAddressCertificates.hs create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakePoolCertificates.hs rename cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/{ => Keys}/GenesisDelegateKeys.hs (70%) rename cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/{ => Keys}/GenesisKeys.hs (71%) rename cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/{ => Keys}/GenesisUTxOKeys.hs (69%) rename cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/{ => Keys}/KESKeys.hs (71%) rename cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/{ => Keys}/PaymentKeys.hs (71%) rename cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/{ => Keys}/StakeKeys.hs (69%) rename cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/{ => Keys}/VRFKeys.hs (69%) create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Tx.hs create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/TxBody.hs create mode 100644 cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Witness.hs create mode 100644 cardano-cli/test/Test/golden/shelley/certificates/mir_certificate create mode 100644 cardano-cli/test/Test/golden/shelley/certificates/operational_certificate create mode 100644 cardano-cli/test/Test/golden/shelley/certificates/stake_address_deregistration_certificate create mode 100644 cardano-cli/test/Test/golden/shelley/certificates/stake_address_registration_certificate create mode 100644 cardano-cli/test/Test/golden/shelley/certificates/stake_pool_deregistration_certificate create mode 100644 cardano-cli/test/Test/golden/shelley/certificates/stake_pool_registration_certificate rename cardano-cli/test/Test/golden/shelley/{ => keys}/genesis_delegate_keys/operational_certificate_counter (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/genesis_delegate_keys/signing_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/genesis_delegate_keys/verification_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/genesis_keys/signing_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/genesis_keys/verification_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/genesis_utxo_keys/signing_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/genesis_utxo_keys/verification_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/kes_keys/signing_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/kes_keys/verification_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/payment_keys/signing_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/payment_keys/verification_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/stake_keys/signing_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/stake_keys/verification_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/vrf_keys/signing_key (100%) rename cardano-cli/test/Test/golden/shelley/{ => keys}/vrf_keys/verification_key (100%) create mode 100644 cardano-cli/test/Test/golden/shelley/tx/tx create mode 100644 cardano-cli/test/Test/golden/shelley/tx/txbody diff --git a/cardano-api/src/Cardano/Api/Typed.hs b/cardano-api/src/Cardano/Api/Typed.hs index 7afc7ac7f5f..0cf20bd38c8 100644 --- a/cardano-api/src/Cardano/Api/Typed.hs +++ b/cardano-api/src/Cardano/Api/Typed.hs @@ -843,7 +843,6 @@ instance SerialiseAsCBOR (TxBody Shelley) where fromCBOR (LBS.fromStrict bs) - instance HasTextEnvelope (TxBody Byron) where textEnvelopeType _ = "TxUnsignedByron" @@ -970,7 +969,6 @@ instance SerialiseAsCBOR (Tx Shelley) where ShelleyTx <$> CBOR.decodeAnnotator "Shelley Tx" fromCBOR (LBS.fromStrict bs) - instance HasTextEnvelope (Tx Byron) where textEnvelopeType _ = "TxSignedByron" diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index a2aef315de3..554fb57152c 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -186,14 +186,24 @@ test-suite cardano-cli-pioneers , transformers-except other-modules: Test.CLI.Byron.TextEnvelope.Golden.PaymentKeys - Test.CLI.Shelley.TextEnvelope.Golden.GenesisDelegateKeys - Test.CLI.Shelley.TextEnvelope.Golden.GenesisKeys - Test.CLI.Shelley.TextEnvelope.Golden.GenesisUTxOKeys - Test.CLI.Shelley.TextEnvelope.Golden.KESKeys - Test.CLI.Shelley.TextEnvelope.Golden.PaymentKeys - Test.CLI.Shelley.TextEnvelope.Golden.StakeKeys + Test.CLI.Byron.TextEnvelope.Golden.Tx + Test.CLI.Byron.TextEnvelope.Golden.TxBody + Test.CLI.Byron.TextEnvelope.Golden.Witness + Test.CLI.Shelley.TextEnvelope.Golden.Certificates.MIRCertificate + Test.CLI.Shelley.TextEnvelope.Golden.Certificates.OperationalCertificate + Test.CLI.Shelley.TextEnvelope.Golden.Certificates.StakeAddressCertificates + Test.CLI.Shelley.TextEnvelope.Golden.Certificates.StakePoolCertificates + Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisDelegateKeys + Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisKeys + Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisUTxOKeys + Test.CLI.Shelley.TextEnvelope.Golden.Keys.KESKeys + Test.CLI.Shelley.TextEnvelope.Golden.Keys.PaymentKeys + Test.CLI.Shelley.TextEnvelope.Golden.Keys.StakeKeys + Test.CLI.Shelley.TextEnvelope.Golden.Keys.VRFKeys Test.CLI.Shelley.TextEnvelope.Golden.Tests - Test.CLI.Shelley.TextEnvelope.Golden.VRFKeys + Test.CLI.Shelley.TextEnvelope.Golden.Tx.Tx + Test.CLI.Shelley.TextEnvelope.Golden.Tx.TxBody + Test.CLI.Shelley.TextEnvelope.Golden.Tx.Witness Test.ITN Test.OptParse Test.Pioneers.Exercise1 diff --git a/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/PaymentKeys.hs b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/PaymentKeys.hs index e965e0bc35d..6c1fcc9cc5a 100644 --- a/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/PaymentKeys.hs +++ b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/PaymentKeys.hs @@ -10,8 +10,8 @@ import Hedgehog (Property) --- | 1. We generate a key pair --- 2. We check for the existence of the key pair --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair +-- 3. Check the TextEnvelope serialization format has not changed. golden_byronPaymentKeys :: Property golden_byronPaymentKeys = panic "TODO" diff --git a/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Tx.hs b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Tx.hs new file mode 100644 index 00000000000..fa31247f912 --- /dev/null +++ b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Tx.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Byron.TextEnvelope.Golden.Tx + ( golden_byronTx + ) where + +import Cardano.Prelude + +import Hedgehog (Property) + + +golden_byronTx :: Property +golden_byronTx = panic "TODO" diff --git a/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/TxBody.hs b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/TxBody.hs new file mode 100644 index 00000000000..96324966089 --- /dev/null +++ b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/TxBody.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Byron.TextEnvelope.Golden.TxBody + ( golden_byronTxBody + ) where + +import Cardano.Prelude + +import Hedgehog (Property) + + +golden_byronTxBody :: Property +golden_byronTxBody = panic "TODO" diff --git a/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Witness.hs b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Witness.hs new file mode 100644 index 00000000000..bc1bcc71d9e --- /dev/null +++ b/cardano-cli/test/Test/CLI/Byron/TextEnvelope/Golden/Witness.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Byron.TextEnvelope.Golden.Witness + ( golden_byronWitness + ) where + +import Cardano.Prelude + +import Hedgehog (Property) + + +golden_byronWitness :: Property +golden_byronWitness = panic "TODO" diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/GenesisDelegationCertificate.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/GenesisDelegationCertificate.hs new file mode 100644 index 00000000000..c1ef7445f0f --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/GenesisDelegationCertificate.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Certificates.GenesisDelegation + ( golden_shelleyGenesisDelegationCertificate + ) where + +import Cardano.Prelude + +--import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +--import qualified Hedgehog as H + +--import Test.OptParse + +golden_shelleyGenesisDelegationCertificate :: Property +golden_shelleyGenesisDelegationCertificate = panic "TODO" diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/MIRCertificate.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/MIRCertificate.hs new file mode 100644 index 00000000000..a38de9bd72a --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/MIRCertificate.hs @@ -0,0 +1,58 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Certificates.MIRCertificate + ( golden_shelleyMIRCertificate + ) where + +import Cardano.Prelude + +import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +import qualified Hedgehog as H + +import Test.OptParse + +-- | 1. Generate stake key pair +-- 2. Create MIR certificate +-- s. Check the TextEnvelope serialization format has not changed. +golden_shelleyMIRCertificate :: Property +golden_shelleyMIRCertificate = + propertyOnce $ do + -- Reference keys + let referenceMIRCertificate = "test/Test/golden/shelley/certificates/mir_certificate" + + -- Key filepaths + let verKey = "stake-verification-key-file" + signKey = "stake-signing-key-file" + mirCertificate = "mir-certificate-file" + createdFiles = [verKey, signKey, mirCertificate] + + -- Generate stake key pair + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","stake-address","key-gen" + , "--verification-key-file", verKey + , "--signing-key-file", signKey + ] + + assertFilesExist [verKey, signKey] + + -- Create MIR certificate + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","governance","create-mir-certificate" + , "--reserves" --TODO: Should also do "--reserves" + , "--stake-verification-key-file", verKey + , "--reward", "1000" + , "--out-file", mirCertificate + ] + + assertFilesExist [mirCertificate] + + let registrationCertificateType = textEnvelopeType AsCertificate + + checkTextEnvelopeFormat createdFiles registrationCertificateType referenceMIRCertificate mirCertificate + + liftIO $ fileCleanup createdFiles + H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/OperationalCertificate.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/OperationalCertificate.hs new file mode 100644 index 00000000000..cee6d630aa0 --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/OperationalCertificate.hs @@ -0,0 +1,76 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Certificates.OperationalCertificate + ( golden_shelleyOperationalCertificate + ) where + +import Cardano.Prelude + +import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +import qualified Hedgehog as H + +import Test.OptParse + +-- | 1. Create KES key pair. +-- 2. Create cold keys. +-- 3. Create operational certificate. +-- 4. Check the TextEnvelope serialization format has not changed. +golden_shelleyOperationalCertificate :: Property +golden_shelleyOperationalCertificate = + propertyOnce $ do + + -- Reference keys + let referenceOperationalCertificate = "test/Test/golden/shelley/certificates/operational_certificate" + + -- Key filepaths + let kesVerKey = "KES-verification-key-file" + kesSignKey = "KES-signing-key-file" + coldVerKey = "cold-verification-key-file" + coldSignKey = "cold-signing-key-file" + operationalCertCounter = "operational-certificate-counter-file" + operationalCert = "operational-certificate-file" + createdFiles = [kesVerKey, kesSignKey, coldVerKey, coldSignKey, operationalCertCounter, operationalCert] + + -- Create KES key pair + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","node","key-gen-KES" + , "--verification-key-file", kesVerKey + , "--signing-key-file", kesSignKey + ] + + assertFilesExist [kesSignKey, kesVerKey] + + -- Create cold key pair + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","node","key-gen" + , "--cold-verification-key-file", coldVerKey + , "--cold-signing-key-file", coldSignKey + , "--operational-certificate-issue-counter", operationalCertCounter + ] + + assertFilesExist [coldVerKey, coldSignKey, operationalCertCounter] + + -- Create operational certificate + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","node","issue-op-cert" + , "--kes-verification-key-file", kesVerKey + , "--cold-signing-key-file", coldSignKey + , "--operational-certificate-issue-counter", operationalCertCounter + , "--kes-period", "1000" + , "--out-file", operationalCert + ] + + assertFilesExist createdFiles + let operationalCertificateType = textEnvelopeType AsOperationalCertificate + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles operationalCertificateType referenceOperationalCertificate operationalCert + + liftIO $ fileCleanup createdFiles + H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakeAddressCertificates.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakeAddressCertificates.hs new file mode 100644 index 00000000000..2dcc2fa2f5c --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakeAddressCertificates.hs @@ -0,0 +1,88 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Certificates.StakeAddressCertificates + ( golden_shelleyStakeAddressCertificates + ) where + +import Cardano.Prelude + +import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +import qualified Hedgehog as H + +import Test.OptParse + +-- | 1. Generate a stake verification key +-- 2. Create a stake address registration certificate +-- 3. Check the TextEnvelope serialization format has not changed. +golden_shelleyStakeAddressCertificates :: Property +golden_shelleyStakeAddressCertificates = + propertyOnce $ do + + -- Reference files + let referenceRegistrationCertificate = "test/Test/golden/shelley/certificates/stake_address_registration_certificate" + referenceDeregistrationCertificate = "test/Test/golden/shelley/certificates/stake_address_deregistration_certificate" + + -- Key filepaths + let verKey = "stake-verification-key-file" + signKey = "stake-signing-key-file" + deregistrationCertificate = "stake-address-deregistration-certificate" + registrationCertificate = "stake-address-registration-certificate" + createdFiles = [verKey, signKey, deregistrationCertificate, registrationCertificate] + + -- Generate stake verification key + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","stake-address","key-gen" + , "--verification-key-file", verKey + , "--signing-key-file", signKey + ] + assertFilesExist [verKey, signKey] + + -- Create stake address registration certificate + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","stake-address","registration-certificate" + , "--stake-verification-key-file", verKey + , "--out-file", registrationCertificate + ] + + let registrationCertificateType = textEnvelopeType AsCertificate + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles registrationCertificateType referenceRegistrationCertificate registrationCertificate + + + -- Create stake address deregistration certificate + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","stake-address","deregistration-certificate" + , "--stake-verification-key-file", verKey + , "--out-file", deregistrationCertificate + ] + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles registrationCertificateType referenceDeregistrationCertificate deregistrationCertificate + + -- TODO: After delegation-certificate command is fixed to take a hash instead of a verfication key + {- + -- Create stake address delegation certificate + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","stake-address","delegation-certificate" + , "--stake-verification-key-file", verKey + , "--cold-verification-key-file", verKey --TODO: Should be stake pool's hash + , "--out-file", deregistrationCertificate + ] + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles registrationCertificateType referenceDeregistrationCertificate deregistrationCertificate + +-} + + liftIO $ fileCleanup createdFiles + H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakePoolCertificates.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakePoolCertificates.hs new file mode 100644 index 00000000000..37869a99f33 --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Certificates/StakePoolCertificates.hs @@ -0,0 +1,124 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Certificates.StakePoolCertificates + ( golden_shelleyStakePoolCertificates + ) where + +import Cardano.Prelude + +import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +import qualified Hedgehog as H + +import Test.OptParse + +-- | 1. Create cold key pair. +-- 2. Create stake key pair. +-- 3. Create VRF key pair. +-- 4. Create stake pool registration certificate. +-- 5. Create stake pool deregistration/retirement certificate. +-- 6. Check the TextEnvelope serialization format has not changed. +golden_shelleyStakePoolCertificates :: Property +golden_shelleyStakePoolCertificates = + propertyOnce $ do + + -- Reference files + let referenceRegistrationCertificate = "test/Test/golden/shelley/certificates/stake_pool_registration_certificate" + referenceDeregistrationCertificate = "test/Test/golden/shelley/certificates/stake_pool_deregistration_certificate" + + -- Key filepaths + let coldVerKey = "cold-verification-key-file" + coldSignKey = "cold-signing-key-file" + operationalCertCounter = "operational-certificate-counter-file" + vrfVerKey = "vrf-verification-key-file" + vrfSignKey = "vrf-signing-key-file" + poolRewardAccountAndOwnerVerKey = "reward-account-verification-key-file" + poolRewardAccountSignKey = "reward-account-signing-key-file" + registrationCertificate = "stake-pool-registration-certificate" + deregistrationCertificate = "stake-pool-deregistration-certificate" + createdFiles = [ coldVerKey + , coldSignKey + , operationalCertCounter + , vrfVerKey + , vrfSignKey + , poolRewardAccountAndOwnerVerKey + , poolRewardAccountSignKey + , registrationCertificate + , deregistrationCertificate + ] + + -- Create cold key pair + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","node","key-gen" + , "--cold-verification-key-file", coldVerKey + , "--cold-signing-key-file", coldSignKey + , "--operational-certificate-issue-counter", operationalCertCounter + ] + + assertFilesExist [coldSignKey, coldVerKey, operationalCertCounter] + + -- Generate stake key pair + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","stake-address","key-gen" + , "--verification-key-file", poolRewardAccountAndOwnerVerKey + , "--signing-key-file", poolRewardAccountSignKey + ] + + assertFilesExist [poolRewardAccountAndOwnerVerKey, poolRewardAccountSignKey] + + -- Generate vrf verification key + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","node","key-gen-VRF" + , "--verification-key-file", vrfVerKey + , "--signing-key-file", vrfSignKey + ] + + + assertFilesExist [vrfSignKey, vrfVerKey] + + -- Create stake pool registration certificate + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","stake-pool","registration-certificate" + , "--cold-verification-key-file", coldVerKey + , "--vrf-verification-key-file", vrfVerKey + , "--mainnet" + , "--pool-cost", "1000" + , "--pool-pledge", "5000" + , "--pool-margin", "0.1" + , "--pool-reward-account-verification-key-file", poolRewardAccountAndOwnerVerKey + , "--pool-owner-stake-verification-key-file", poolRewardAccountAndOwnerVerKey + , "--out-file", registrationCertificate + ] + + + assertFilesExist [registrationCertificate] + + let registrationCertificateType = textEnvelopeType AsCertificate + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles registrationCertificateType referenceRegistrationCertificate registrationCertificate + + + -- Create stake pool deregistration certificate + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley", "stake-pool", "deregistration-certificate" + , "--cold-verification-key-file", coldVerKey + , "--epoch", "42" + , "--out-file", deregistrationCertificate + ] + + assertFilesExist [deregistrationCertificate] + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles registrationCertificateType referenceDeregistrationCertificate deregistrationCertificate + + liftIO $ fileCleanup createdFiles + H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisDelegateKeys.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisDelegateKeys.hs similarity index 70% rename from cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisDelegateKeys.hs rename to cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisDelegateKeys.hs index 12d0f773171..c6cc7b083b6 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisDelegateKeys.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisDelegateKeys.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.CLI.Shelley.TextEnvelope.Golden.GenesisDelegateKeys +module Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisDelegateKeys ( golden_shelleyGenesisDelegateKeys ) where @@ -14,17 +14,17 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair & operational certificate counter file --- 2. We check for the existence of the key pair & counter file --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair & operational certificate counter file +-- 2. Check for the existence of the key pair & counter file +-- 3. Check the TextEnvelope serialization format has not changed. golden_shelleyGenesisDelegateKeys :: Property golden_shelleyGenesisDelegateKeys = propertyOnce $ do -- Reference keys - let referenceVerKey = "test/Test/golden/shelley/genesis_delegate_keys/verification_key" - rreferenceSignKey = "test/Test/golden/shelley/genesis_delegate_keys/signing_key" - referenceOpCertCounter = "test/Test/golden/shelley/genesis_delegate_keys/operational_certificate_counter" + let referenceVerKey = "test/Test/golden/shelley/keys/genesis_delegate_keys/verification_key" + referenceSignKey = "test/Test/golden/shelley/keys/genesis_delegate_keys/signing_key" + referenceOpCertCounter = "test/Test/golden/shelley/keys/genesis_delegate_keys/operational_certificate_counter" -- Key filepaths let verKey = "genesis-delegate-verification-key-file" @@ -35,7 +35,6 @@ golden_shelleyGenesisDelegateKeys = -- Generate payment verification key execCardanoCLIParser createdFiles - "golden_shelleyGenesisDelegateKeys.genesis_delegate_keypair_gen" $ evalCardanoCLIParser [ "shelley","genesis","key-gen-delegate" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -52,7 +51,7 @@ golden_shelleyGenesisDelegateKeys = -- Check the newly created files have not deviated from the -- golden files checkTextEnvelopeFormat createdFiles verificationKeyType referenceVerKey verKey - checkTextEnvelopeFormat createdFiles signingKeyType rreferenceSignKey signKey + checkTextEnvelopeFormat createdFiles signingKeyType referenceSignKey signKey checkTextEnvelopeFormat createdFiles operationalCertCounterType referenceOpCertCounter opCertCounter liftIO $ fileCleanup createdFiles diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisKeys.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisKeys.hs similarity index 71% rename from cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisKeys.hs rename to cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisKeys.hs index a5c82311a26..7361062b42f 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisKeys.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisKeys.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.CLI.Shelley.TextEnvelope.Golden.GenesisKeys +module Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisKeys ( golden_shelleyGenesisKeys ) where @@ -14,16 +14,16 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair --- 2. We check for the existence of the key pair --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair +-- 3. Check the TextEnvelope serialization format has not changed golden_shelleyGenesisKeys :: Property golden_shelleyGenesisKeys = propertyOnce $ do -- Reference keys - let referenceVerKey = "test/Test/golden/shelley/genesis_keys/verification_key" - rreferenceSignKey = "test/Test/golden/shelley/genesis_keys/signing_key" + let referenceVerKey = "test/Test/golden/shelley/keys/genesis_keys/verification_key" + referenceSignKey = "test/Test/golden/shelley/keys/genesis_keys/signing_key" -- Key filepaths let verKey = "genesis-verification-key-file" @@ -33,7 +33,6 @@ golden_shelleyGenesisKeys = -- Generate payment verification key execCardanoCLIParser createdFiles - "golden_shelleyGenesisKeys.genesis_keypair_gen" $ evalCardanoCLIParser [ "shelley","genesis","key-gen-genesis" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -48,7 +47,7 @@ golden_shelleyGenesisKeys = -- Check the newly created files have not deviated from the -- golden files checkTextEnvelopeFormat createdFiles verificationKeyType referenceVerKey verKey - checkTextEnvelopeFormat createdFiles signingKeyType rreferenceSignKey signKey + checkTextEnvelopeFormat createdFiles signingKeyType referenceSignKey signKey liftIO $ fileCleanup createdFiles H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisUTxOKeys.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisUTxOKeys.hs similarity index 69% rename from cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisUTxOKeys.hs rename to cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisUTxOKeys.hs index cf5da2b6239..a9981c72024 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/GenesisUTxOKeys.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/GenesisUTxOKeys.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.CLI.Shelley.TextEnvelope.Golden.GenesisUTxOKeys +module Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisUTxOKeys ( golden_shelleyGenesisUTxOKeys ) where @@ -14,16 +14,16 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair & operational certificate counter file --- 2. We check for the existence of the key pair & counter file --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair +-- 3. Check the TextEnvelope serialization format has not changed. golden_shelleyGenesisUTxOKeys :: Property golden_shelleyGenesisUTxOKeys = propertyOnce $ do -- Reference keys - let referenceVerKey = "test/Test/golden/shelley/genesis_utxo_keys/verification_key" - rreferenceSignKey = "test/Test/golden/shelley/genesis_utxo_keys/signing_key" + let referenceVerKey = "test/Test/golden/shelley/keys/genesis_utxo_keys/verification_key" + referenceSignKey = "test/Test/golden/shelley/keys/genesis_utxo_keys/signing_key" -- Key filepaths let verKey = "genesis-utxo-verification-key-file" @@ -33,7 +33,6 @@ golden_shelleyGenesisUTxOKeys = -- Generate payment verification key execCardanoCLIParser createdFiles - "golden_shelleyGenesisUTxOKeys.genesis_utxo_keypair_gen" $ evalCardanoCLIParser [ "shelley","genesis","key-gen-utxo" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -48,7 +47,7 @@ golden_shelleyGenesisUTxOKeys = -- Check the newly created files have not deviated from the -- golden files checkTextEnvelopeFormat createdFiles verificationKeyType referenceVerKey verKey - checkTextEnvelopeFormat createdFiles signingKeyType rreferenceSignKey signKey + checkTextEnvelopeFormat createdFiles signingKeyType referenceSignKey signKey liftIO $ fileCleanup createdFiles H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/KESKeys.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/KESKeys.hs similarity index 71% rename from cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/KESKeys.hs rename to cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/KESKeys.hs index c01b5cb3b9b..8eb217006f1 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/KESKeys.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/KESKeys.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.CLI.Shelley.TextEnvelope.Golden.KESKeys +module Test.CLI.Shelley.TextEnvelope.Golden.Keys.KESKeys ( golden_shelleyKESKeys ) where @@ -14,16 +14,16 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair --- 2. We check for the existence of the key pair --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair +-- 3. Check the TextEnvelope serialization format has not changed. golden_shelleyKESKeys :: Property golden_shelleyKESKeys = propertyOnce $ do -- Reference keys - let referenceVerKey = "test/Test/golden/shelley/kes_keys/verification_key" - rreferenceSignKey = "test/Test/golden/shelley/kes_keys/signing_key" + let referenceVerKey = "test/Test/golden/shelley/keys/kes_keys/verification_key" + referenceSignKey = "test/Test/golden/shelley/keys/kes_keys/signing_key" -- Key filepaths let verKey = "kes-verification-key-file" @@ -33,7 +33,6 @@ golden_shelleyKESKeys = -- Generate payment verification key execCardanoCLIParser createdFiles - "golden_shelleyKESKeys.kes_keypair_gen" $ evalCardanoCLIParser [ "shelley","node","key-gen-KES" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -48,7 +47,7 @@ golden_shelleyKESKeys = -- Check the newly created files have not deviated from the -- golden files checkTextEnvelopeFormat createdFiles verificationKeyType referenceVerKey verKey - checkTextEnvelopeFormat createdFiles signingKeyType rreferenceSignKey signKey + checkTextEnvelopeFormat createdFiles signingKeyType referenceSignKey signKey liftIO $ fileCleanup createdFiles H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/PaymentKeys.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/PaymentKeys.hs similarity index 71% rename from cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/PaymentKeys.hs rename to cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/PaymentKeys.hs index a7fe350257e..3cbb6ef4102 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/PaymentKeys.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/PaymentKeys.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.CLI.Shelley.TextEnvelope.Golden.PaymentKeys +module Test.CLI.Shelley.TextEnvelope.Golden.Keys.PaymentKeys ( golden_shelleyPaymentKeys ) where @@ -14,16 +14,16 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair --- 2. We check for the existence of the key pair --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair +-- 3. Check the TextEnvelope serialization format has not changed. golden_shelleyPaymentKeys :: Property golden_shelleyPaymentKeys = propertyOnce $ do -- Reference keys - let referenceVerKey = "test/Test/golden/shelley/payment_keys/verification_key" - rreferenceSignKey = "test/Test/golden/shelley/payment_keys/signing_key" + let referenceVerKey = "test/Test/golden/shelley/keys/payment_keys/verification_key" + referenceSignKey = "test/Test/golden/shelley/keys/payment_keys/signing_key" -- Key filepaths let verKey = "payment-verification-key-file" @@ -33,7 +33,6 @@ golden_shelleyPaymentKeys = -- Generate payment verification key execCardanoCLIParser createdFiles - "golden_shelleyPaymentKeys.payment_keypair_gen" $ evalCardanoCLIParser [ "shelley","address","key-gen" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -48,7 +47,7 @@ golden_shelleyPaymentKeys = -- Check the newly created files have not deviated from the -- golden files checkTextEnvelopeFormat createdFiles verificationKeyType referenceVerKey verKey - checkTextEnvelopeFormat createdFiles signingKeyType rreferenceSignKey signKey + checkTextEnvelopeFormat createdFiles signingKeyType referenceSignKey signKey liftIO $ fileCleanup createdFiles H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/StakeKeys.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/StakeKeys.hs similarity index 69% rename from cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/StakeKeys.hs rename to cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/StakeKeys.hs index c5cb8e02db5..4cb58d09fa6 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/StakeKeys.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/StakeKeys.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.CLI.Shelley.TextEnvelope.Golden.StakeKeys +module Test.CLI.Shelley.TextEnvelope.Golden.Keys.StakeKeys ( golden_shelleyStakeKeys ) where @@ -14,26 +14,25 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair --- 2. We check for the existence of the key pair --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair +-- 3. Check the TextEnvelope serialization format has not changed. golden_shelleyStakeKeys :: Property golden_shelleyStakeKeys = propertyOnce $ do -- Reference keys - let referenceVerKey = "test/Test/golden/shelley/stake_keys/verification_key" - rreferenceSignKey = "test/Test/golden/shelley/stake_keys/signing_key" + let referenceVerKey = "test/Test/golden/shelley/keys/stake_keys/verification_key" + referenceSignKey = "test/Test/golden/shelley/keys/stake_keys/signing_key" -- Key filepaths let verKey = "stake-verification-key-file" signKey = "stake-signing-key-file" createdFiles = [verKey, signKey] - -- Generate payment verification key + -- Generate stake key pair execCardanoCLIParser createdFiles - "golden_shelleyStakeKeys.stake_keypair_gen" $ evalCardanoCLIParser [ "shelley","stake-address","key-gen" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -48,7 +47,7 @@ golden_shelleyStakeKeys = -- Check the newly created files have not deviated from the -- golden files checkTextEnvelopeFormat createdFiles verificationKeyType referenceVerKey verKey - checkTextEnvelopeFormat createdFiles signingKeyType rreferenceSignKey signKey + checkTextEnvelopeFormat createdFiles signingKeyType referenceSignKey signKey liftIO $ fileCleanup createdFiles H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/VRFKeys.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/VRFKeys.hs similarity index 69% rename from cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/VRFKeys.hs rename to cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/VRFKeys.hs index 080ded0c635..80cac941204 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/VRFKeys.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Keys/VRFKeys.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.CLI.Shelley.TextEnvelope.Golden.VRFKeys +module Test.CLI.Shelley.TextEnvelope.Golden.Keys.VRFKeys ( golden_shelleyVRFKeys ) where @@ -14,26 +14,25 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair --- 2. We check for the existence of the key pair --- 3. We check the TextEnvelope serialization format has not changed. +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair +-- 3. Check the TextEnvelope serialization format has not changed. golden_shelleyVRFKeys :: Property golden_shelleyVRFKeys = propertyOnce $ do -- Reference keys - let referenceVerKey = "test/Test/golden/shelley/vrf_keys/verification_key" - rreferenceSignKey = "test/Test/golden/shelley/vrf_keys/signing_key" + let referenceVerKey = "test/Test/golden/shelley/keys/vrf_keys/verification_key" + referenceSignKey = "test/Test/golden/shelley/keys/vrf_keys/signing_key" -- Key filepaths let verKey = "vrf-verification-key-file" signKey = "vrf-signing-key-file" createdFiles = [verKey, signKey] - -- Generate payment verification key + -- Generate vrf verification key execCardanoCLIParser createdFiles - "golden_shelleyVRFKeys.kes_keypair_gen" $ evalCardanoCLIParser [ "shelley","node","key-gen-VRF" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -47,7 +46,7 @@ golden_shelleyVRFKeys = -- Check the newly created files have not deviated from the -- golden files checkTextEnvelopeFormat createdFiles verificationKeyType referenceVerKey verKey - checkTextEnvelopeFormat createdFiles signingKeyType rreferenceSignKey signKey + checkTextEnvelopeFormat createdFiles signingKeyType referenceSignKey signKey liftIO $ fileCleanup createdFiles H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tests.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tests.hs index 831f0c23481..ec4b41bb8b7 100644 --- a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tests.hs +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tests.hs @@ -1,23 +1,44 @@ {-# LANGUAGE OverloadedStrings #-} module Test.CLI.Shelley.TextEnvelope.Golden.Tests - ( tests + ( keyTests + , certificateTests + , txTests ) where import Cardano.Prelude -import Test.CLI.Shelley.TextEnvelope.Golden.GenesisDelegateKeys (golden_shelleyGenesisDelegateKeys) -import Test.CLI.Shelley.TextEnvelope.Golden.GenesisUTxOKeys (golden_shelleyGenesisUTxOKeys) -import Test.CLI.Shelley.TextEnvelope.Golden.GenesisKeys (golden_shelleyGenesisKeys) -import Test.CLI.Shelley.TextEnvelope.Golden.KESKeys (golden_shelleyKESKeys) -import Test.CLI.Shelley.TextEnvelope.Golden.PaymentKeys (golden_shelleyPaymentKeys) -import Test.CLI.Shelley.TextEnvelope.Golden.StakeKeys (golden_shelleyStakeKeys) -import Test.CLI.Shelley.TextEnvelope.Golden.VRFKeys (golden_shelleyVRFKeys) +import Test.CLI.Shelley.TextEnvelope.Golden.Certificates.StakeAddressCertificates + (golden_shelleyStakeAddressCertificates) +import Test.CLI.Shelley.TextEnvelope.Golden.Certificates.MIRCertificate + (golden_shelleyMIRCertificate) +import Test.CLI.Shelley.TextEnvelope.Golden.Certificates.OperationalCertificate + (golden_shelleyOperationalCertificate) +import Test.CLI.Shelley.TextEnvelope.Golden.Certificates.StakePoolCertificates + (golden_shelleyStakePoolCertificates) + +import Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisDelegateKeys + (golden_shelleyGenesisDelegateKeys) +import Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisUTxOKeys + (golden_shelleyGenesisUTxOKeys) +import Test.CLI.Shelley.TextEnvelope.Golden.Keys.GenesisKeys + (golden_shelleyGenesisKeys) +import Test.CLI.Shelley.TextEnvelope.Golden.Keys.KESKeys + (golden_shelleyKESKeys) +import Test.CLI.Shelley.TextEnvelope.Golden.Keys.PaymentKeys + (golden_shelleyPaymentKeys) +import Test.CLI.Shelley.TextEnvelope.Golden.Keys.StakeKeys + (golden_shelleyStakeKeys) +import Test.CLI.Shelley.TextEnvelope.Golden.Keys.VRFKeys + (golden_shelleyVRFKeys) + +import Test.CLI.Shelley.TextEnvelope.Golden.Tx.Tx (golden_shelleyTx) +import Test.CLI.Shelley.TextEnvelope.Golden.Tx.TxBody (golden_shelleyTxBody) import qualified Hedgehog as H -tests :: IO Bool -tests = +keyTests :: IO Bool +keyTests = H.checkSequential $ H.Group "TextEnvelope Key Goldens" [ ("golden_shelleyPaymentKeys", golden_shelleyPaymentKeys) @@ -28,3 +49,21 @@ tests = , ("golden_shelleyKESKeys", golden_shelleyKESKeys) , ("golden_shelleyVRFKeys", golden_shelleyVRFKeys) ] + +txTests :: IO Bool +txTests = + H.checkSequential + $ H.Group "TextEnvelope Tx Goldens" + [ ("golden_shelleyTxBody", golden_shelleyTxBody) + , ("golden_shelleyTx", golden_shelleyTx) + ] + +certificateTests :: IO Bool +certificateTests = + H.checkSequential + $ H.Group "TextEnvelope Certificate Goldens" + [ ("golden_shelleyStakeAddressCertificates", golden_shelleyStakeAddressCertificates) + , ("golden_shelleyOperationalCertificate", golden_shelleyOperationalCertificate) + , ("golden_shelleyStakePoolCertificates", golden_shelleyStakePoolCertificates) + , ("golden_shelleyMIRCertificate", golden_shelleyMIRCertificate) + ] diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Tx.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Tx.hs new file mode 100644 index 00000000000..572605394c2 --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Tx.hs @@ -0,0 +1,76 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Tx.Tx + ( golden_shelleyTx + ) where + +import Cardano.Prelude + +import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +import qualified Hedgehog as H + +import Test.OptParse + +-- | 1. Generate a key pair +-- 2. Create tx body +-- 3. Sign tx body +-- 4. Check the TextEnvelope serialization format has not changed. +golden_shelleyTx :: Property +golden_shelleyTx = + propertyOnce $ do + -- Reference keys + let referenceTx = "test/Test/golden/shelley/tx/tx" + + -- Key filepaths + let paymentVerKey = "payment-verification-key-file" + paymentSignKey = "payment-signing-key-file" + transactionFile = "tx-file" + transactionBodyFile = "tx-body-file" + createdFiles = [ paymentVerKey + , paymentSignKey + , transactionBodyFile + , transactionBodyFile + , transactionFile] + + + -- Generate payment signing key to sign transaction + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","address","key-gen" + , "--verification-key-file", paymentVerKey + , "--signing-key-file", paymentSignKey + ] + + -- Create transaction body + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","transaction", "build-raw" + , "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0" + , "--tx-out", "615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c103149804+100000000" + , "--fee", "1000000" + , "--ttl", "500000" + , "--out-file", transactionBodyFile + ] + + -- Sign transaction + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","transaction", "sign" + , "--tx-body-file", transactionBodyFile + , "--signing-key-file", paymentSignKey + , "--mainnet" + , "--out-file", transactionFile + ] + + assertFilesExist createdFiles + + let txType = textEnvelopeType AsShelleyTx + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles txType referenceTx transactionFile + + liftIO $ fileCleanup createdFiles + H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/TxBody.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/TxBody.hs new file mode 100644 index 00000000000..d2befc29346 --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/TxBody.hs @@ -0,0 +1,50 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Tx.TxBody + ( golden_shelleyTxBody + ) where + +import Cardano.Prelude + +import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +import qualified Hedgehog as H + +import Test.OptParse + + +-- | 1. We create a 'TxBody Shelley' file. +-- 2. Check the TextEnvelope serialization format has not changed. +golden_shelleyTxBody :: Property +golden_shelleyTxBody = + propertyOnce $ do + -- Reference keys + let referenceTxBody = "test/Test/golden/shelley/tx/txbody" + + -- Key filepaths + let transactionBodyFile = "transaction-body-file" + createdFiles = [transactionBodyFile] + + + -- Create transaction body + execCardanoCLIParser + createdFiles + $ evalCardanoCLIParser [ "shelley","transaction", "build-raw" + , "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0" + , "--tx-out", "615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c103149804+100000000" + , "--fee", "1000000" + , "--ttl", "500000" + , "--out-file", transactionBodyFile + ] + + assertFilesExist createdFiles + + let txBodyType = textEnvelopeType AsShelleyTxBody + + -- Check the newly created files have not deviated from the + -- golden files + checkTextEnvelopeFormat createdFiles txBodyType referenceTxBody transactionBodyFile + + liftIO $ fileCleanup createdFiles + H.success diff --git a/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Witness.hs b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Witness.hs new file mode 100644 index 00000000000..8e5bc34c5a6 --- /dev/null +++ b/cardano-cli/test/Test/CLI/Shelley/TextEnvelope/Golden/Tx/Witness.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Test.CLI.Shelley.TextEnvelope.Golden.Tx.Witness + ( golden_shelleyWitness + ) where + +import Cardano.Prelude + +--import Cardano.Api.Typed (AsType(..), HasTextEnvelope (..)) + +import Hedgehog (Property) +--import qualified Hedgehog as H + +--import Test.OptParse + +golden_shelleyWitness :: Property +golden_shelleyWitness = panic "TODO" diff --git a/cardano-cli/test/Test/ITN.hs b/cardano-cli/test/Test/ITN.hs index fb2ebaa1cff..02baae95704 100644 --- a/cardano-cli/test/Test/ITN.hs +++ b/cardano-cli/test/Test/ITN.hs @@ -48,7 +48,6 @@ prop_convertITNKeys = -- Generate haskell stake verification key execCardanoCLIParser allFiles - "prop_convertITNKeys.convert_itn_verification_key" $ evalCardanoCLIParser [ "shelley","stake-address","convert-itn-key" , "--itn-verification-key-file", itnVerKeyFp , "--out-file", outputHaskellVerKeyFp @@ -56,7 +55,6 @@ prop_convertITNKeys = -- Generate haskell signing key execCardanoCLIParser allFiles - "prop_convertITNKeys.convert_itn_signing_key" $ evalCardanoCLIParser [ "shelley","stake-address","convert-itn-key" , "--itn-signing-key-file", itnSignKeyFp , "--out-file", outputHaskellSignKeyFp diff --git a/cardano-cli/test/Test/OptParse.hs b/cardano-cli/test/Test/OptParse.hs index 04ffbc70ad3..c157574a235 100644 --- a/cardano-cli/test/Test/OptParse.hs +++ b/cardano-cli/test/Test/OptParse.hs @@ -28,7 +28,7 @@ import Cardano.CLI.Run (ClientCommand(..), import qualified Hedgehog as H import qualified Hedgehog.Internal.Property as H -import Hedgehog.Internal.Property (Diff, MonadTest, failWith, liftTest, mkTest) +import Hedgehog.Internal.Property (Diff, MonadTest, liftTest, mkTest) import Hedgehog.Internal.Show (ValueDiff(ValueSame), mkValue, showPretty, valueDiff) import Hedgehog.Internal.Source (getCaller) @@ -43,12 +43,10 @@ execCardanoCLIParser :: HasCallStack => [FilePath] -- ^ Files to clean up on failure - -> String - -- ^ Name of command, used in error rendering -> Opt.ParserResult ClientCommand -- ^ ParserResult to execute -> H.PropertyT IO () -execCardanoCLIParser fps cmdName pureParseResult = +execCardanoCLIParser fps pureParseResult = case pureParseResult of -- The pure 'ParserResult' succeeds and we can then execute the result. @@ -57,13 +55,13 @@ execCardanoCLIParser fps cmdName pureParseResult = -- The pure `ParserResult` failed and we clean up any created files -- and fail with `optparse-applicative`'s error message - Failure failure -> let (parserHelp, _exitCode, cols) = Opt.execFailure failure cmdName - helpMessage = renderHelp cols parserHelp cmdName + Failure failure -> let (parserHelp, _exitCode, cols) = Opt.execFailure failure "" + helpMessage = renderHelp cols parserHelp "" in liftIO (fileCleanup fps) >> failWithCustom callStack Nothing helpMessage - CompletionInvoked compl -> do msg <- lift $ Opt.execCompletion compl cmdName + CompletionInvoked compl -> do msg <- lift $ Opt.execCompletion compl "" liftIO (fileCleanup fps) >> failWithCustom callStack Nothing msg -- | Executes a `ClientCommand`. If successful the property passes @@ -118,13 +116,13 @@ checkTextEnvelopeFormat fps tve reference created = do -------------------------------------------------------------------------------- -- | Checks if all files gives exists. If this fails, all files are deleted. -assertFilesExist :: [FilePath] -> H.PropertyT IO () +assertFilesExist :: HasCallStack => [FilePath] -> H.PropertyT IO () assertFilesExist [] = return () assertFilesExist allFiles@(file:rest) = do exists <- liftIO $ doesFileExist file if exists == True - then assertFilesExist rest - else liftIO (fileCleanup allFiles) >> failWith Nothing (file <> " has not been successfully created.") + then withFrozenCallStack $ assertFilesExist rest + else liftIO (fileCleanup allFiles) >> failWithCustom callStack Nothing (file <> " has not been successfully created.") fileCleanup :: [FilePath] -> IO () fileCleanup fps = mapM_ (\fp -> removeFile fp `catch` fileExists) fps diff --git a/cardano-cli/test/Test/Pioneers/Exercise1.hs b/cardano-cli/test/Test/Pioneers/Exercise1.hs index 813c8c0a8ad..da9096898b1 100644 --- a/cardano-cli/test/Test/Pioneers/Exercise1.hs +++ b/cardano-cli/test/Test/Pioneers/Exercise1.hs @@ -12,8 +12,8 @@ import qualified Hedgehog as H import Test.OptParse --- | 1. We generate a key pair --- 2. We check for the existence of the key pair +-- | 1. Generate a key pair +-- 2. Check for the existence of the key pair -- 3. We use the generated verification key to build a shelley payment address. prop_buildShelleyPaymentAddress :: Property prop_buildShelleyPaymentAddress = @@ -27,7 +27,6 @@ prop_buildShelleyPaymentAddress = -- Generate payment verification key execCardanoCLIParser allFiles - "prop_buildShelleyPaymentAddress.payment_keypair_gen" $ evalCardanoCLIParser [ "shelley","address","key-gen" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -38,7 +37,6 @@ prop_buildShelleyPaymentAddress = -- Build shelley payment address execCardanoCLIParser allFiles - "prop_buildShelleyPaymentAddress.build_payment_address" $ evalCardanoCLIParser [ "shelley", "address", "build" , "--payment-verification-key-file", verKey , "--mainnet" @@ -51,7 +49,7 @@ prop_buildShelleyPaymentAddress = -- | 1. We generate a key payment pair -- 2. We generate a staking key pair --- 2. We check for the existence of the key pairs +-- 2. Check for the existence of the key pairs -- 3. We use the payment verification key & staking verification key -- to build a shelley stake address. prop_buildShelleyStakeAddress :: Property @@ -68,7 +66,6 @@ prop_buildShelleyStakeAddress = -- Generate payment verification key execCardanoCLIParser allFiles - "prop_buildShelleyStakeAddress.payment_keypair__gen" $ evalCardanoCLIParser [ "shelley","address","key-gen" , "--verification-key-file", paymentVerKey , "--signing-key-file", paymentSignKey @@ -76,7 +73,6 @@ prop_buildShelleyStakeAddress = -- Generate stake verification key execCardanoCLIParser allFiles - "prop_buildShelleyStakeAddress.stake_keypair_gen" $ evalCardanoCLIParser [ "shelley","stake-address","key-gen" , "--verification-key-file", stakeVerKey , "--signing-key-file", stakeSignKey @@ -87,7 +83,6 @@ prop_buildShelleyStakeAddress = -- Build shelley stake address execCardanoCLIParser allFiles - "prop_buildShelleyStakeAddress.build_staking_address" $ evalCardanoCLIParser [ "shelley", "address", "build" , "--payment-verification-key-file", paymentVerKey , "--stake-verification-key-file", stakeVerKey diff --git a/cardano-cli/test/Test/Pioneers/Exercise2.hs b/cardano-cli/test/Test/Pioneers/Exercise2.hs index 822ff0abf61..f283558715c 100644 --- a/cardano-cli/test/Test/Pioneers/Exercise2.hs +++ b/cardano-cli/test/Test/Pioneers/Exercise2.hs @@ -28,7 +28,6 @@ prop_createTransaction = -- Generate payment signing key to sign transaction execCardanoCLIParser allFiles - "prop_createTransaction.payment_keypair__gen" $ evalCardanoCLIParser [ "shelley","address","key-gen" , "--verification-key-file", paymentVerKey , "--signing-key-file", paymentSignKey @@ -39,7 +38,6 @@ prop_createTransaction = -- Create transaction body execCardanoCLIParser allFiles - "prop_createTransaction.create_tx_body" $ evalCardanoCLIParser [ "shelley","transaction", "build-raw" , "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0" , "--tx-out", "615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c103149804+100000000" @@ -53,7 +51,6 @@ prop_createTransaction = -- Sign transaction execCardanoCLIParser allFiles - "prop_createTransaction.sign_tx" $ evalCardanoCLIParser [ "shelley","transaction", "sign" , "--tx-body-file", transactionBodyFile , "--signing-key-file", paymentSignKey diff --git a/cardano-cli/test/Test/Pioneers/Exercise3.hs b/cardano-cli/test/Test/Pioneers/Exercise3.hs index 4386147e776..1532a1010d5 100644 --- a/cardano-cli/test/Test/Pioneers/Exercise3.hs +++ b/cardano-cli/test/Test/Pioneers/Exercise3.hs @@ -30,7 +30,6 @@ prop_createOperationalCertificate = -- Create KES key pair execCardanoCLIParser allFiles - "prop_createOperationalCertificate.KES_keypair_gen" $ evalCardanoCLIParser [ "shelley","node","key-gen-KES" , "--verification-key-file", kesVerKey , "--signing-key-file", kesSignKey @@ -41,7 +40,6 @@ prop_createOperationalCertificate = -- Create cold key pair execCardanoCLIParser allFiles - "prop_createOperationalCertificate.cold_keypair_gen" $ evalCardanoCLIParser [ "shelley","node","key-gen" , "--cold-verification-key-file", coldVerKey , "--cold-signing-key-file", coldSignKey @@ -53,7 +51,6 @@ prop_createOperationalCertificate = -- Create operational certificate execCardanoCLIParser allFiles - "prop_createOperationalCertificate.create_operational_certificate" $ evalCardanoCLIParser [ "shelley","node","issue-op-cert" , "--kes-verification-key-file", kesVerKey , "--cold-signing-key-file", coldSignKey diff --git a/cardano-cli/test/Test/Pioneers/Exercise4.hs b/cardano-cli/test/Test/Pioneers/Exercise4.hs index 247f943a7bb..dd00b09e950 100644 --- a/cardano-cli/test/Test/Pioneers/Exercise4.hs +++ b/cardano-cli/test/Test/Pioneers/Exercise4.hs @@ -26,7 +26,6 @@ prop_createStakeAddressRegistrationCertificate = -- Generate stake verification key execCardanoCLIParser allFiles - "prop_buildShelleyPaymentAddress.stake_keypair_gen" $ evalCardanoCLIParser [ "shelley","stake-address","key-gen" , "--verification-key-file", verKey , "--signing-key-file", signKey @@ -36,7 +35,6 @@ prop_createStakeAddressRegistrationCertificate = -- Create stake address registration certificate execCardanoCLIParser allFiles - "prop_buildShelleyPaymentAddress.stake_address_registration_certificate" $ evalCardanoCLIParser [ "shelley","stake-address","registration-certificate" , "--stake-verification-key-file", verKey , "--out-file", stakeRegCert diff --git a/cardano-cli/test/Test/golden/shelley/certificates/mir_certificate b/cardano-cli/test/Test/golden/shelley/certificates/mir_certificate new file mode 100644 index 00000000000..bb6cd37831b --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/certificates/mir_certificate @@ -0,0 +1,4 @@ +type: Certificate +title: Move Instantaneous Rewards Certificate +cbor-hex: + 82068200a18200581c0427b2124b85b4edbeb729194875238ff93d81a46fe6962fb9b8fdb31903e8 diff --git a/cardano-cli/test/Test/golden/shelley/certificates/operational_certificate b/cardano-cli/test/Test/golden/shelley/certificates/operational_certificate new file mode 100644 index 00000000000..a5b2178b952 --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/certificates/operational_certificate @@ -0,0 +1,7 @@ +type: Node operational certificate +title: +cbor-hex: + 8284582025d0928638949ecc2ca12a1c0b24f22502ef6575483bfee450d6882518ddfbdf001903e8 + 58408d29dd35ac694ba59fd100ef1dc06a23f464063231b44e1f962715a851d694e1e7fdbd3f74bc + 4d6948558ac81642c9e0ab3c1623f36373bf97b491466be48804582072876d433ba4b6b3fcbbf35a + c2aa1316b62a3d25b82abca576263a4415c89086 diff --git a/cardano-cli/test/Test/golden/shelley/certificates/stake_address_deregistration_certificate b/cardano-cli/test/Test/golden/shelley/certificates/stake_address_deregistration_certificate new file mode 100644 index 00000000000..e5b76b4382e --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/certificates/stake_address_deregistration_certificate @@ -0,0 +1,4 @@ +type: Certificate +title: Stake Address Deregistration Certificate +cbor-hex: + 82018200581c95f33ea170445aa3dcf5d11b0c9743c8e3799820353a732707310516 diff --git a/cardano-cli/test/Test/golden/shelley/certificates/stake_address_registration_certificate b/cardano-cli/test/Test/golden/shelley/certificates/stake_address_registration_certificate new file mode 100644 index 00000000000..895799acf5f --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/certificates/stake_address_registration_certificate @@ -0,0 +1,4 @@ +type: Certificate +title: Stake Address Registration Certificate +cbor-hex: + 82008200581c591c90bd047aa2bd89a7586849862794e635890bd18de24d298bb951 diff --git a/cardano-cli/test/Test/golden/shelley/certificates/stake_pool_deregistration_certificate b/cardano-cli/test/Test/golden/shelley/certificates/stake_pool_deregistration_certificate new file mode 100644 index 00000000000..2d910db0fb7 --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/certificates/stake_pool_deregistration_certificate @@ -0,0 +1,4 @@ +type: Certificate +title: Stake Pool Retirement Certificate +cbor-hex: + 8304581c9c9d3afa97839125f7931be9aad8666760c4c1fba11a0253a08fe7a7182a diff --git a/cardano-cli/test/Test/golden/shelley/certificates/stake_pool_registration_certificate b/cardano-cli/test/Test/golden/shelley/certificates/stake_pool_registration_certificate new file mode 100644 index 00000000000..fce3c3cc684 --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/certificates/stake_pool_registration_certificate @@ -0,0 +1,7 @@ +type: Certificate +title: Stake Pool Registration Certificate +cbor-hex: + 8a03581ccbb98e7daf46817e6b3c2bd02196fec981e2a5b3a74f9c4929d1ab9e582042fdf48a12d2 + 421dd83dd57b61d3e06e8a083b78abd0aaf76c2cd031a76fa4611913881903e8d81e82010a581de1 + 310de4b4a8bd5586462e657fbc81e67abbe38e80324ce79d7672171981581c310de4b4a8bd558646 + 2e657fbc81e67abbe38e80324ce79d7672171980f6 diff --git a/cardano-cli/test/Test/golden/shelley/genesis_delegate_keys/operational_certificate_counter b/cardano-cli/test/Test/golden/shelley/keys/genesis_delegate_keys/operational_certificate_counter similarity index 100% rename from cardano-cli/test/Test/golden/shelley/genesis_delegate_keys/operational_certificate_counter rename to cardano-cli/test/Test/golden/shelley/keys/genesis_delegate_keys/operational_certificate_counter diff --git a/cardano-cli/test/Test/golden/shelley/genesis_delegate_keys/signing_key b/cardano-cli/test/Test/golden/shelley/keys/genesis_delegate_keys/signing_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/genesis_delegate_keys/signing_key rename to cardano-cli/test/Test/golden/shelley/keys/genesis_delegate_keys/signing_key diff --git a/cardano-cli/test/Test/golden/shelley/genesis_delegate_keys/verification_key b/cardano-cli/test/Test/golden/shelley/keys/genesis_delegate_keys/verification_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/genesis_delegate_keys/verification_key rename to cardano-cli/test/Test/golden/shelley/keys/genesis_delegate_keys/verification_key diff --git a/cardano-cli/test/Test/golden/shelley/genesis_keys/signing_key b/cardano-cli/test/Test/golden/shelley/keys/genesis_keys/signing_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/genesis_keys/signing_key rename to cardano-cli/test/Test/golden/shelley/keys/genesis_keys/signing_key diff --git a/cardano-cli/test/Test/golden/shelley/genesis_keys/verification_key b/cardano-cli/test/Test/golden/shelley/keys/genesis_keys/verification_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/genesis_keys/verification_key rename to cardano-cli/test/Test/golden/shelley/keys/genesis_keys/verification_key diff --git a/cardano-cli/test/Test/golden/shelley/genesis_utxo_keys/signing_key b/cardano-cli/test/Test/golden/shelley/keys/genesis_utxo_keys/signing_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/genesis_utxo_keys/signing_key rename to cardano-cli/test/Test/golden/shelley/keys/genesis_utxo_keys/signing_key diff --git a/cardano-cli/test/Test/golden/shelley/genesis_utxo_keys/verification_key b/cardano-cli/test/Test/golden/shelley/keys/genesis_utxo_keys/verification_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/genesis_utxo_keys/verification_key rename to cardano-cli/test/Test/golden/shelley/keys/genesis_utxo_keys/verification_key diff --git a/cardano-cli/test/Test/golden/shelley/kes_keys/signing_key b/cardano-cli/test/Test/golden/shelley/keys/kes_keys/signing_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/kes_keys/signing_key rename to cardano-cli/test/Test/golden/shelley/keys/kes_keys/signing_key diff --git a/cardano-cli/test/Test/golden/shelley/kes_keys/verification_key b/cardano-cli/test/Test/golden/shelley/keys/kes_keys/verification_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/kes_keys/verification_key rename to cardano-cli/test/Test/golden/shelley/keys/kes_keys/verification_key diff --git a/cardano-cli/test/Test/golden/shelley/payment_keys/signing_key b/cardano-cli/test/Test/golden/shelley/keys/payment_keys/signing_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/payment_keys/signing_key rename to cardano-cli/test/Test/golden/shelley/keys/payment_keys/signing_key diff --git a/cardano-cli/test/Test/golden/shelley/payment_keys/verification_key b/cardano-cli/test/Test/golden/shelley/keys/payment_keys/verification_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/payment_keys/verification_key rename to cardano-cli/test/Test/golden/shelley/keys/payment_keys/verification_key diff --git a/cardano-cli/test/Test/golden/shelley/stake_keys/signing_key b/cardano-cli/test/Test/golden/shelley/keys/stake_keys/signing_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/stake_keys/signing_key rename to cardano-cli/test/Test/golden/shelley/keys/stake_keys/signing_key diff --git a/cardano-cli/test/Test/golden/shelley/stake_keys/verification_key b/cardano-cli/test/Test/golden/shelley/keys/stake_keys/verification_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/stake_keys/verification_key rename to cardano-cli/test/Test/golden/shelley/keys/stake_keys/verification_key diff --git a/cardano-cli/test/Test/golden/shelley/vrf_keys/signing_key b/cardano-cli/test/Test/golden/shelley/keys/vrf_keys/signing_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/vrf_keys/signing_key rename to cardano-cli/test/Test/golden/shelley/keys/vrf_keys/signing_key diff --git a/cardano-cli/test/Test/golden/shelley/vrf_keys/verification_key b/cardano-cli/test/Test/golden/shelley/keys/vrf_keys/verification_key similarity index 100% rename from cardano-cli/test/Test/golden/shelley/vrf_keys/verification_key rename to cardano-cli/test/Test/golden/shelley/keys/vrf_keys/verification_key diff --git a/cardano-cli/test/Test/golden/shelley/tx/tx b/cardano-cli/test/Test/golden/shelley/tx/tx new file mode 100644 index 00000000000..fc2ec36763e --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/tx/tx @@ -0,0 +1,8 @@ +type: TxSignedShelley +title: +cbor-hex: + 83a4008182582091999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c300 + 018182581d615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c11a05f5e10002 + 1a000f4240031a0007a120a10081825820d1fcefa110532d8d5d80086ecb665d881b5e987adf5916 + 65420aea8a5bdaf2735840e32210c3a835224050626adac48711feb99fac072f9c5d1397aa19bf21 + 46342f01bbdadf010753d4dae50a753f5042f6be00ea27f9087a14d209ea71ae80d404f6 diff --git a/cardano-cli/test/Test/golden/shelley/tx/txbody b/cardano-cli/test/Test/golden/shelley/tx/txbody new file mode 100644 index 00000000000..a8952d417dc --- /dev/null +++ b/cardano-cli/test/Test/golden/shelley/tx/txbody @@ -0,0 +1,6 @@ +type: TxUnsignedShelley +title: +cbor-hex: + a4008182582091999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c30001 + 8182581d615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c11a05f5e100021a + 000f4240031a0007a120 diff --git a/cardano-cli/test/cardano-cli-pioneers.hs b/cardano-cli/test/cardano-cli-pioneers.hs index 1be25bce1ce..d8ccdc44907 100644 --- a/cardano-cli/test/cardano-cli-pioneers.hs +++ b/cardano-cli/test/cardano-cli-pioneers.hs @@ -17,10 +17,14 @@ main = do IO.hSetBuffering IO.stdout LineBuffering IO.hSetBuffering IO.stderr LineBuffering - defaultMain [ Test.CLI.Shelley.TextEnvelope.Golden.Tests.tests + defaultMain [ Test.CLI.Shelley.TextEnvelope.Golden.Tests.keyTests + , Test.CLI.Shelley.TextEnvelope.Golden.Tests.certificateTests + , Test.CLI.Shelley.TextEnvelope.Golden.Tests.txTests + , Test.Pioneers.Exercise1.tests , Test.Pioneers.Exercise2.tests , Test.Pioneers.Exercise3.tests , Test.Pioneers.Exercise4.tests + , Test.ITN.tests ]