From 6cbba9cc31fbe7ec8e6227ccdeaa4a7fe1187c91 Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 22 Aug 2023 00:52:25 +1000 Subject: [PATCH 1/2] Rename PoolIdOutputFormat to IdOutputFormat --- cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs | 6 +++--- cardano-cli/src/Cardano/CLI/Legacy/Commands/Pool.hs | 5 ++++- cardano-cli/src/Cardano/CLI/Legacy/Options.hs | 6 +++++- cardano-cli/src/Cardano/CLI/Legacy/Run/Pool.hs | 6 +++--- cardano-cli/src/Cardano/CLI/Parser.hs | 10 +++++----- cardano-cli/src/Cardano/CLI/Types/Common.hs | 8 ++++---- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index fd0505a115..c8fd454ba0 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -1388,16 +1388,16 @@ pKeyOutputFormat = , Opt.value KeyOutputFormatTextEnvelope ] -pPoolIdOutputFormat :: Parser PoolIdOutputFormat +pPoolIdOutputFormat :: Parser IdOutputFormat pPoolIdOutputFormat = - Opt.option readPoolIdOutputFormat $ mconcat + Opt.option readIdOutputFormat $ mconcat [ Opt.long "output-format" , Opt.metavar "STRING" , Opt.help $ mconcat [ "Optional pool id output format. Accepted output formats are \"hex\" " , "and \"bech32\" (default is \"bech32\")." ] - , Opt.value PoolIdOutputFormatBech32 + , Opt.value IdOutputFormatBech32 ] pMaybeOutputFile :: Parser (Maybe (File content Out)) diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Pool.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Pool.hs index 0c39f5acde..46cfb19720 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Pool.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Pool.hs @@ -47,7 +47,10 @@ data LegacyPoolCmds EpochNo -- ^ Epoch in which to retire the stake pool. (File () Out) - | PoolGetId (VerificationKeyOrFile StakePoolKey) PoolIdOutputFormat (Maybe (File () Out)) + | PoolGetId + (VerificationKeyOrFile StakePoolKey) + IdOutputFormat + (Maybe (File () Out)) | PoolMetadataHash (StakePoolMetadataFile In) (Maybe (File () Out)) deriving Show diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index 1a214b6957..d9c5289706 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -759,7 +759,11 @@ pPoolCmds envCli = ] where pId :: Parser LegacyPoolCmds - pId = PoolGetId <$> pStakePoolVerificationKeyOrFile <*> pPoolIdOutputFormat <*> pMaybeOutputFile + pId = + PoolGetId + <$> pStakePoolVerificationKeyOrFile + <*> pPoolIdOutputFormat + <*> pMaybeOutputFile pPoolMetadataHashSubCmd :: Parser LegacyPoolCmds pPoolMetadataHashSubCmd = PoolMetadataHash <$> pPoolMetadataFile <*> pMaybeOutputFile diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Pool.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Pool.hs index 59913adc59..ce9e4c4f23 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Pool.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Pool.hs @@ -205,7 +205,7 @@ createStakePoolRetirementRequirements sbe pid epoch = runPoolId :: VerificationKeyOrFile StakePoolKey - -> PoolIdOutputFormat + -> IdOutputFormat -> Maybe (File () Out) -> ExceptT ShelleyPoolCmdError IO () runPoolId verKeyOrFile outputFormat mOutFile = do @@ -214,12 +214,12 @@ runPoolId verKeyOrFile outputFormat mOutFile = do $ readVerificationKeyOrFile AsStakePoolKey verKeyOrFile case outputFormat of - PoolIdOutputFormatHex -> + IdOutputFormatHex -> firstExceptT ShelleyPoolCmdWriteFileError . newExceptT $ writeByteStringOutput mOutFile $ serialiseToRawBytesHex (verificationKeyHash stakePoolVerKey) - PoolIdOutputFormatBech32 -> + IdOutputFormatBech32 -> firstExceptT ShelleyPoolCmdWriteFileError . newExceptT $ writeTextOutput mOutFile diff --git a/cardano-cli/src/Cardano/CLI/Parser.hs b/cardano-cli/src/Cardano/CLI/Parser.hs index 834b7e2fde..c54e821cec 100644 --- a/cardano-cli/src/Cardano/CLI/Parser.hs +++ b/cardano-cli/src/Cardano/CLI/Parser.hs @@ -4,7 +4,7 @@ module Cardano.CLI.Parser ( readerFromAttoParser , readFractionAsRational , readKeyOutputFormat - , readPoolIdOutputFormat + , readIdOutputFormat , readRational , readRationalUnitInterval , readStringOfMaxLength @@ -25,12 +25,12 @@ import qualified Data.Text as Text import qualified Data.Text.Encoding as Text import qualified Options.Applicative as Opt -readPoolIdOutputFormat :: Opt.ReadM PoolIdOutputFormat -readPoolIdOutputFormat = do +readIdOutputFormat :: Opt.ReadM IdOutputFormat +readIdOutputFormat = do s <- Opt.str @String case s of - "hex" -> pure PoolIdOutputFormatHex - "bech32" -> pure PoolIdOutputFormatBech32 + "hex" -> pure IdOutputFormatHex + "bech32" -> pure IdOutputFormatBech32 _ -> fail $ mconcat [ "Invalid output format: " <> show s diff --git a/cardano-cli/src/Cardano/CLI/Types/Common.hs b/cardano-cli/src/Cardano/CLI/Types/Common.hs index 08b55b2f2a..c029065bd5 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Common.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Common.hs @@ -36,7 +36,7 @@ module Cardano.CLI.Types.Common , OpCertStartingKesPeriod (..) , Params (..) , ParserFileDirection (..) - , PoolIdOutputFormat (..) + , IdOutputFormat (..) , PrivKeyFile(..) , ProtocolParamsFile(..) , ReferenceScriptAnyEra (..) @@ -227,9 +227,9 @@ instance FromJSON GenesisFile where <> "Encountered: " <> show invalid -- | The desired output format. -data PoolIdOutputFormat - = PoolIdOutputFormatHex - | PoolIdOutputFormatBech32 +data IdOutputFormat + = IdOutputFormatHex + | IdOutputFormatBech32 deriving (Eq, Show) data KeyOutputFormat From 8be1bae420104c8c95f7b82121a19b9734b80011 Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 22 Aug 2023 02:14:50 +1000 Subject: [PATCH 2/2] Implement conway governance drep id command --- .../CLI/EraBased/Commands/Governance/DRep.hs | 18 ++++++--- .../CLI/EraBased/Options/Governance/DRep.hs | 33 +++++++++++++++ .../CLI/EraBased/Run/Governance/DRep.hs | 36 +++++++++++++++-- cardano-cli/src/Cardano/CLI/Types/Common.hs | 4 +- .../Test/Golden/Governance/DRep.hs | 40 +++++++++++++++++-- .../golden/governance/drep/drep.id.bech32 | 1 + .../files/golden/governance/drep/drep.id.hex | 1 + .../cardano-cli-golden/files/golden/help.cli | 20 ++++++++++ .../golden/help/conway_governance_drep.cli | 2 + .../golden/help/conway_governance_drep_id.cli | 18 +++++++++ .../help/experimental_governance_drep.cli | 2 + .../help/experimental_governance_drep_id.cli | 18 +++++++++ .../cardano-cli-golden/files/input/drep.skey | 5 +++ .../cardano-cli-golden/files/input/drep.vkey | 5 +++ 14 files changed, 189 insertions(+), 14 deletions(-) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.bech32 create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.hex create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep_id.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep_id.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/drep.skey create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/drep.vkey diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs index c1761a6882..009eee5a9a 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs @@ -8,6 +8,7 @@ module Cardano.CLI.EraBased.Commands.Governance.DRep import Cardano.Api +import Cardano.CLI.Types.Common import Cardano.CLI.Types.Key import Data.Text (Text) @@ -17,13 +18,18 @@ data GovernanceDRepCmds era StakeIdentifier AnyDelegationTarget (File () Out) - | GovernanceDRepRegistrationCertificateCmd - AnyRegistrationTarget - (File () Out) | GovernanceDRepGenerateKey (ConwayEraOnwards era) (File (VerificationKey ()) Out) (File (SigningKey ()) Out) + | GovernanceDRepIdCmd + (ConwayEraOnwards era) + (VerificationKeyOrFile DRepKey) + IdOutputFormat + (Maybe (File () Out)) + | GovernanceDRepRegistrationCertificateCmd + AnyRegistrationTarget + (File () Out) renderGovernanceDRepCmds :: () => GovernanceDRepCmds era @@ -31,7 +37,9 @@ renderGovernanceDRepCmds :: () renderGovernanceDRepCmds = \case GovernanceDRepDelegationCertificateCmd {} -> "governance drep delegation-certificate" - GovernanceDRepRegistrationCertificateCmd {} -> - "governance drep registration-certificate" GovernanceDRepGenerateKey{} -> "governance drep key-gen" + GovernanceDRepIdCmd {} -> + "governance drep id" + GovernanceDRepRegistrationCertificateCmd {} -> + "governance drep registration-certificate" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs index bc964e3586..46fb9d5209 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs @@ -2,6 +2,8 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} + module Cardano.CLI.EraBased.Options.Governance.DRep ( pGovernanceDRepCmds ) where @@ -11,8 +13,11 @@ import Cardano.Api import Cardano.CLI.Environment import Cardano.CLI.EraBased.Commands.Governance.DRep import Cardano.CLI.EraBased.Options.Common +import Cardano.CLI.Parser +import Cardano.CLI.Types.Common import Cardano.CLI.Types.Key +import Control.Applicative import Data.Foldable import Data.String import Options.Applicative (Parser) @@ -30,6 +35,7 @@ pGovernanceDRepCmds envCli era = ] ) [ pGovernanceDRepKeyGen era + , pGovernanceDRepKeyId era , pEraBasedDelegationCertificateCmd envCli era , pEraBasedRegistrationCertificateCmd envCli era ] @@ -48,6 +54,33 @@ pGovernanceDRepKeyGen era = do ) $ Opt.progDesc "Generate Delegate Representative verification and signing keys." +pGovernanceDRepKeyId :: () + => CardanoEra era + -> Maybe (Parser (GovernanceDRepCmds era)) +pGovernanceDRepKeyId era = do + w <- maybeFeatureInEra era + pure + $ subParser "id" + $ Opt.info + ( GovernanceDRepIdCmd w + <$> pDRepVerificationKeyOrFile + <*> pDRepIdOutputFormat + <*> optional pOutputFile + ) + $ Opt.progDesc "Generate a drep id." + +pDRepIdOutputFormat :: Parser IdOutputFormat +pDRepIdOutputFormat = + Opt.option readIdOutputFormat $ mconcat + [ Opt.long "output-format" + , Opt.metavar "STRING" + , Opt.help $ mconcat + [ "Optional drep id output format. Accepted output formats are \"hex\" " + , "and \"bech32\" (default is \"bech32\")." + ] + , Opt.value IdOutputFormatBech32 + ] + -- Registration Certificate related pEraBasedRegistrationCertificateCmd :: () diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs index 067ca10c81..69f783e024 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -5,6 +5,8 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} +{- HLINT ignore "Use let" -} + module Cardano.CLI.EraBased.Run.Governance.DRep ( runGovernanceDRepCmds ) where @@ -16,13 +18,16 @@ import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.Governance.DRep import Cardano.CLI.EraBased.Run.Governance import Cardano.CLI.Read +import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.CmdError +import Cardano.CLI.Types.Errors.GovernanceCmdError import Cardano.CLI.Types.Key import Control.Monad.Trans.Class import Control.Monad.Trans.Except import Control.Monad.Trans.Except.Extra import Data.Function +import qualified Data.Text.Encoding as Text runGovernanceDRepCmds :: () => GovernanceDRepCmds era @@ -32,14 +37,18 @@ runGovernanceDRepCmds = \case runGovernanceDelegationCertificateCmd stakeIdentifier delegationTarget outFp & firstExceptT CmdEraDelegationError - GovernanceDRepRegistrationCertificateCmd regTarget outFp -> - runGovernanceRegistrationCertificateCmd regTarget outFp - & firstExceptT CmdEraBasedRegistrationError - GovernanceDRepGenerateKey w vrf sgn -> runGovernanceDRepKeyGen w vrf sgn & firstExceptT CmdGovernanceCmdError + GovernanceDRepIdCmd w vkey idOutputFormat mOutFp -> + runGovernanceDRepIdCmd w vkey idOutputFormat mOutFp + & firstExceptT CmdGovernanceCmdError + + GovernanceDRepRegistrationCertificateCmd regTarget outFp -> + runGovernanceRegistrationCertificateCmd regTarget outFp + & firstExceptT CmdEraBasedRegistrationError + runGovernanceDelegationCertificateCmd :: StakeIdentifier -> AnyDelegationTarget @@ -114,6 +123,25 @@ toLedgerDelegatee t = error "TODO: Conway era - DRepScriptHash not exposed by ledger yet" -- right $ Ledger.DelegVote $ Ledger.DRepScriptHash scriptHash +runGovernanceDRepIdCmd :: () + => ConwayEraOnwards era + -> VerificationKeyOrFile DRepKey + -> IdOutputFormat + -> Maybe (File () Out) + -> ExceptT GovernanceCmdError IO () +runGovernanceDRepIdCmd _ vkOrFp idOutputFormat mOutFile = do + drepVerKey <- + lift (readVerificationKeyOrTextEnvFile AsDRepKey vkOrFp) + & onLeft (left . ReadFileError) + + content <- + pure $ case idOutputFormat of + IdOutputFormatHex -> serialiseToRawBytesHex $ verificationKeyHash drepVerKey + IdOutputFormatBech32 -> Text.encodeUtf8 $ serialiseToBech32 $ verificationKeyHash drepVerKey + + lift (writeByteStringOutput mOutFile content) + & onLeft (left . WriteFileError) + -------------------------------------------------------------------------------- -- Registration Certificate related diff --git a/cardano-cli/src/Cardano/CLI/Types/Common.hs b/cardano-cli/src/Cardano/CLI/Types/Common.hs index c029065bd5..9c55dd7026 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Common.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Common.hs @@ -226,7 +226,9 @@ instance FromJSON GenesisFile where parseJSON invalid = error $ "Parsing of GenesisFile failed due to type mismatch. " <> "Encountered: " <> show invalid --- | The desired output format. +-- | Some entities such as stake pools and dreps have a notion of an ID and that id can be +-- encoded as either a bech32 or hex string. This type is used to specify which encoding +-- to use. data IdOutputFormat = IdOutputFormatHex | IdOutputFormatBech32 diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/DRep.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/DRep.hs index 6d9929ce52..6e0208356b 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/DRep.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/DRep.hs @@ -4,17 +4,18 @@ module Test.Golden.Governance.DRep where import Control.Monad (void) -import Test.Cardano.CLI.Util +import Test.Cardano.CLI.Util (execCardanoCLI, noteInputFile, propertyOnce) -import Hedgehog (Property) +import Hedgehog import qualified Hedgehog.Extras.Test.Base as H import qualified Hedgehog.Extras.Test.File as H +import qualified Hedgehog.Extras.Test.Golden as H hprop_golden_governanceDRepKeyGen :: Property hprop_golden_governanceDRepKeyGen = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - verificationKeyFile <- noteTempFile tempDir "key-gen.vkey" - signingKeyFile <- noteTempFile tempDir "key-gen.skey" + verificationKeyFile <- H.noteTempFile tempDir "key-gen.vkey" + signingKeyFile <- H.noteTempFile tempDir "key-gen.skey" void $ execCardanoCLI [ "conway", "governance", "drep", "key-gen" @@ -28,3 +29,34 @@ hprop_golden_governanceDRepKeyGen = H.assertFileOccurences 1 "Delegate Representative Verification Key" verificationKeyFile H.assertFileOccurences 1 "Delegate Representative Signing Key" signingKeyFile +hprop_golden_governance_drep_id_bech32 :: Property +hprop_golden_governance_drep_id_bech32 = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + vkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/drep.vkey" + idFile <- H.noteTempFile tempDir "drep.id.bech32" + idGold <- H.note "test/cardano-cli-golden/files/golden/governance/drep/drep.id.bech32" + + void $ execCardanoCLI + [ "conway", "governance", "drep", "id" + , "--drep-verification-key-file", vkeyFile + , "--output-format", "bech32" + , "--out-file", idFile + ] + + H.diffFileVsGoldenFile idFile idGold + +hprop_golden_governance_drep_id_hex :: Property +hprop_golden_governance_drep_id_hex = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + vkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/drep.vkey" + idFile <- H.noteTempFile tempDir "drep.id.hex" + idGold <- H.note "test/cardano-cli-golden/files/golden/governance/drep/drep.id.hex" + + void $ execCardanoCLI + [ "conway", "governance", "drep", "id" + , "--drep-verification-key-file", vkeyFile + , "--output-format", "hex" + , "--out-file", idFile + ] + + H.diffFileVsGoldenFile idFile idGold diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.bech32 b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.bech32 new file mode 100644 index 0000000000..524c084e68 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.bech32 @@ -0,0 +1 @@ +drep1avya24t2308yyyr5uw2dqtreemvkwst90dx00j5fj5556meyztm \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.hex b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.hex new file mode 100644 index 0000000000..c407dd0ee8 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep.id.hex @@ -0,0 +1 @@ +eb09d5556a8bce421074e394d02c79ced96741657b4cf7ca8995294d \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 1f295c7021..c19a0c6245 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -862,6 +862,7 @@ Usage: cardano-cli conway governance committee create-cold-key-resignation-certi Usage: cardano-cli conway governance drep ( key-gen + | id | delegation-certificate | registration-certificate ) @@ -873,6 +874,15 @@ Usage: cardano-cli conway governance drep key-gen --verification-key-file FILE Generate Delegate Representative verification and signing keys. +Usage: cardano-cli conway governance drep id + ( --drep-verification-key STRING + | --drep-verification-key-file FILE + ) + [--output-format STRING] + [--out-file FILE] + + Generate a drep id. + Usage: cardano-cli conway governance drep delegation-certificate ( --stake-verification-key STRING | --stake-verification-key-file FILE @@ -1274,6 +1284,7 @@ Usage: cardano-cli experimental governance committee create-cold-key-resignation Usage: cardano-cli experimental governance drep ( key-gen + | id | delegation-certificate | registration-certificate ) @@ -1285,6 +1296,15 @@ Usage: cardano-cli experimental governance drep key-gen --verification-key-file Generate Delegate Representative verification and signing keys. +Usage: cardano-cli experimental governance drep id + ( --drep-verification-key STRING + | --drep-verification-key-file FILE + ) + [--output-format STRING] + [--out-file FILE] + + Generate a drep id. + Usage: cardano-cli experimental governance drep delegation-certificate ( --stake-verification-key STRING | --stake-verification-key-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep.cli index fae77d986f..e0f1b59fc3 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep.cli @@ -1,5 +1,6 @@ Usage: cardano-cli conway governance drep ( key-gen + | id | delegation-certificate | registration-certificate ) @@ -12,5 +13,6 @@ Available options: Available commands: key-gen Generate Delegate Representative verification and signing keys. + id Generate a drep id. delegation-certificate Delegation certificate creation. registration-certificate Create a registration certificate. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep_id.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep_id.cli new file mode 100644 index 0000000000..4ececd3eda --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_drep_id.cli @@ -0,0 +1,18 @@ +Usage: cardano-cli conway governance drep id + ( --drep-verification-key STRING + | --drep-verification-key-file FILE + ) + [--output-format STRING] + [--out-file FILE] + + Generate a drep id. + +Available options: + --drep-verification-key STRING + DRep verification key (Bech32 or hex-encoded). + --drep-verification-key-file FILE + Filepath of the DRep verification key. + --output-format STRING Optional drep id output format. Accepted output + formats are "hex" and "bech32" (default is "bech32"). + --out-file FILE The output file. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep.cli index 64518a6596..a7bef716ea 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep.cli @@ -1,5 +1,6 @@ Usage: cardano-cli experimental governance drep ( key-gen + | id | delegation-certificate | registration-certificate ) @@ -12,5 +13,6 @@ Available options: Available commands: key-gen Generate Delegate Representative verification and signing keys. + id Generate a drep id. delegation-certificate Delegation certificate creation. registration-certificate Create a registration certificate. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep_id.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep_id.cli new file mode 100644 index 0000000000..7581acbc19 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_drep_id.cli @@ -0,0 +1,18 @@ +Usage: cardano-cli experimental governance drep id + ( --drep-verification-key STRING + | --drep-verification-key-file FILE + ) + [--output-format STRING] + [--out-file FILE] + + Generate a drep id. + +Available options: + --drep-verification-key STRING + DRep verification key (Bech32 or hex-encoded). + --drep-verification-key-file FILE + Filepath of the DRep verification key. + --output-format STRING Optional drep id output format. Accepted output + formats are "hex" and "bech32" (default is "bech32"). + --out-file FILE The output file. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/input/drep.skey b/cardano-cli/test/cardano-cli-golden/files/input/drep.skey new file mode 100644 index 0000000000..2bffd0436e --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/drep.skey @@ -0,0 +1,5 @@ +{ + "type": "DRepSigningKey_ed25519", + "description": "Delegate Representative Signing Key", + "cborHex": "58201872d334e12a3a062dbdc4f2a22dc77f6e88ba8ecb39d0a2e385375f15ba0005" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/drep.vkey b/cardano-cli/test/cardano-cli-golden/files/input/drep.vkey new file mode 100644 index 0000000000..5c85835812 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/drep.vkey @@ -0,0 +1,5 @@ +{ + "type": "DRepVerificationKey_ed25519", + "description": "Delegate Representative Verification Key", + "cborHex": "58209eb6ff2ee38b24c4892a6b291ed245afa0d2fac76222e76ee3e205e3c9681540" +}