Skip to content

Commit

Permalink
Rename ccm command group to cc
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed May 25, 2023
1 parent a1c9dac commit 0973434
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 107 deletions.
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Expand Up @@ -84,7 +84,7 @@ library
Cardano.CLI.Shelley.Run.Address.Info
Cardano.CLI.Shelley.Run.Genesis
Cardano.CLI.Shelley.Run.Governance
Cardano.CLI.Shelley.Run.Governance.Ccm
Cardano.CLI.Shelley.Run.Governance.Cc
Cardano.CLI.Shelley.Run.Key
Cardano.CLI.Shelley.Run.Node
Cardano.CLI.Shelley.Run.Pool
Expand Down
19 changes: 9 additions & 10 deletions cardano-cli/src/Cardano/CLI/Shelley/Commands.hs
@@ -1,14 +1,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE UndecidableInstances #-}

-- | Shelley CLI command types
module Cardano.CLI.Shelley.Commands
( -- * CLI command types
ShelleyCommand (..)
, AddressCmd (..)
, CcmCmd (..)
, CcCmd (..)
, StakeAddressCmd (..)
, KeyCmd (..)
, TransactionCmd (..)
Expand Down Expand Up @@ -287,22 +286,22 @@ renderTransactionCmd cmd =
TxGetTxId {} -> "transaction txid"
TxView {} -> "transaction view"

data CcmCmd
= CcmKeyGenCold
data CcCmd
= CcKeyGenCold
(VerificationKeyFile Out)
(SigningKeyFile Out)
(OpCertCounterFile Out)
| CcmKeyGenVRF
| CcKeyGenVRF
(VerificationKeyFile Out)
(SigningKeyFile Out)
| CcmKeyHashVRF
| CcKeyHashVRF
(VerificationKeyOrFile VrfKey)
(Maybe (File () Out))
| CcmNewCounter
| CcNewCounter
ColdVerificationKeyOrFile
Word
(OpCertCounterFile InOut)
| CcmIssueOpCert
| CcIssueOpCert
(VerificationKeyOrFile KesKey)
(SigningKeyFile In)
(OpCertCounterFile InOut)
Expand Down Expand Up @@ -493,7 +492,7 @@ data GovernanceCmd
[Lovelace]
(File () Out)
| GovernanceMIRTransfer Lovelace (File () Out) TransferDirection
| GovernanceCcmCmd CcmCmd
| GovernanceCcCmd CcCmd
| GovernanceGenesisKeyDelegationCertificate
(VerificationKeyOrHashOrFile GenesisKey)
(VerificationKeyOrHashOrFile GenesisDelegateKey)
Expand Down Expand Up @@ -527,7 +526,7 @@ renderGovernanceCmd cmd =
GovernanceMIRPayStakeAddressesCertificate {} -> "governance create-mir-certificate stake-addresses"
GovernanceMIRTransfer _ _ TransferToTreasury -> "governance create-mir-certificate transfer-to-treasury"
GovernanceMIRTransfer _ _ TransferToReserves -> "governance create-mir-certificate transfer-to-reserves"
GovernanceCcmCmd {} -> "governance ccm"
GovernanceCcCmd {} -> "governance ccm"
GovernanceActionCmd {} -> "governance action"
GovernanceVoteCmd {} -> "governance vote"
GovernanceUpdateProposal {} -> "governance create-update-proposal"
Expand Down
38 changes: 19 additions & 19 deletions cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
Expand Up @@ -838,8 +838,8 @@ pTransaction envCli =
pTransactionView = TxView <$> pInputTxOrTxBodyFile


pGovernanceCcmCmd :: Parser CcmCmd
pGovernanceCcmCmd =
pGovernanceCcCmd :: Parser CcCmd
pGovernanceCcCmd =
asum
[ subParser "key-gen" . Opt.info pKeyGenOperator . Opt.progDesc $ mconcat
[ "Create a key pair for a CCM's offline "
Expand All @@ -859,28 +859,28 @@ pGovernanceCcmCmd =
]
]
where
pKeyGenOperator :: Parser CcmCmd
pKeyGenOperator :: Parser CcCmd
pKeyGenOperator =
CcmKeyGenCold
CcKeyGenCold
<$> pColdVerificationKeyFile
<*> pColdSigningKeyFile
<*> pOperatorCertIssueCounterFile

pKeyGenVRF :: Parser CcmCmd
pKeyGenVRF :: Parser CcCmd
pKeyGenVRF =
CcmKeyGenVRF
CcKeyGenVRF
<$> pVerificationKeyFileOut
<*> pSigningKeyFileOut

pKeyHashVRF :: Parser CcmCmd
pKeyHashVRF :: Parser CcCmd
pKeyHashVRF =
CcmKeyHashVRF
CcKeyHashVRF
<$> pVerificationKeyOrFile AsVrfKey
<*> pMaybeOutputFile

pNewCounter :: Parser CcmCmd
pNewCounter :: Parser CcCmd
pNewCounter =
CcmNewCounter
CcNewCounter
<$> pColdVerificationKeyOrFile
<*> pCounterValue
<*> pOperatorCertIssueCounterFile
Expand All @@ -893,9 +893,9 @@ pGovernanceCcmCmd =
, Opt.help "The next certificate issue counter value to use."
]

