From 2bd678bb958cc9b0242a26b7bc70e43a1f11faba Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 22 Aug 2023 09:22:40 -0400 Subject: [PATCH 1/6] Bump CHaP index - bumps to cardano-api 8.16, cardano-ledger-conway-1.7.0.0, ouroboros-consensus-cardano-0.8.0.1 --- cabal.project | 3 ++- cardano-cli/cardano-cli.cabal | 12 ++++++------ flake.lock | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cabal.project b/cabal.project index c807b7d072..add2d23a0c 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2023-08-08T19:56:09Z - , cardano-haskell-packages 2023-08-15T15:38:21Z + , cardano-haskell-packages 2023-08-23T09:29:34Z packages: cardano-cli @@ -43,3 +43,4 @@ write-ghc-environment-files: always -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. + diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index ae8981178c..009e7bf091 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -167,10 +167,10 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.14 + , cardano-api ^>= 8.16 , cardano-binary , cardano-crypto - , cardano-crypto-class >= 2.1.1 + , cardano-crypto-class ^>= 2.1.2 , cardano-crypto-wrapper ^>= 1.5 , cardano-data >= 1.0 , cardano-git-rev @@ -200,7 +200,7 @@ library , network , optparse-applicative-fork , ouroboros-consensus >= 0.9 - , ouroboros-consensus-cardano >= 0.7 + , ouroboros-consensus-cardano >= 0.8 , ouroboros-consensus-protocol >= 0.5.0.4 , ouroboros-network-api , ouroboros-network-protocols @@ -226,7 +226,7 @@ executable cardano-cli ghc-options: -threaded -rtsopts "-with-rtsopts=-T" build-depends: cardano-cli - , cardano-crypto-class ^>= 2.1 + , cardano-crypto-class ^>= 2.1.2 , optparse-applicative-fork , transformers-except @@ -258,7 +258,7 @@ test-suite cardano-cli-test , base16-bytestring , bech32 >= 1.1.0 , bytestring - , cardano-api:{cardano-api, internal} ^>= 8.14 + , cardano-api:{cardano-api, internal} ^>= 8.16 , cardano-api-gen ^>= 8.1.1.0 , cardano-cli , cardano-cli:cardano-cli-test-lib @@ -302,7 +302,7 @@ test-suite cardano-cli-golden build-depends: aeson >= 1.5.6.0 , base16-bytestring , bytestring - , cardano-api:{cardano-api, gen} ^>= 8.14 + , cardano-api:{cardano-api, gen} ^>= 8.16 , cardano-binary , cardano-cli , cardano-cli:cardano-cli-test-lib diff --git a/flake.lock b/flake.lock index 142d7c8c36..ca9d8e44ad 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1692114433, - "narHash": "sha256-l6UoBkt1SUUBga/u0qpQeuNTN2YgtdZMBJSw29Wb0xU=", + "lastModified": 1692802304, + "narHash": "sha256-t7RHKNanpG+4ciyvBf199zzuGFQZJeJvEUsAZpW7Qso=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "73093fde5e26b9f7594a2219d339175005256475", + "rev": "c4e89b49573d19f483b224717c3b395ee2aefdf8", "type": "github" }, "original": { From 10ba58ded6eab3737a1053e28db37420435bae55 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 22 Aug 2023 09:36:10 -0400 Subject: [PATCH 2/6] EraBasedNewCommittee: Update fields with Network, Lovelace deposit, proposal anchor and maybe previous governance action id relating to the last new committee proposal.EraBasedNewConstitution EraBasedNewConstitution: Update fields with the same as above EraBasedNoConfidence: Update fields with the same as above with the exception of maybe previous governance action id EraBasedTreasuryWithdrawal: Update fields with the same as EraBasedNoConfidence Propagate these changes throughout the cli adding parsers as necessary Update vote creation to create a voting entry --- .../src/Cardano/CLI/Commands/Governance.hs | 79 ++++++++++++----- .../EraBased/Commands/Governance/Actions.hs | 22 +++-- .../CLI/EraBased/Commands/Governance/Vote.hs | 4 +- .../Cardano/CLI/EraBased/Options/Common.hs | 64 ++++++++++---- .../EraBased/Options/Governance/Actions.hs | 42 ++++----- .../CLI/EraBased/Options/Governance/Vote.hs | 8 +- .../CLI/EraBased/Run/Governance/Actions.hs | 86 ++++++++++++++----- .../CLI/EraBased/Run/Governance/Vote.hs | 60 +++++++------ .../Cardano/CLI/Legacy/Commands/Governance.hs | 20 ++++- .../src/Cardano/CLI/Legacy/Run/Governance.hs | 4 +- cardano-cli/src/Cardano/CLI/Read.hs | 7 ++ cardano-cli/src/Cardano/CLI/Types/Common.hs | 8 +- .../Types/Errors/GovernanceVoteCmdError.hs | 4 +- .../src/Cardano/CLI/Types/Governance.hs | 16 +++- .../Test/Golden/ErrorsSpec.hs | 4 +- 15 files changed, 292 insertions(+), 136 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Commands/Governance.hs b/cardano-cli/src/Cardano/CLI/Commands/Governance.hs index cbea5033a6..d36d9ac1a3 100644 --- a/cardano-cli/src/Cardano/CLI/Commands/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Commands/Governance.hs @@ -4,6 +4,7 @@ module Cardano.CLI.Commands.Governance where import Cardano.Api +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import Cardano.CLI.Types.Common @@ -16,17 +17,19 @@ import Control.Monad.Trans.Except (ExceptT) import Control.Monad.Trans.Except.Extra (firstExceptT, hoistEither, newExceptT) import Data.Bifunctor import qualified Data.ByteString as BS +import Data.Text (Text) import qualified Data.Text.Encoding as Text +import Data.Word runGovernanceCreateVoteCmd :: AnyShelleyBasedEra -> Vote -> VType - -> TxIn + -> (TxId, Word32) -> VerificationKeyOrFile StakePoolKey -> VoteFile Out -> ExceptT GovernanceCmdError IO () -runGovernanceCreateVoteCmd anyEra vChoice vType govActionTxIn votingStakeCred oFp = do +runGovernanceCreateVoteCmd anyEra vChoice vType (govActionTxId, govActionIndex) votingStakeCred oFp = do AnyShelleyBasedEra sbe <- pure anyEra vStakePoolKey <- firstExceptT ReadFileError . newExceptT $ readVerificationKeyOrFile AsStakePoolKey votingStakeCred let stakePoolKeyHash = verificationKeyHash vStakePoolKey @@ -34,56 +37,88 @@ runGovernanceCreateVoteCmd anyEra vChoice vType govActionTxIn votingStakeCred oF case vType of VCC -> do votingCred <- hoistEither $ first VotingCredentialDecodeGovCmdEror $ toVotingCredential sbe vStakeCred - let govActIdentifier = makeGoveranceActionId sbe govActionTxIn - voteProcedure = createVotingProcedure sbe vChoice (VoterCommittee votingCred) govActIdentifier - firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing voteProcedure + let voter = VoterCommittee votingCred + govActIdentifier = shelleyBasedEraConstraints sbe $ createGovernanceActionId govActionTxId govActionIndex + voteProcedure = createVotingProcedure sbe vChoice Nothing + votingEntry = VotingEntry { votingEntryVoter = voter + , votingEntryGovActionId = GovernanceActionId govActIdentifier + , votingEntryVotingProcedure = voteProcedure + } + firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing votingEntry VDR -> do votingCred <- hoistEither $ first VotingCredentialDecodeGovCmdEror $ toVotingCredential sbe vStakeCred - let govActIdentifier = makeGoveranceActionId sbe govActionTxIn - voteProcedure = createVotingProcedure sbe vChoice (VoterDRep votingCred) govActIdentifier - firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing voteProcedure + let voter = VoterDRep votingCred + govActIdentifier = shelleyBasedEraConstraints sbe $ createGovernanceActionId govActionTxId govActionIndex + voteProcedure = createVotingProcedure sbe vChoice Nothing + votingEntry = VotingEntry { votingEntryVoter = voter + , votingEntryGovActionId = GovernanceActionId govActIdentifier + , votingEntryVotingProcedure = voteProcedure + } + firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing votingEntry VSP -> do - let govActIdentifier = makeGoveranceActionId sbe govActionTxIn - voteProcedure = createVotingProcedure sbe vChoice (VoterSpo stakePoolKeyHash) govActIdentifier - firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing voteProcedure + let voter = VoterSpo stakePoolKeyHash + govActIdentifier = shelleyBasedEraConstraints sbe $ createGovernanceActionId govActionTxId govActionIndex + voteProcedure = createVotingProcedure sbe vChoice Nothing + votingEntry = VotingEntry { votingEntryVoter = voter + , votingEntryGovActionId = GovernanceActionId govActIdentifier + , votingEntryVotingProcedure = voteProcedure + } + firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing votingEntry runGovernanceNewConstitutionCmd - :: AnyShelleyBasedEra + :: Ledger.Network + -> AnyShelleyBasedEra -> Lovelace -> VerificationKeyOrFile StakePoolKey + -> Maybe (TxId, Word32) + -> (Ledger.Url, Text) -> Constitution -> NewConstitutionFile Out -> ExceptT GovernanceCmdError IO () -runGovernanceNewConstitutionCmd sbe deposit stakeVoteCred constitution oFp = do +runGovernanceNewConstitutionCmd network sbe deposit stakeVoteCred mPrevGovAct propAnchor constitution oFp = do vStakePoolKeyHash <- fmap (verificationKeyHash . castVerificationKey) <$> firstExceptT ReadFileError . newExceptT $ readVerificationKeyOrFile AsStakePoolKey stakeVoteCred case constitution of - ConstitutionFromFile fp -> do + ConstitutionFromFile url fp -> do cBs <- liftIO $ BS.readFile $ unFile fp _utf8EncodedText <- firstExceptT NonUtf8EncodedConstitution . hoistEither $ Text.decodeUtf8' cBs - let govAct = ProposeNewConstitution cBs - runGovernanceCreateActionCmd sbe deposit vStakePoolKeyHash govAct oFp + let prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovAct + govAct = ProposeNewConstitution + prevGovActId + (createAnchor url cBs) -- TODO: Conway era - this is wrong, create `AnchorData` then hash that with hashAnchorData + runGovernanceCreateActionCmd network sbe deposit vStakePoolKeyHash propAnchor govAct oFp - ConstitutionFromText c -> do + ConstitutionFromText url c -> do let constitBs = Text.encodeUtf8 c - govAct = ProposeNewConstitution constitBs - runGovernanceCreateActionCmd sbe deposit vStakePoolKeyHash govAct oFp + prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovAct + govAct = ProposeNewConstitution + prevGovActId + (createAnchor url constitBs) + runGovernanceCreateActionCmd network sbe deposit vStakePoolKeyHash propAnchor govAct oFp runGovernanceCreateActionCmd - :: AnyShelleyBasedEra + :: Ledger.Network + -> AnyShelleyBasedEra -> Lovelace -> Hash StakeKey + -> (Ledger.Url, Text) -> GovernanceAction -> File a Out -> ExceptT GovernanceCmdError IO () -runGovernanceCreateActionCmd anyEra deposit depositReturnAddr govAction oFp = do +runGovernanceCreateActionCmd network anyEra deposit depositReturnAddr propAnchor govAction oFp = do AnyShelleyBasedEra sbe <- pure anyEra - let proposal = createProposalProcedure sbe deposit depositReturnAddr govAction + let proposal = createProposalProcedure + sbe + network + deposit + depositReturnAddr + govAction + (uncurry createAnchor (fmap Text.encodeUtf8 propAnchor)) firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs index 4ed149d71b..71d22e2d1c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -14,9 +14,10 @@ module Cardano.CLI.EraBased.Commands.Governance.Actions ) where import Cardano.Api +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley -import Cardano.CLI.Types.Common +import Cardano.CLI.Types.Common (Constitution, VerificationKeyFile) import Cardano.CLI.Types.Key import Data.Text (Text) @@ -49,27 +50,34 @@ data GovernanceActionCmds era data EraBasedNewCommittee = EraBasedNewCommittee - { ebDeposit :: Lovelace + { ebNetwork :: Ledger.Network + , ebDeposit :: Lovelace , ebReturnAddress :: AnyStakeIdentifier + , ebPropAnchor :: (Ledger.Url, Text) , ebOldCommittee :: [AnyStakeIdentifier] , ebNewCommittee :: [(AnyStakeIdentifier, EpochNo)] , ebRequiredQuorum :: Rational - , ebPreviousGovActionId :: TxIn + , ebPreviousGovActionId :: Maybe (TxId, Word32) , ebFilePath :: File () Out } deriving Show data EraBasedNewConstitution = EraBasedNewConstitution - { encDeposit :: Lovelace + { encNetwork :: Ledger.Network + , encDeposit :: Lovelace , encStakeCredential :: AnyStakeIdentifier + , encPrevGovActId :: Maybe (TxId, Word32) + , encPropAnchor :: (Ledger.Url, Text) , encConstitution :: Constitution , encFilePath :: File () Out } deriving Show data EraBasedNoConfidence = EraBasedNoConfidence - { ncDeposit :: Lovelace + { ncNetwork :: Ledger.Network + , ncDeposit :: Lovelace , ncStakeCredential :: AnyStakeIdentifier + , ncProposalAnchor :: (Ledger.Url, Text) , ncGovAct :: TxId , ncGovActIndex :: Word32 , ncFilePath :: File () Out @@ -77,8 +85,10 @@ data EraBasedNoConfidence data EraBasedTreasuryWithdrawal where EraBasedTreasuryWithdrawal - :: Lovelace -- ^ Deposit + :: Ledger.Network + -> Lovelace -- ^ Deposit -> AnyStakeIdentifier -- ^ Return address + -> (Ledger.Url, Text) -- ^ Proposal anchor -> [(AnyStakeIdentifier, Lovelace)] -> File () Out -> EraBasedTreasuryWithdrawal diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs index 489f5669a4..ea0f3c8e27 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs @@ -6,16 +6,14 @@ module Cardano.CLI.EraBased.Commands.Governance.Vote , renderGovernanceVoteCmds ) where -import Cardano.Api import Cardano.CLI.Types.Governance import Data.Text (Text) -data GovernanceVoteCmds era +newtype GovernanceVoteCmds era = GovernanceVoteCreateCmd AnyVote - (File () Out) renderGovernanceVoteCmds :: () => GovernanceVoteCmds era diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index c8fd454ba0..9dabea6e26 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -12,6 +12,7 @@ module Cardano.CLI.EraBased.Options.Common where import Cardano.Api +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import Cardano.CLI.Environment (EnvCli (..), envCliAnyShelleyBasedEra, @@ -41,7 +42,7 @@ import Data.Text (Text) import qualified Data.Text as Text import Data.Time.Clock (UTCTime) import Data.Time.Format (defaultTimeLocale, parseTimeOrError) -import Data.Word (Word64) +import Data.Word import GHC.Natural (Natural) import Network.Socket (PortNumber) import Options.Applicative hiding (help, str) @@ -780,15 +781,27 @@ catCommands = \case pConstitution :: Parser Constitution pConstitution = asum - [ fmap ConstitutionFromText $ Opt.strOption $ mconcat - [ Opt.long "constitution" - , Opt.metavar "TEXT" - , Opt.help "Input constitution as UTF-8 encoded text." - ] + [ ConstitutionFromText + <$> pUrl "Constitution URL." + <*> Opt.strOption (mconcat + [ Opt.long "constitution" + , Opt.metavar "TEXT" + , Opt.help "Input constitution as UTF-8 encoded text." + ]) , ConstitutionFromFile - <$> pFileInDirection "constitution-file" "Input constitution as a text file." + <$> pUrl "Constitution URL." + <*> pFileInDirection "constitution-file" "Input constitution as a text file." ] +pUrl :: String -> Parser Ledger.Url +pUrl h = fromMaybe (error "Url longer than 64 bytes") + . Ledger.textToUrl <$> + Opt.strOption (mconcat + [ Opt.long "url" + , Opt.metavar "TEXT" + , Opt.help h + ]) + pGovActionDeposit :: Parser Lovelace pGovActionDeposit = Opt.option (readerFromParsecParser parseLovelace) $ mconcat @@ -2657,14 +2670,6 @@ pVoterType = , flag' VSP $ mconcat [long "spo", Opt.help "Stake pool operator"] ] -pGoveranceActionIdentifier :: String -> Parser TxIn -pGoveranceActionIdentifier h = - Opt.option (readerFromParsecParser parseTxIn) $ mconcat - [ Opt.long "tx-in" - , Opt.metavar "TX-IN" - , Opt.help h - ] - -- TODO: Conway era include "normal" stake keys pVotingCredential :: Parser (VerificationKeyOrFile StakePoolKey) pVotingCredential = pStakePoolVerificationKeyOrFile @@ -2711,6 +2716,35 @@ pDRepVerificationKeyFile = , Opt.help "Filepath of the DRep verification key." , Opt.completer (Opt.bashCompleter "file") ] +pProposalAnchor :: Parser (Ledger.Url, Text) +pProposalAnchor = undefined + +pPreviousGovernanceAction :: Parser (Maybe (TxId, Word32)) +pPreviousGovernanceAction = optional $ + (,) <$> pTxId "governance-action-tx-id" "Previous txid of the governance action." + <*> pWord32 "governance-action-index" "Previous tx's governance action index." + +pGovernanceActionId :: Parser (TxId, Word32) +pGovernanceActionId = + (,) <$> pTxId "governance-action-tx-id" "Txid of the governance action." + <*> pWord32 "governance-action-index" "Tx's governance action index." + +pWord32 :: String -> String -> Parser Word32 +pWord32 l h = + Opt.option auto $ mconcat + [ Opt.long l + , Opt.metavar "WORD32" + , Opt.help h + ] + +pTxId :: String -> String -> Parser TxId +pTxId l h = + Opt.option (readerFromParsecParser parseTxId) $ mconcat + [ Opt.long l + , Opt.metavar "TXID" + , Opt.help h + ] + -------------------------------------------------------------------------------- -- Helpers diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index 648ad1ed9c..1d116cd639 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -12,13 +12,13 @@ import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.Governance.Actions import Cardano.CLI.EraBased.Options.Common +import Cardano.CLI.Legacy.Commands.Governance (pNetwork) import Cardano.CLI.Types.Common import Cardano.Ledger.BaseTypes (NonNegativeInterval) import qualified Cardano.Ledger.BaseTypes as Ledger import Data.Foldable import GHC.Natural (Natural) -import GHC.Word import Options.Applicative import qualified Options.Applicative as Opt @@ -54,8 +54,11 @@ pGovernanceActionNewConstitution era = do pCmd cOn = fmap (GovernanceActionCreateConstitution cOn) $ EraBasedNewConstitution - <$> pGovActionDeposit + <$> pNetwork + <*> pGovActionDeposit <*> pAnyStakeIdentifier + <*> pPreviousGovernanceAction + <*> pProposalAnchor <*> pConstitution <*> pFileOutDirection "out-file" "Output filepath of the constitution." @@ -76,12 +79,14 @@ pGovernanceActionNewCommittee era = do pEraBasedNewCommittee :: Parser EraBasedNewCommittee pEraBasedNewCommittee = EraBasedNewCommittee - <$> pGovActionDeposit + <$> pNetwork + <*> pGovActionDeposit <*> pAnyStakeIdentifier + <*> pProposalAnchor <*> many pAnyStakeIdentifier <*> many ((,) <$> pAnyStakeIdentifier <*> pEpochNo "Committee member expiry epoch") <*> pRational "quorum" "Quorum of the committee that is necessary for a successful vote." - <*> pGoveranceActionIdentifier "Previous governance action id of `NewCommittee` or `NoConfidence` type" + <*> pPreviousGovernanceAction <*> pOutputFile @@ -99,31 +104,14 @@ pGovernanceActionNoConfidence era = do pCmd cOn = fmap (GovernanceActionCreateNoConfidence cOn) $ EraBasedNoConfidence - <$> pGovActionDeposit + <$> pNetwork + <*> pGovActionDeposit <*> pAnyStakeIdentifier + <*> pProposalAnchor <*> pTxId "governance-action-tx-id" "Previous txid of `NoConfidence` or `NewCommittee` governance action." - <*> pWord32 "goverenance-action-index" "Previous tx's governance action index of `NoConfidence` or `NewCommittee` governance action." + <*> pWord32 "governance-action-index" "Previous tx's governance action index of `NoConfidence` or `NewCommittee` governance action." <*> pFileOutDirection "out-file" "Output filepath of the no confidence proposal." - -pWord32 :: String -> String -> Parser Word32 -pWord32 l h = - Opt.option auto $ mconcat - [ Opt.long l - , Opt.metavar "WORD32" - , Opt.help h - ] - - -pTxId :: String -> String -> Parser TxId -pTxId l h = - Opt.option (readerFromParsecParser parseTxId) $ mconcat - [ Opt.long l - , Opt.metavar "TXID" - , Opt.help h - ] - - pAnyStakeIdentifier :: Parser AnyStakeIdentifier pAnyStakeIdentifier = asum [ AnyStakePoolKey <$> pStakePoolVerificationKeyOrHashOrFile @@ -317,8 +305,10 @@ pGovernanceActionTreasuryWithdrawal era = do pCmd cOn = fmap (GovernanceActionTreasuryWithdrawal cOn) $ EraBasedTreasuryWithdrawal - <$> pGovActionDeposit + <$> pNetwork + <*> pGovActionDeposit <*> pAnyStakeIdentifier + <*> pProposalAnchor <*> many ((,) <$> pAnyStakeIdentifier <*> pTransferAmt) <*> pFileOutDirection "out-file" "Output filepath of the treasury withdrawal." diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Vote.hs index 754dc606e8..0640ce353c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Vote.hs @@ -38,16 +38,16 @@ pGovernanceVoteCreateCmd era = do $ Opt.info ( GovernanceVoteCreateCmd <$> pAnyVote w - <*> pOutputFile ) $ Opt.progDesc "Vote creation." pAnyVote :: ConwayEraOnwards era -> Parser AnyVote pAnyVote cOnwards = ConwayOnwardsVote cOnwards - <$> pVoteChoice - <*> pGoveranceActionIdentifier "TxIn of governance action (already on chain)." - <*> pAnyVotingStakeVerificationKeyOrHashOrFile + <$> pVoteChoice + <*> pGovernanceActionId + <*> pAnyVotingStakeVerificationKeyOrHashOrFile + <*> pFileOutDirection "out-file" "Output filepath of the vote." pAnyVotingStakeVerificationKeyOrHashOrFile :: Parser AnyVotingStakeVerificationKeyOrHashOrFile pAnyVotingStakeVerificationKeyOrHashOrFile = diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index 1bdb752b66..729b897935 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -1,7 +1,9 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE RankNTypes #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} module Cardano.CLI.EraBased.Run.Governance.Actions ( runGovernanceActionCmds @@ -9,7 +11,8 @@ module Cardano.CLI.EraBased.Run.Governance.Actions ) where import Cardano.Api -import Cardano.Api.Ledger (HasKeyRole (coerceKeyRole)) +import Cardano.Api.Ledger (coerceKeyRole) +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.Governance.Actions @@ -21,6 +24,7 @@ import Control.Monad.Except (ExceptT) import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Except.Extra import qualified Data.ByteString as BS +import qualified Data.Map.Strict as Map import qualified Data.Text.Encoding as Text runGovernanceActionCmds :: () @@ -58,10 +62,16 @@ runGovernanceActionCreateNoConfidence :: ConwayEraOnwards era -> EraBasedNoConfidence -> ExceptT GovernanceActionsError IO () -runGovernanceActionCreateNoConfidence cOn (EraBasedNoConfidence deposit returnAddr _txid _ind outFp) = do +runGovernanceActionCreateNoConfidence cOn (EraBasedNoConfidence network deposit returnAddr propAnchor txid ind outFp) = do returnKeyHash <- readStakeKeyHash returnAddr let sbe = conwayEraOnwardsToShelleyBasedEra cOn - proposal = createProposalProcedure sbe deposit returnKeyHash MotionOfNoConfidence + proposal = createProposalProcedure + sbe + network + deposit + returnKeyHash + (MotionOfNoConfidence . Ledger.SJust $ createPreviousGovernanceActionId txid ind) + (uncurry createAnchor (fmap Text.encodeUtf8 propAnchor)) firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ conwayEraOnwardsConstraints cOn @@ -71,27 +81,45 @@ runGovernanceActionCreateConstitution :: () => ConwayEraOnwards era -> EraBasedNewConstitution -> ExceptT GovernanceActionsError IO () -runGovernanceActionCreateConstitution cOn (EraBasedNewConstitution deposit anyStake constit outFp) = do +runGovernanceActionCreateConstitution cOn (EraBasedNewConstitution network deposit anyStake mPrevGovActId propAnchor constit outFp) = do stakeKeyHash <- readStakeKeyHash anyStake case constit of - ConstitutionFromFile fp -> do + ConstitutionFromFile url fp -> do cBs <- liftIO $ BS.readFile $ unFile fp _utf8EncodedText <- firstExceptT GovernanceActionsCmdNonUtf8EncodedConstitution . hoistEither $ Text.decodeUtf8' cBs - let govAct = ProposeNewConstitution cBs + let prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovActId + govAct = ProposeNewConstitution + prevGovActId + (createAnchor url cBs) -- TODO: Conway era - this is wrong, create `AnchorData` then hash that sbe = conwayEraOnwardsToShelleyBasedEra cOn - proposal = createProposalProcedure sbe deposit stakeKeyHash govAct + proposal = createProposalProcedure + sbe + network + deposit + stakeKeyHash + govAct + (uncurry createAnchor (fmap Text.encodeUtf8 propAnchor)) firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ conwayEraOnwardsConstraints cOn $ writeFileTextEnvelope outFp Nothing proposal - ConstitutionFromText c -> do + ConstitutionFromText url c -> do let constitBs = Text.encodeUtf8 c sbe = conwayEraOnwardsToShelleyBasedEra cOn - govAct = ProposeNewConstitution constitBs - proposal = createProposalProcedure sbe deposit stakeKeyHash govAct + prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovActId + govAct = ProposeNewConstitution + prevGovActId + (createAnchor url constitBs) + proposal = createProposalProcedure + sbe + network + deposit + stakeKeyHash + govAct + (uncurry createAnchor (fmap Text.encodeUtf8 propAnchor)) firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ conwayEraOnwardsConstraints cOn @@ -103,18 +131,28 @@ runGovernanceActionCreateNewCommittee :: ConwayEraOnwards era -> EraBasedNewCommittee -> ExceptT GovernanceActionsError IO () -runGovernanceActionCreateNewCommittee cOn (EraBasedNewCommittee deposit retAddr old new q prevActId oFp) = do +runGovernanceActionCreateNewCommittee cOn (EraBasedNewCommittee network deposit retAddr propAnchor old new q prevActId oFp) = do let sbe = conwayEraOnwardsToShelleyBasedEra cOn -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards - _govActIdentifier = makeGoveranceActionId sbe prevActId + govActIdentifier = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> prevActId quorumRational = toRational q - _oldCommitteeKeyHashes <- mapM readStakeKeyHash old - newCommitteeKeyHashes <- mapM (readStakeKeyHash . fst) new + oldCommitteeKeyHashes <- mapM readStakeKeyHash old + newCommitteeKeyHashes <- mapM (\(stakeKey, expEpoch) -> (,expEpoch) <$> readStakeKeyHash stakeKey) new returnKeyHash <- readStakeKeyHash retAddr - let proposeNewCommittee = ProposeNewCommittee newCommitteeKeyHashes quorumRational - proposal = createProposalProcedure sbe deposit returnKeyHash proposeNewCommittee + let proposeNewCommittee = ProposeNewCommittee + govActIdentifier + oldCommitteeKeyHashes + (Map.fromList newCommitteeKeyHashes) + quorumRational + proposal = createProposalProcedure + sbe + network + deposit + returnKeyHash + proposeNewCommittee + (uncurry createAnchor (fmap Text.encodeUtf8 propAnchor)) firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ conwayEraOnwardsConstraints cOn @@ -161,13 +199,19 @@ runGovernanceActionTreasuryWithdrawal :: ConwayEraOnwards era -> EraBasedTreasuryWithdrawal -> ExceptT GovernanceActionsError IO () -runGovernanceActionTreasuryWithdrawal cOn (EraBasedTreasuryWithdrawal deposit returnAddr treasuryWithdrawal outFp) = do +runGovernanceActionTreasuryWithdrawal cOn (EraBasedTreasuryWithdrawal network deposit returnAddr propAnchor treasuryWithdrawal outFp) = do returnKeyHash <- readStakeKeyHash returnAddr - withdrawals <- sequence [ (,ll) <$> stakeIdentifiertoCredential stakeIdentifier - | (stakeIdentifier,ll) <- treasuryWithdrawal - ] + withdrawals <- sequence [ (network,,ll) <$> stakeIdentifiertoCredential stakeIdentifier + | (stakeIdentifier,ll) <- treasuryWithdrawal + ] let sbe = conwayEraOnwardsToShelleyBasedEra cOn - proposal = createProposalProcedure sbe deposit returnKeyHash (TreasuryWithdrawal withdrawals) + proposal = createProposalProcedure + sbe + network + deposit + returnKeyHash + (TreasuryWithdrawal withdrawals) + (uncurry createAnchor (fmap Text.encodeUtf8 propAnchor)) firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ conwayEraOnwardsConstraints cOn diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index 674973d4ab..e8d0d252ab 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -8,8 +8,6 @@ module Cardano.CLI.EraBased.Run.Governance.Vote ( runGovernanceVoteCmds ) where -import Cardano.Api -import Cardano.Api.Ledger (HasKeyRole (coerceKeyRole)) import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.Governance.Vote @@ -17,6 +15,7 @@ import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.GovernanceVoteCmdError import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key +import Cardano.Ledger.Keys (coerceKeyRole) import Control.Monad.Except import Control.Monad.Trans.Except.Extra @@ -27,46 +26,57 @@ runGovernanceVoteCmds :: () => GovernanceVoteCmds era -> ExceptT CmdError IO () runGovernanceVoteCmds = \case - GovernanceVoteCreateCmd anyVote outFp -> - runGovernanceVoteCreateCmd anyVote outFp + GovernanceVoteCreateCmd anyVote -> + runGovernanceVoteCreateCmd anyVote & firstExceptT CmdGovernanceVoteError runGovernanceVoteCreateCmd :: AnyVote - -> File () Out -> ExceptT GovernanceVoteCmdError IO () -runGovernanceVoteCreateCmd (ConwayOnwardsVote cOnwards v govTxInIdentifier anyStake) outFp = do - case anyStake of +runGovernanceVoteCreateCmd (ConwayOnwardsVote cOnwards voteChoice (govActionTxId, govActionIndex) voteStakeCred oFp) = do + let sbe = conwayEraOnwardsToShelleyBasedEra cOnwards -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards + case voteStakeCred of AnyDRepVerificationKeyOrHashOrFile stake -> do - let sbe = conwayEraOnwardsToShelleyBasedEra cOnwards -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards DRepKeyHash h <- firstExceptT GovernanceVoteCmdReadError - . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsDRepKey stake + . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsDRepKey stake let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential sbe vStakeCred - let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier - voteProcedure = createVotingProcedure sbe v (VoterDRep votingCred) govActIdentifier - firstExceptT GovernanceVoteCmeWriteError . newExceptT - $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope outFp Nothing voteProcedure + let voter = VoterDRep votingCred + govActIdentifier = shelleyBasedEraConstraints sbe $ createGovernanceActionId govActionTxId govActionIndex + voteProcedure = createVotingProcedure sbe voteChoice Nothing + votingEntry = VotingEntry { votingEntryVoter = voter + , votingEntryGovActionId = GovernanceActionId govActIdentifier + , votingEntryVotingProcedure = voteProcedure + } + firstExceptT GovernanceVoteCmdWriteError . newExceptT $ shelleyBasedEraConstraints sbe + $ writeFileTextEnvelope oFp Nothing votingEntry AnyStakePoolVerificationKeyOrHashOrFile stake -> do - let sbe = conwayEraOnwardsToShelleyBasedEra cOnwards -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards h <- firstExceptT GovernanceVoteCmdReadError . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsStakePoolKey stake - let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier - voteProcedure = createVotingProcedure sbe v (VoterSpo h) govActIdentifier - firstExceptT GovernanceVoteCmeWriteError . newExceptT - $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope outFp Nothing voteProcedure + let voter = VoterSpo h + govActIdentifier = shelleyBasedEraConstraints sbe $ createGovernanceActionId govActionTxId govActionIndex + voteProcedure = createVotingProcedure sbe voteChoice Nothing + votingEntry = VotingEntry { votingEntryVoter = voter + , votingEntryGovActionId = GovernanceActionId govActIdentifier + , votingEntryVotingProcedure = voteProcedure + } + firstExceptT GovernanceVoteCmdWriteError . newExceptT $ shelleyBasedEraConstraints sbe + $ writeFileTextEnvelope oFp Nothing votingEntry AnyCommitteeHotVerificationKeyOrHashOrFile stake -> do - let sbe = conwayEraOnwardsToShelleyBasedEra cOnwards -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards CommitteeHotKeyHash h <- firstExceptT GovernanceVoteCmdReadError - . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsCommitteeHotKey stake + . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsCommitteeHotKey stake let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential sbe vStakeCred - - let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier - voteProcedure = createVotingProcedure sbe v (VoterCommittee votingCred) govActIdentifier - firstExceptT GovernanceVoteCmeWriteError . newExceptT - $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope outFp Nothing voteProcedure + let voter = VoterCommittee votingCred + govActIdentifier = shelleyBasedEraConstraints sbe $ createGovernanceActionId govActionTxId govActionIndex + voteProcedure = createVotingProcedure sbe voteChoice Nothing + votingEntry = VotingEntry { votingEntryVoter = voter + , votingEntryGovActionId = GovernanceActionId govActIdentifier + , votingEntryVotingProcedure = voteProcedure + } + firstExceptT GovernanceVoteCmdWriteError . newExceptT $ shelleyBasedEraConstraints sbe + $ writeFileTextEnvelope oFp Nothing votingEntry diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs index c7d35d6813..90f29c2876 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs @@ -5,6 +5,7 @@ module Cardano.CLI.Legacy.Commands.Governance where import Cardano.Api +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import Cardano.CLI.Environment @@ -93,7 +94,7 @@ pCreateVote envCli = ConwayVote <$> pVoteChoice <*> pVoterType - <*> pGoveranceActionIdentifier "TxIn of governance action (already on chain)." + <*> pGovernanceActionId <*> pVotingCredential <*> (pShelleyBasedConway envCli <|> pure (AnyShelleyBasedEra ShelleyBasedEraConway)) <*> pFileOutDirection "out-file" "Output filepath of the vote." @@ -125,9 +126,24 @@ pCreateConstitution :: EnvCli -> Parser ActionCmd pCreateConstitution envCli = fmap CreateConstitution $ NewConstitution - <$> (pShelleyBasedConway envCli <|> pure (AnyShelleyBasedEra ShelleyBasedEraConway)) + <$> pNetwork + <*> (pShelleyBasedConway envCli <|> pure (AnyShelleyBasedEra ShelleyBasedEraConway)) <*> pGovActionDeposit <*> pVotingCredential + <*> pPreviousGovernanceAction + <*> pProposalAnchor <*> pConstitution <*> pFileOutDirection "out-file" "Output filepath of the governance action." +pNetwork :: Parser Ledger.Network +pNetwork = asum $ mconcat + [ [ Opt.flag' Ledger.Mainnet $ mconcat + [ Opt.long "mainnet" + , Opt.help "Use the mainnet magic id." + ] + , Opt.flag' Ledger.Testnet $ mconcat + [ Opt.long "testnet-magic" + , Opt.help "Use the testnet magic id." + ] + ] + ] diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs index b198af89a4..8a0a8b7f43 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs @@ -45,8 +45,8 @@ runGovernanceCmds :: LegacyGovernanceCmds -> ExceptT GovernanceCmdError IO () runGovernanceCmds = \case GovernanceVoteCmd (CreateVoteCmd (ConwayVote voteChoice voteType govActTcIn voteStakeCred sbe fp)) -> runGovernanceCreateVoteCmd sbe voteChoice voteType govActTcIn voteStakeCred fp - GovernanceActionCmd (CreateConstitution (Cli.NewConstitution sbe deposit voteStakeCred newconstitution fp)) -> - runGovernanceNewConstitutionCmd sbe deposit voteStakeCred newconstitution fp + GovernanceActionCmd (CreateConstitution (Cli.NewConstitution network sbe deposit voteStakeCred mPrevGovActId propAnchor newconstitution fp)) -> + runGovernanceNewConstitutionCmd network sbe deposit voteStakeCred mPrevGovActId propAnchor newconstitution fp GovernanceMIRPayStakeAddressesCertificate (AnyShelleyToBabbageEra w) mirpot vKeys rewards out -> runGovernanceMIRCertificatePayStakeAddrs w mirpot vKeys rewards out GovernanceMIRTransfer (AnyShelleyToBabbageEra w) amt out direction -> do diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 502e88eb34..42e07c7a82 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -585,6 +585,7 @@ data SomeWitness | AGenesisDelegateExtendedSigningKey (SigningKey GenesisDelegateExtendedKey) | AGenesisUTxOSigningKey (SigningKey GenesisUTxOKey) + | ADRepSigningKey (SigningKey DRepKey) -- | Data required for constructing a Shelley bootstrap witness. @@ -618,6 +619,11 @@ categoriseSomeWitness swsk = AGenesisDelegateExtendedSigningKey sk -> AShelleyKeyWitness (WitnessGenesisDelegateExtendedKey sk) AGenesisUTxOSigningKey sk -> AShelleyKeyWitness (WitnessGenesisUTxOKey sk) + ADRepSigningKey sk -> AShelleyKeyWitness (WitnessPaymentKey $ castDrep sk) + +-- TODO: Conway era - Add constrctor for SigningKey DrepKey to ShelleyWitnessSigningKey +castDrep :: SigningKey DRepKey -> SigningKey PaymentKey +castDrep (DRepSigningKey sk) = PaymentSigningKey sk data ReadWitnessSigningDataError = ReadWitnessSigningDataSigningKeyDecodeError !(FileError InputDecodeError) @@ -676,6 +682,7 @@ readWitnessSigningData (KeyWitnessSigningData skFile mbByronAddr) = do AGenesisDelegateExtendedSigningKey , FromSomeType (AsSigningKey AsGenesisUTxOKey) AGenesisUTxOSigningKey + , FromSomeType (AsSigningKey AsDRepKey) ADRepSigningKey ] bech32FileTypes = diff --git a/cardano-cli/src/Cardano/CLI/Types/Common.hs b/cardano-cli/src/Cardano/CLI/Types/Common.hs index 9c55dd7026..1eaf0743c8 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Common.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Common.hs @@ -70,6 +70,7 @@ module Cardano.CLI.Types.Common ) where import Cardano.Api +import qualified Cardano.Api.Ledger as Ledger import qualified Cardano.Chain.Slotting as Byron import qualified Cardano.Ledger.Crypto as Crypto @@ -91,8 +92,11 @@ data TransferDirection = data OpCertCounter data Constitution - = ConstitutionFromFile (File () In) - | ConstitutionFromText Text deriving Show + = ConstitutionFromFile Ledger.Url (File () In) + | ConstitutionFromText + Ledger.Url + Text -- ^ Constitution text + deriving Show -- | Specify whether to render the script cost as JSON -- in the cli's build command. diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs index 585b832f6f..ce0a6aa757 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs @@ -15,7 +15,7 @@ import qualified Formatting.Buildable as B data GovernanceVoteCmdError = GovernanceVoteCmdReadError !(FileError InputDecodeError) | GovernanceVoteCmdCredentialDecodeError !DecoderError - | GovernanceVoteCmeWriteError !(FileError ()) + | GovernanceVoteCmdWriteError !(FileError ()) deriving Show instance Error GovernanceVoteCmdError where @@ -24,7 +24,7 @@ instance Error GovernanceVoteCmdError where "Cannot read verification key: " <> displayError e GovernanceVoteCmdCredentialDecodeError e -> "Cannot decode voting credential: " <> renderDecoderError e - GovernanceVoteCmeWriteError e -> + GovernanceVoteCmdWriteError e -> "Cannot write vote: " <> displayError e where renderDecoderError = TL.unpack . TL.toLazyText . B.build diff --git a/cardano-cli/src/Cardano/CLI/Types/Governance.hs b/cardano-cli/src/Cardano/CLI/Types/Governance.hs index d3a39975dd..6dff659eaa 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Governance.hs @@ -4,10 +4,14 @@ module Cardano.CLI.Types.Governance where import Cardano.Api +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import Cardano.CLI.Types.Common -import Cardano.CLI.Types.Key +import Cardano.CLI.Types.Key (VerificationKeyOrFile, VerificationKeyOrHashOrFile) + +import Data.Text (Text) +import Data.Word type VoteFile = File ConwayVote @@ -15,7 +19,7 @@ data ConwayVote = ConwayVote { cvVoteChoice :: Vote , cvVoterType :: VType - , cvGovActionTxIn :: TxIn + , cvGovActionId :: (TxId, Word32) , cvVotingStakeCredential :: VerificationKeyOrFile StakePoolKey , cvEra :: AnyShelleyBasedEra , cvFilepath :: VoteFile Out @@ -25,9 +29,12 @@ type NewConstitutionFile = File NewConstitution data NewConstitution = NewConstitution - { ncEra :: AnyShelleyBasedEra + { ncNetwork :: Ledger.Network + , ncEra :: AnyShelleyBasedEra , ncDeposit :: Lovelace , ncVotingStakeCredential :: VerificationKeyOrFile StakePoolKey + , ncPrevGovActId :: Maybe (TxId, Word32) + , ncPropAnchor :: (Ledger.Url, Text) , ncConstitution :: Constitution , ncFilePath :: NewConstitutionFile Out } deriving Show @@ -42,8 +49,9 @@ data AnyVote where ConwayOnwardsVote :: ConwayEraOnwards era -> Vote - -> TxIn + -> (TxId, Word32) -> AnyVotingStakeVerificationKeyOrHashOrFile + -> VoteFile Out -> AnyVote data AnyVotingStakeVerificationKeyOrHashOrFile where diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/ErrorsSpec.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/ErrorsSpec.hs index 120410d15e..e379dff700 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/ErrorsSpec.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/ErrorsSpec.hs @@ -145,8 +145,8 @@ test_EraBasedVoteReadError = $ DecoderErrorCustom "" "") , ("GovernanceVoteCmdReadError" , GovernanceVoteCmdReadError $ FileError "path/file.txt" InputInvalidError) - , ("GovernanceVoteCmeWriteError" - , GovernanceVoteCmeWriteError $ FileError "path/file.txt" ()) + , ("GovernanceVoteCmdWriteError" + , GovernanceVoteCmdWriteError $ FileError "path/file.txt" ()) ] test_GovernanceComitteeError :: TestTree From d8da94adde82b89d7c39954859c5e59ee066ee12 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 22 Aug 2023 09:45:04 -0400 Subject: [PATCH 3/6] Update certificate JSON friendly rendering Update readTxVotes to read a VotingEntry which consists of the voter's voting credential, the governance action id of the proposal the vote is for and the vote itself --- cardano-cli/src/Cardano/CLI/Json/Friendly.hs | 37 +++++++++++++------ .../Cardano/CLI/Legacy/Commands/Governance.hs | 2 +- .../src/Cardano/CLI/Legacy/Run/Query.hs | 4 +- cardano-cli/src/Cardano/CLI/Read.hs | 14 +++++-- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index c8eb1e4419..e940ef1d24 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -20,6 +20,7 @@ import Cardano.Api.Shelley (Address (ShelleyAddress), Hash (..), StakeAddress (..), fromShelleyPaymentCredential, fromShelleyScriptHash, fromShelleyStakeReference, toShelleyLovelace, toShelleyStakeCredential) +import qualified Cardano.Ledger.Conway.TxCert as ConwayLedger import qualified Cardano.Ledger.Credential as Shelley import qualified Cardano.Ledger.Shelley.API as Shelley @@ -312,6 +313,12 @@ stakeCredJson -> Aeson.Value stakeCredJson sbe c = shelleyBasedEraConstraints sbe $ toJSON c +drepCredJson + :: ShelleyBasedEra era + -> Shelley.Credential 'Shelley.DRepRole (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> Aeson.Value +drepCredJson sbe c = shelleyBasedEraConstraints sbe $ toJSON c + poolIdJson :: ShelleyBasedEra era -> Ledger.KeyHash Ledger.StakePool (Ledger.EraCrypto (ShelleyLedgerEra era)) @@ -363,7 +370,7 @@ renderCertificate sbe = \case ConwayCertificate w cert -> conwayEraOnwardsConstraints w $ case cert of - Ledger.RegDRepTxCert credential coin -> + Ledger.RegDRepTxCert credential coin _TODO -> -- TODO Conway: new StrictMaybe Anchor argument "Drep registration certificate" .= object [ "deposit" .= coin , "certificate" .= conwayToObject w credential @@ -373,15 +380,21 @@ renderCertificate sbe = \case [ "refund" .= coin , "certificate" .= conwayToObject w credential ] - Ledger.AuthCommitteeHotKeyTxCert (Shelley.KeyHash coldKey) (Shelley.KeyHash hotKey) -> + Ledger.AuthCommitteeHotKeyTxCert coldCred hotCred + | Shelley.ScriptHashObj{} <- coldCred -> error "renderCertificate: TODO Conway era" + | Shelley.ScriptHashObj{} <- hotCred -> error "renderCertificate: TODO Conway era" + | Shelley.KeyHashObj (Shelley.KeyHash coldKey) <- coldCred + , Shelley.KeyHashObj (Shelley.KeyHash hotKey) <- hotCred -> "Constitutional committee member hot key registration" .= object - ["cold key hash" .= String (textShow coldKey) - , "hot key hash" .= String (textShow hotKey) - ] - Ledger.ResignCommitteeColdTxCert (Shelley.KeyHash coldKey) -> - "Constitutional committee cold key resignation" .= object [ "cold key hash" .= String (textShow coldKey) + , "hot key hash" .= String (textShow hotKey) ] + Ledger.ResignCommitteeColdTxCert cred -> case cred of + Shelley.ScriptHashObj{} -> error "renderCertificate: TODO Conway era" + Shelley.KeyHashObj (Shelley.KeyHash coldKey) -> + "Constitutional committee cold key resignation" .= object + [ "cold key hash" .= String (textShow coldKey) + ] Ledger.RegTxCert stakeCredential -> "Stake address registration" .= object [ "stake credential" .= stakeCredJson sbe stakeCredential @@ -420,15 +433,15 @@ renderCertificate sbe = \case [ "stake pool key hash" .= String (textShow kh) , "epoch" .= epoch ] - Ledger.DelegStakeTxCert stakeCredential (Shelley.KeyHash kh) -> - "Stake address delegation" .= object - [ "stake credential" .= stakeCredJson sbe stakeCredential - , "key hash" .= String (textShow kh) + ConwayLedger.UpdateDRepTxCert drepCredential mbAnchor -> + "Drep certificate update" .= object + [ "Drep credential" .= drepCredJson sbe drepCredential + , "anchor " .= mbAnchor ] where conwayToObject :: () => ConwayEraOnwards era - -> Shelley.Credential 'Shelley.Voting (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> Shelley.Credential 'Shelley.DRepRole (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value conwayToObject w' = conwayEraOnwardsConstraints w' $ diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs index 90f29c2876..9ab8666251 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs @@ -142,7 +142,7 @@ pNetwork = asum $ mconcat , Opt.help "Use the mainnet magic id." ] , Opt.flag' Ledger.Testnet $ mconcat - [ Opt.long "testnet-magic" + [ Opt.long "testnet" , Opt.help "Use the testnet magic id." ] ] diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs index 43c802b00a..7b1f78639e 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs @@ -43,6 +43,7 @@ import Cardano.CLI.Types.Key (VerificationKeyOrHashOrFile, import qualified Cardano.CLI.Types.Output as O import Cardano.Crypto.Hash (hashToBytesAsHex) import qualified Cardano.Crypto.Hash.Blake2b as Blake2b +import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.Core as Core import qualified Cardano.Ledger.Crypto as Crypto import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..)) @@ -70,7 +71,6 @@ import Data.Aeson as Aeson import Data.Aeson.Encode.Pretty (encodePretty) import Data.Aeson.Types as Aeson import Data.Bifunctor (Bifunctor (..)) -import Data.ByteString (ByteString) import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Coerce (coerce) import Data.Function ((&)) @@ -160,7 +160,7 @@ runQueryConstitutionHash socketPath (AnyConsensusModeParams cModeParams) network where writeConstitutionHash :: Maybe (File () Out) - -> Maybe (SafeHash StandardCrypto ByteString) + -> Maybe (SafeHash StandardCrypto L.AnchorData) -> ExceptT ShelleyQueryCmdError IO () writeConstitutionHash mOutFile' cHash = case mOutFile' of diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 42e07c7a82..524966c827 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -98,6 +98,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Function ((&)) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import qualified Data.List as List +import qualified Data.Map.Strict as Map import Data.Text (Text) import qualified Data.Text as Text import Data.Word @@ -749,14 +750,21 @@ readTxVotes :: () -> IO (Either VoteError (TxVotes era)) readTxVotes _ [] = return $ Right TxVotesNone readTxVotes w files = runExceptT $ do - TxVotes w <$> forM files (ExceptT . readVoteFile w) + TxVotes w . Map.fromList . map entryToAssoc <$> forM files (ExceptT . readVoteFile w) + where + entryToAssoc :: VotingEntry era -> ((Voter era, GovernanceActionId era), VotingProcedure era) + entryToAssoc VotingEntry + { votingEntryVoter = voter + , votingEntryGovActionId = govActId + , votingEntryVotingProcedure = vproc + } = ((voter, govActId), vproc) readVoteFile :: ConwayEraOnwards era -> VoteFile In - -> IO (Either VoteError (VotingProcedure era)) + -> IO (Either VoteError (VotingEntry era)) readVoteFile w fp = - first VoteErrorFile <$> conwayEraOnwardsConstraints w (readFileTextEnvelope AsVote fp) + first VoteErrorFile <$> conwayEraOnwardsConstraints w (readFileTextEnvelope AsVotingEntry fp) data ConstitutionError = ConstitutionErrorFile (FileError TextEnvelopeError) From c2a4f226e741060d5110730645f1a07702ef75f7 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 22 Aug 2023 12:56:19 -0400 Subject: [PATCH 4/6] Update golden tests --- .../Cardano/CLI/EraBased/Options/Common.hs | 21 ++- .../Test/Golden/Governance/Action.hs | 4 + .../golden/conway/genesis.conway.spec.json | 27 +++- .../GovernanceVoteCmdWriteError.txt | 1 + .../cardano-cli-golden/files/golden/help.cli | 128 ++++++++++++++---- ..._governance_action_create-constitution.cli | 26 +++- ...governance_action_create-new-committee.cli | 21 ++- ...governance_action_create-no-confidence.cli | 16 ++- ...ance_action_create-treasury-withdrawal.cli | 12 +- .../help/conway_governance_vote_create.cli | 10 +- ..._governance_action_create-constitution.cli | 26 +++- ...governance_action_create-new-committee.cli | 21 ++- ...governance_action_create-no-confidence.cli | 16 ++- ...ance_action_create-treasury-withdrawal.cli | 12 +- .../experimental_governance_vote_create.cli | 10 +- ...tion_create-action_create-constitution.cli | 23 +++- .../help/governance_vote_create-vote.cli | 8 +- ...tion_create-action_create-constitution.cli | 23 +++- .../legacy_governance_vote_create-vote.cli | 8 +- 19 files changed, 345 insertions(+), 68 deletions(-) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdWriteError.txt diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 9dabea6e26..a28d4f10c1 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -782,22 +782,22 @@ pConstitution :: Parser Constitution pConstitution = asum [ ConstitutionFromText - <$> pUrl "Constitution URL." + <$> pUrl "constitution-url" "Constitution URL." <*> Opt.strOption (mconcat [ Opt.long "constitution" , Opt.metavar "TEXT" , Opt.help "Input constitution as UTF-8 encoded text." ]) , ConstitutionFromFile - <$> pUrl "Constitution URL." + <$> pUrl "constitution-url" "Constitution URL." <*> pFileInDirection "constitution-file" "Input constitution as a text file." ] -pUrl :: String -> Parser Ledger.Url -pUrl h = fromMaybe (error "Url longer than 64 bytes") +pUrl :: String -> String -> Parser Ledger.Url +pUrl l h = fromMaybe (error "Url longer than 64 bytes") . Ledger.textToUrl <$> Opt.strOption (mconcat - [ Opt.long "url" + [ Opt.long l , Opt.metavar "TEXT" , Opt.help h ]) @@ -2717,7 +2717,16 @@ pDRepVerificationKeyFile = , Opt.completer (Opt.bashCompleter "file") ] pProposalAnchor :: Parser (Ledger.Url, Text) -pProposalAnchor = undefined +pProposalAnchor = (,) <$> pUrl "proposal-url" "Proposal anchor URL" + <*> pAnchorHash + +pAnchorHash :: Parser Text +pAnchorHash = + Opt.strOption $ mconcat + [ Opt.long "anchor-data-hash" + , Opt.metavar "TEXT" + , Opt.help "Hash of anchor data." + ] pPreviousGovernanceAction :: Parser (Maybe (TxId, Word32)) pPreviousGovernanceAction = optional $ diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs index ec9071c06b..3b65dde62e 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs @@ -29,9 +29,13 @@ hprop_golden_governanceActionCreateConstitution = void $ execCardanoCLI [ "conway", "governance", "action", "create-constitution" + , "--mainnet" + , "--anchor-data-hash" , "eda258650888d4a7f8ac1127cfa136962f527f341c99db49929c79ae" + , "--proposal-url" , "proposal-dummy-url" , "--governance-action-deposit", "10" , "--stake-verification-key-file", stakeAddressVKeyFile , "--out-file", actionFile + , "--constitution-url", "constitution-dummy-url" , "--constitution", "This is a test constitution." ] diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json b/cardano-cli/test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json index 4525ef4a58..9fb397192c 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/genesis.conway.spec.json @@ -1,3 +1,26 @@ { - "genDelegs": {} -} + "committeeTermLimit": 0, + "dRepActivity": 0, + "dRepDeposit": 0, + "dRepVotingThresholds": { + "dvtCommitteeNoConfidence": 0, + "dvtCommitteeNormal": 0, + "dvtHardForkInitiation": 0, + "dvtMotionNoConfidence": 0, + "dvtPPEconomicGroup": 0, + "dvtPPGovGroup": 0, + "dvtPPNetworkGroup": 0, + "dvtPPTechnicalGroup": 0, + "dvtTreasuryWithdrawal": 0, + "dvtUpdateToConstitution": 0 + }, + "govActionDeposit": 0, + "govActionExpiration": 0, + "minCommitteeSize": 0, + "poolVotingThresholds": { + "pvtCommitteeNoConfidence": 0, + "pvtCommitteeNormal": 0, + "pvtHardForkInitiation": 0, + "pvtMotionNoConfidence": 0 + } +} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdWriteError.txt b/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdWriteError.txt new file mode 100644 index 0000000000..ba12b65dde --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdWriteError.txt @@ -0,0 +1 @@ +Cannot write vote: path/file.txt: \ 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 c19a0c6245..aa71e95062 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -702,7 +702,11 @@ Usage: cardano-cli conway governance action Governance action commands. -Usage: cardano-cli conway governance action create-constitution --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-constitution + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -710,14 +714,24 @@ Usage: cardano-cli conway governance action create-constitution --governance-act | --stake-verification-key-file FILE | --stake-key-hash HASH ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE Create a constitution. -Usage: cardano-cli conway governance action create-new-committee --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-new-committee + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -725,6 +739,8 @@ Usage: cardano-cli conway governance action create-new-committee --governance-ac | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -742,12 +758,17 @@ Usage: cardano-cli conway governance action create-new-committee --governance-ac ) --epoch NATURAL] --quorum RATIONAL - --tx-in TX-IN + [--governance-action-tx-id TXID + --governance-action-index WORD32] --out-file FILE Create a new committee proposal. -Usage: cardano-cli conway governance action create-no-confidence --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-no-confidence + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -755,8 +776,10 @@ Usage: cardano-cli conway governance action create-no-confidence --governance-ac | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT --governance-action-tx-id TXID - --goverenance-action-index WORD32 + --governance-action-index WORD32 --out-file FILE Create a no confidence proposal. @@ -789,7 +812,11 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update -- Create a protocol parameters update. -Usage: cardano-cli conway governance action create-treasury-withdrawal --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-treasury-withdrawal + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -797,6 +824,8 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal --governa | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE @@ -959,7 +988,8 @@ Usage: cardano-cli conway governance vote create Vote commands. Usage: cardano-cli conway governance vote create (--yes | --no | --abstain) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH @@ -1124,7 +1154,11 @@ Usage: cardano-cli experimental governance action Governance action commands. -Usage: cardano-cli experimental governance action create-constitution --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-constitution + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -1132,14 +1166,24 @@ Usage: cardano-cli experimental governance action create-constitution --governan | --stake-verification-key-file FILE | --stake-key-hash HASH ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE Create a constitution. -Usage: cardano-cli experimental governance action create-new-committee --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-new-committee + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -1147,6 +1191,8 @@ Usage: cardano-cli experimental governance action create-new-committee --governa | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -1164,12 +1210,17 @@ Usage: cardano-cli experimental governance action create-new-committee --governa ) --epoch NATURAL] --quorum RATIONAL - --tx-in TX-IN + [--governance-action-tx-id TXID + --governance-action-index WORD32] --out-file FILE Create a new committee proposal. -Usage: cardano-cli experimental governance action create-no-confidence --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-no-confidence + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -1177,8 +1228,10 @@ Usage: cardano-cli experimental governance action create-no-confidence --governa | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT --governance-action-tx-id TXID - --goverenance-action-index WORD32 + --governance-action-index WORD32 --out-file FILE Create a no confidence proposal. @@ -1211,7 +1264,11 @@ Usage: cardano-cli experimental governance action create-protocol-parameters-upd Create a protocol parameters update. -Usage: cardano-cli experimental governance action create-treasury-withdrawal --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-treasury-withdrawal + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -1219,6 +1276,8 @@ Usage: cardano-cli experimental governance action create-treasury-withdrawal --g | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE @@ -1385,7 +1444,8 @@ Usage: cardano-cli experimental governance vote create | --no | --abstain ) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH @@ -1573,7 +1633,8 @@ Usage: cardano-cli legacy governance vote create-vote (--yes | --no | --abstain) | --drep | --spo ) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) @@ -1591,13 +1652,22 @@ Usage: cardano-cli legacy governance action create-action create-constitution Create a governance action. Usage: cardano-cli legacy governance action create-action create-constitution + ( --mainnet + | --testnet + ) [--conway-era] --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE @@ -2929,7 +2999,8 @@ Usage: cardano-cli governance vote create-vote (--yes | --no | --abstain) | --drep | --spo ) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) @@ -2947,13 +3018,22 @@ Usage: cardano-cli governance action create-action create-constitution Create a governance action. Usage: cardano-cli governance action create-action create-constitution + ( --mainnet + | --testnet + ) [--conway-era] --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli index 59cb9d6816..ee58c70d13 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli conway governance action create-constitution --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-constitution + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,14 +10,22 @@ Usage: cardano-cli conway governance action create-constitution --governance-act | --stake-verification-key-file FILE | --stake-key-hash HASH ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE Create a constitution. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -29,7 +41,15 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --governance-action-tx-id TXID + Previous txid of the governance action. + --governance-action-index WORD32 + Previous tx's governance action index. + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. + --constitution-url TEXT Constitution URL. --constitution TEXT Input constitution as UTF-8 encoded text. + --constitution-url TEXT Constitution URL. --constitution-file FILE Input constitution as a text file. --out-file FILE Output filepath of the constitution. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-new-committee.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-new-committee.cli index 1458f8cc29..7e86ee7d9e 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-new-committee.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-new-committee.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli conway governance action create-new-committee --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-new-committee + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,6 +10,8 @@ Usage: cardano-cli conway governance action create-new-committee --governance-ac | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -23,12 +29,15 @@ Usage: cardano-cli conway governance action create-new-committee --governance-ac ) --epoch NATURAL] --quorum RATIONAL - --tx-in TX-IN + [--governance-action-tx-id TXID + --governance-action-index WORD32] --out-file FILE Create a new committee proposal. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -44,6 +53,8 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. --stake-pool-verification-key STRING Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE @@ -73,7 +84,9 @@ Available options: --epoch NATURAL Committee member expiry epoch --quorum RATIONAL Quorum of the committee that is necessary for a successful vote. - --tx-in TX-IN Previous governance action id of `NewCommittee` or - `NoConfidence` type + --governance-action-tx-id TXID + Previous txid of the governance action. + --governance-action-index WORD32 + Previous tx's governance action index. --out-file FILE The output file. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli index 05bd1ec7ab..5bf5db1ef4 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli conway governance action create-no-confidence --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-no-confidence + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,13 +10,17 @@ Usage: cardano-cli conway governance action create-no-confidence --governance-ac | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT --governance-action-tx-id TXID - --goverenance-action-index WORD32 + --governance-action-index WORD32 --out-file FILE Create a no confidence proposal. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -28,10 +36,12 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. --governance-action-tx-id TXID Previous txid of `NoConfidence` or `NewCommittee` governance action. - --goverenance-action-index WORD32 + --governance-action-index WORD32 Previous tx's governance action index of `NoConfidence` or `NewCommittee` governance action. --out-file FILE Output filepath of the no confidence proposal. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli index 11d4851065..73788d3d89 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli conway governance action create-treasury-withdrawal --governance-action-deposit NATURAL +Usage: cardano-cli conway governance action create-treasury-withdrawal + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,6 +10,8 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal --governa | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE @@ -20,6 +26,8 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal --governa Create a treasury withdrawal. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -35,6 +43,8 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. --stake-pool-verification-key STRING Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli index fa4ae98e4e..0ef7ea6bbb 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli @@ -1,5 +1,6 @@ Usage: cardano-cli conway governance vote create (--yes | --no | --abstain) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH @@ -12,7 +13,10 @@ Usage: cardano-cli conway governance vote create (--yes | --no | --abstain) Vote creation. Available options: - --tx-in TX-IN TxIn of governance action (already on chain). + --governance-action-tx-id TXID + Txid of the governance action. + --governance-action-index WORD32 + Tx's governance action index. --drep-verification-key STRING DRep verification key (Bech32 or hex-encoded). --drep-verification-key-file FILE @@ -28,5 +32,5 @@ Available options: Stake pool ID/verification key hash (either Bech32-encoded or hex-encoded). Zero or more occurences of this option is allowed. - --out-file FILE The output file. + --out-file FILE Output filepath of the vote. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-constitution.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-constitution.cli index bab6b1e7a6..6f84069499 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-constitution.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-constitution.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli experimental governance action create-constitution --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-constitution + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,14 +10,22 @@ Usage: cardano-cli experimental governance action create-constitution --governan | --stake-verification-key-file FILE | --stake-key-hash HASH ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE Create a constitution. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -29,7 +41,15 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --governance-action-tx-id TXID + Previous txid of the governance action. + --governance-action-index WORD32 + Previous tx's governance action index. + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. + --constitution-url TEXT Constitution URL. --constitution TEXT Input constitution as UTF-8 encoded text. + --constitution-url TEXT Constitution URL. --constitution-file FILE Input constitution as a text file. --out-file FILE Output filepath of the constitution. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-new-committee.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-new-committee.cli index c75db26890..fec7e91e97 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-new-committee.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-new-committee.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli experimental governance action create-new-committee --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-new-committee + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,6 +10,8 @@ Usage: cardano-cli experimental governance action create-new-committee --governa | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -23,12 +29,15 @@ Usage: cardano-cli experimental governance action create-new-committee --governa ) --epoch NATURAL] --quorum RATIONAL - --tx-in TX-IN + [--governance-action-tx-id TXID + --governance-action-index WORD32] --out-file FILE Create a new committee proposal. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -44,6 +53,8 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. --stake-pool-verification-key STRING Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE @@ -73,7 +84,9 @@ Available options: --epoch NATURAL Committee member expiry epoch --quorum RATIONAL Quorum of the committee that is necessary for a successful vote. - --tx-in TX-IN Previous governance action id of `NewCommittee` or - `NoConfidence` type + --governance-action-tx-id TXID + Previous txid of the governance action. + --governance-action-index WORD32 + Previous tx's governance action index. --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_action_create-no-confidence.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-no-confidence.cli index 9529b363d7..108e0292dc 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-no-confidence.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-no-confidence.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli experimental governance action create-no-confidence --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-no-confidence + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,13 +10,17 @@ Usage: cardano-cli experimental governance action create-no-confidence --governa | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT --governance-action-tx-id TXID - --goverenance-action-index WORD32 + --governance-action-index WORD32 --out-file FILE Create a no confidence proposal. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -28,10 +36,12 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. --governance-action-tx-id TXID Previous txid of `NoConfidence` or `NewCommittee` governance action. - --goverenance-action-index WORD32 + --governance-action-index WORD32 Previous tx's governance action index of `NoConfidence` or `NewCommittee` governance action. --out-file FILE Output filepath of the no confidence proposal. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-treasury-withdrawal.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-treasury-withdrawal.cli index d1c245f551..d4ab372d9c 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-treasury-withdrawal.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_action_create-treasury-withdrawal.cli @@ -1,4 +1,8 @@ -Usage: cardano-cli experimental governance action create-treasury-withdrawal --governance-action-deposit NATURAL +Usage: cardano-cli experimental governance action create-treasury-withdrawal + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE | --stake-pool-id STAKE_POOL_ID @@ -6,6 +10,8 @@ Usage: cardano-cli experimental governance action create-treasury-withdrawal --g | --stake-verification-key-file FILE | --stake-key-hash HASH ) + --proposal-url TEXT + --anchor-data-hash TEXT [ ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE @@ -20,6 +26,8 @@ Usage: cardano-cli experimental governance action create-treasury-withdrawal --g Create a treasury withdrawal. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. --stake-pool-verification-key STRING @@ -35,6 +43,8 @@ Available options: --stake-verification-key-file FILE Filepath of the staking verification key. --stake-key-hash HASH Stake verification key hash (hex-encoded). + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. --stake-pool-verification-key STRING Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_vote_create.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_vote_create.cli index 25a4249e23..ea5fa07d95 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_vote_create.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/experimental_governance_vote_create.cli @@ -3,7 +3,8 @@ Usage: cardano-cli experimental governance vote create | --no | --abstain ) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH @@ -16,7 +17,10 @@ Usage: cardano-cli experimental governance vote create Vote creation. Available options: - --tx-in TX-IN TxIn of governance action (already on chain). + --governance-action-tx-id TXID + Txid of the governance action. + --governance-action-index WORD32 + Tx's governance action index. --drep-verification-key STRING DRep verification key (Bech32 or hex-encoded). --drep-verification-key-file FILE @@ -32,5 +36,5 @@ Available options: Stake pool ID/verification key hash (either Bech32-encoded or hex-encoded). Zero or more occurences of this option is allowed. - --out-file FILE The output file. + --out-file FILE Output filepath of the vote. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action_create-constitution.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action_create-constitution.cli index 551dc5ba71..359d8e6409 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action_create-constitution.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action_create-constitution.cli @@ -1,17 +1,28 @@ Usage: cardano-cli governance action create-action create-constitution + ( --mainnet + | --testnet + ) [--conway-era] --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE Create a constitution. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --conway-era Specify the Conway era --governance-action-deposit NATURAL Deposit required to submit a governance action. @@ -19,7 +30,15 @@ Available options: Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE Filepath of the stake pool verification key. + --governance-action-tx-id TXID + Previous txid of the governance action. + --governance-action-index WORD32 + Previous tx's governance action index. + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. + --constitution-url TEXT Constitution URL. --constitution TEXT Input constitution as UTF-8 encoded text. + --constitution-url TEXT Constitution URL. --constitution-file FILE Input constitution as a text file. --out-file FILE Output filepath of the governance action. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_vote_create-vote.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_vote_create-vote.cli index a464722a1f..b25e1ab29d 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_vote_create-vote.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_vote_create-vote.cli @@ -3,7 +3,8 @@ Usage: cardano-cli governance vote create-vote (--yes | --no | --abstain) | --drep | --spo ) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) @@ -17,7 +18,10 @@ Available options: Member of the constiutional committee --drep Delegate representative --spo Stake pool operator - --tx-in TX-IN TxIn of governance action (already on chain). + --governance-action-tx-id TXID + Txid of the governance action. + --governance-action-index WORD32 + Tx's governance action index. --stake-pool-verification-key STRING Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action_create-constitution.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action_create-constitution.cli index 4ab7271e8c..cdf7ed9292 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action_create-constitution.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action_create-constitution.cli @@ -1,17 +1,28 @@ Usage: cardano-cli legacy governance action create-action create-constitution + ( --mainnet + | --testnet + ) [--conway-era] --governance-action-deposit NATURAL ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) - ( --constitution TEXT - | --constitution-file FILE + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --proposal-url TEXT + --anchor-data-hash TEXT + ( --constitution-url TEXT + --constitution TEXT + | --constitution-url TEXT + --constitution-file FILE ) --out-file FILE Create a constitution. Available options: + --mainnet Use the mainnet magic id. + --testnet Use the testnet magic id. --conway-era Specify the Conway era --governance-action-deposit NATURAL Deposit required to submit a governance action. @@ -19,7 +30,15 @@ Available options: Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE Filepath of the stake pool verification key. + --governance-action-tx-id TXID + Previous txid of the governance action. + --governance-action-index WORD32 + Previous tx's governance action index. + --proposal-url TEXT Proposal anchor URL + --anchor-data-hash TEXT Hash of anchor data. + --constitution-url TEXT Constitution URL. --constitution TEXT Input constitution as UTF-8 encoded text. + --constitution-url TEXT Constitution URL. --constitution-file FILE Input constitution as a text file. --out-file FILE Output filepath of the governance action. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_vote_create-vote.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_vote_create-vote.cli index 715d595f3b..c0f9eccd00 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_vote_create-vote.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_vote_create-vote.cli @@ -3,7 +3,8 @@ Usage: cardano-cli legacy governance vote create-vote (--yes | --no | --abstain) | --drep | --spo ) - --tx-in TX-IN + --governance-action-tx-id TXID + --governance-action-index WORD32 ( --stake-pool-verification-key STRING | --cold-verification-key-file FILE ) @@ -17,7 +18,10 @@ Available options: Member of the constiutional committee --drep Delegate representative --spo Stake pool operator - --tx-in TX-IN TxIn of governance action (already on chain). + --governance-action-tx-id TXID + Txid of the governance action. + --governance-action-index WORD32 + Tx's governance action index. --stake-pool-verification-key STRING Stake pool verification key (Bech32 or hex-encoded). --cold-verification-key-file FILE From bb00b05b314eb5a640095b10507be122b9d5a130 Mon Sep 17 00:00:00 2001 From: Samuel Leathers Date: Tue, 22 Aug 2023 21:32:42 -0400 Subject: [PATCH 5/6] fix build --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index ca9d8e44ad..203950dfd8 100644 --- a/flake.lock +++ b/flake.lock @@ -189,11 +189,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1692231735, - "narHash": "sha256-75jxGw+Mzt/2OzTz9gRb5LPwysq76JyNMBjDzMTAdXE=", + "lastModified": 1692750150, + "narHash": "sha256-PQUa3d/xx/ow5+aWAJcbo5ReSfXUUaREmv11iv/gw0I=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "7624c4239624ba595c41b81e05aa147c86cd8235", + "rev": "5bdde609b165186227df40511bc0aa43c3fee3ac", "type": "github" }, "original": { @@ -233,11 +233,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1692254824, - "narHash": "sha256-U18N6WYvVidlKBZjt61QsIK/PLccmM2Gv6BSJgr3uqE=", + "lastModified": 1692759275, + "narHash": "sha256-OuaF9FgFtXEsoqSqp7yl8fuShpgR+DmYY+jlvh7anTg=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "0ad4dcb7286ec71fbf3b90626758bf67772a408c", + "rev": "fc87a1ca9211b05267c9603752f008442db87c8b", "type": "github" }, "original": { @@ -654,11 +654,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1692230916, - "narHash": "sha256-Mm1nPNVgZl8Rdcs/A1cliBQTlzqx1Wv1tMjr9zEwlCE=", + "lastModified": 1692749313, + "narHash": "sha256-gBe4uaEOoem6GwL2iN2v4oy4kts6GbQFbg2J9fkcgqs=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "cfbafab66ac72fd00d69122d95491fdb78c57b78", + "rev": "347b8f075d0bfc69b4a88fe0bd2f0f0a1b2b1789", "type": "github" }, "original": { From cda202dcdfffbfa77e02371d12482b86c9b81f68 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Wed, 23 Aug 2023 14:31:30 -0400 Subject: [PATCH 6/6] Invalidate cabal cache --- .github/workflows/haskell.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index b1f695e6b4..8386d28fc3 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -20,7 +20,7 @@ jobs: env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2023-08-14" + CABAL_CACHE_VERSION: "2023-08-23" concurrency: group: >