pIssueOpCert :: Parser CcmCmd
pIssueOpCert :: Parser CcCmd
pIssueOpCert =
CcmIssueOpCert
CcIssueOpCert
<$> pKesVerificationKeyOrFile
<*> pColdSigningKeyFile
<*> pOperatorCertIssueCounterFile
Expand Down Expand Up @@ -1309,9 +1309,9 @@ pGovernanceCmd envCli =
, subParser "action"
$ Opt.info pActionCmd
$ Opt.progDesc "Commands related to governance actions"
, subParser "ccm"
$ Opt.info pCcmCmd
$ Opt.progDesc "CCM operation commands"
, subParser "cc"
$ Opt.info pCcCmd
$ Opt.progDesc "Constitutional Committee operation commands"
, subParser "vote"
$ Opt.info pVoteCmd
$ Opt.progDesc "Commands related to governance votes"
Expand Down Expand Up @@ -1386,10 +1386,10 @@ pGovernanceCmd envCli =
pVoteCmd :: Parser GovernanceCmd
pVoteCmd = GovernanceVoteCmd <$> pGovernanceVoteCmd

pCcmCmd :: Parser GovernanceCmd
pCcmCmd =
GovernanceCcmCmd
<$> pGovernanceCcmCmd
pCcCmd :: Parser GovernanceCmd
pCcCmd =
GovernanceCcCmd
<$> pGovernanceCcCmd

pUpdateProposal :: Parser GovernanceCmd
pUpdateProposal = GovernanceUpdateProposal
Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Governance.hs
Expand Up @@ -16,7 +16,7 @@ import Cardano.Binary (DecoderError)
import Cardano.CLI.Shelley.Key (StakeVerifier, VerificationKeyOrHashOrFile,
readVerificationKeyOrHashOrFile, readVerificationKeyOrHashOrTextEnvFile)
import Cardano.CLI.Shelley.Parsers
import Cardano.CLI.Shelley.Run.Governance.Ccm
import Cardano.CLI.Shelley.Run.Governance.Cc
import Cardano.CLI.Shelley.Run.Read (CddlError, fileOrPipe, readFileTx)
import Cardano.CLI.Types
import qualified Cardano.Ledger.Shelley.TxBody as Shelley
Expand Down Expand Up @@ -66,7 +66,7 @@ data ShelleyGovernanceCmdError
| ShelleyGovernanceCmdDecoderError !DecoderError
| ShelleyGovernanceCmdVerifyPollError !GovernancePollError
| ShelleyGovernanceCmdWriteFileError !(FileError ())
| ShelleyGovernanceCcmCmdError !ShelleyGovernanceCcmCmdError
| ShelleyGovernanceCcCmdError !ShelleyGovernanceCcCmdError
deriving Show

renderShelleyGovernanceError :: ShelleyGovernanceCmdError -> Text
Expand Down Expand Up @@ -102,7 +102,7 @@ renderShelleyGovernanceError err =
ShelleyGovernanceCmdVerifyPollError pollError ->
renderGovernancePollError pollError
ShelleyGovernanceCmdWriteFileError fileErr -> Text.pack (displayError fileErr)
ShelleyGovernanceCcmCmdError e -> renderShelleyGovernanceCcmCmdError e
ShelleyGovernanceCcCmdError e -> renderShelleyGovernanceCcCmdError e

runGovernanceActionCmd :: GovernanceActionCmd -> ExceptT ShelleyGovernanceCmdError IO ()
runGovernanceActionCmd = \case
Expand Down Expand Up @@ -133,7 +133,7 @@ runGovernanceCmd = \case
GovernanceGenesisKeyDelegationCertificate genVk genDelegVk vrfVk out ->
runGovernanceGenesisKeyDelegationCertificate genVk genDelegVk vrfVk out
GovernanceActionCmd cmd -> runGovernanceActionCmd cmd
GovernanceCcmCmd cmd -> firstExceptT ShelleyGovernanceCcmCmdError $ runGovernanceCcmCmd cmd
GovernanceCcCmd cmd -> firstExceptT ShelleyGovernanceCcCmdError $ runGovernanceCcCmd cmd
GovernanceVoteCmd cmd -> runGovernanceVoteCmd cmd
GovernanceUpdateProposal out eNo genVKeys ppUp mCostModelFp ->
runGovernanceUpdateProposal out eNo genVKeys ppUp mCostModelFp
Expand Down

0 comments on commit 0973434

Please sign in to comment.