diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs index 8b2eb74c6f..65dbc09b91 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs @@ -21,9 +21,7 @@ import Options.Applicative hiding (help, str) import qualified Options.Applicative as Opt data LegacyGovernanceCmds - = GovernanceVoteCmd VoteCmd - | GovernanceActionCmd ActionCmd - | GovernanceMIRPayStakeAddressesCertificate + = GovernanceMIRPayStakeAddressesCertificate AnyShelleyToBabbageEra MIRPot [StakeAddress] @@ -62,8 +60,6 @@ data LegacyGovernanceCmds renderLegacyGovernanceCmds :: LegacyGovernanceCmds -> Text renderLegacyGovernanceCmds = \case - GovernanceVoteCmd {} -> "governance vote" - GovernanceActionCmd {} -> "governance action" GovernanceGenesisKeyDelegationCertificate {} -> "governance create-genesis-key-delegation-certificate" GovernanceMIRPayStakeAddressesCertificate {} -> "governance create-mir-certificate stake-addresses" GovernanceMIRTransfer _ _ _ TransferToTreasury -> "governance create-mir-certificate transfer-to-treasury" diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index a354fe953e..6c9c00ac1e 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -1014,12 +1014,6 @@ pGovernanceCmds envCli = , subParser "verify-poll" $ Opt.info pGovernanceVerifyPoll $ Opt.progDesc "Verify an answer to a given SPO poll" - , fmap GovernanceVoteCmd $ subParser "vote" - $ Opt.info (pVoteCommmands envCli) - $ Opt.progDesc "Vote related commands." - , fmap GovernanceActionCmd $ subParser "action" - $ Opt.info (pActionCommmands envCli) - $ Opt.progDesc "Governance action related commands." ] where mirCertParsers :: Parser LegacyGovernanceCmds diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs index b41f86a4fc..7e4f1e05a7 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs @@ -18,9 +18,7 @@ import Cardano.CLI.Legacy.Commands.Governance import Cardano.CLI.Read import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.GovernanceCmdError -import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key -import qualified Cardano.Ledger.Conway.Governance as Ledger import Control.Monad import Control.Monad.IO.Class @@ -28,7 +26,6 @@ import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except (ExceptT) import Control.Monad.Trans.Except.Extra import Data.Aeson (eitherDecode) -import Data.Bifunctor import qualified Data.ByteString.Char8 as BSC import qualified Data.ByteString.Lazy as LB import Data.Function ((&)) @@ -38,16 +35,11 @@ import qualified Data.Text as Text import qualified Data.Text.Encoding as Text import qualified Data.Text.IO as Text import qualified Data.Text.Read as Text -import Data.Word import qualified System.IO as IO import System.IO (stderr, stdin, stdout) runLegacyGovernanceCmds :: LegacyGovernanceCmds -> ExceptT GovernanceCmdError IO () runLegacyGovernanceCmds = \case - GovernanceVoteCmd (CreateVoteCmd (ConwayVote voteChoice voteType govActTcIn voteStakeCred sbe fp)) -> - runLegacyGovernanceCreateVoteCmd sbe voteChoice voteType govActTcIn voteStakeCred fp - GovernanceActionCmd (CreateConstitution network sbe deposit voteStakeCred mPrevGovActId proposalUrl proposalHashSource constitutionUrl constitutionHashSource fp) -> - runLegacyGovernanceNewConstitutionCmd network sbe deposit voteStakeCred mPrevGovActId proposalUrl proposalHashSource constitutionUrl constitutionHashSource fp GovernanceMIRPayStakeAddressesCertificate anyEra mirpot vKeys rewards out -> runLegacyGovernanceMIRCertificatePayStakeAddrs anyEra mirpot vKeys rewards out GovernanceMIRTransfer anyEra amt out direction -> do @@ -63,77 +55,6 @@ runLegacyGovernanceCmds = \case GovernanceVerifyPoll poll metadata mOutFile -> runLegacyGovernanceVerifyPoll poll metadata mOutFile -runLegacyGovernanceCreateVoteCmd :: () - => AnyShelleyBasedEra - -> Vote - -> VType - -> (TxId, Word32) - -> VerificationKeyOrFile StakePoolKey - -> VoteFile Out - -> ExceptT GovernanceCmdError IO () -runLegacyGovernanceCreateVoteCmd anyEra vChoice vType (govActionTxId, govActionIndex) votingStakeCred oFp = do - AnyShelleyBasedEra sbe <- pure anyEra - - shelleyBasedEraConstraints sbe $ do - vStakePoolKey <- firstExceptT ReadFileError . newExceptT $ readVerificationKeyOrFile AsStakePoolKey votingStakeCred - let stakePoolKeyHash = verificationKeyHash vStakePoolKey - vStakeCred = StakeCredentialByKey . (verificationKeyHash . castVerificationKey) $ vStakePoolKey - case vType of - VCC -> do - votingCred <- hoistEither $ first VotingCredentialDecodeGovCmdEror $ toVotingCredential sbe vStakeCred - let voter = Ledger.CommitteeVoter (Ledger.coerceKeyRole (unVotingCredential votingCred)) -- TODO Conway - remove coerceKeyRole - govActIdentifier = createGovernanceActionId govActionTxId govActionIndex - voteProcedure = createVotingProcedure sbe vChoice Nothing - votingProcedures = singletonVotingProcedures sbe voter govActIdentifier (unVotingProcedure voteProcedure) - firstExceptT WriteFileError . newExceptT $ writeFileTextEnvelope oFp Nothing votingProcedures - - VDR -> do - votingCred <- hoistEither $ first VotingCredentialDecodeGovCmdEror $ toVotingCredential sbe vStakeCred - let voter = Ledger.DRepVoter (unVotingCredential votingCred) - govActIdentifier = createGovernanceActionId govActionTxId govActionIndex - voteProcedure = createVotingProcedure sbe vChoice Nothing - votingProcedures = singletonVotingProcedures sbe voter govActIdentifier (unVotingProcedure voteProcedure) - firstExceptT WriteFileError . newExceptT $ writeFileTextEnvelope oFp Nothing votingProcedures - - VSP -> do - let voter = Ledger.StakePoolVoter (unStakePoolKeyHash stakePoolKeyHash) - govActIdentifier = createGovernanceActionId govActionTxId govActionIndex - voteProcedure = createVotingProcedure sbe vChoice Nothing - votingProcedures = singletonVotingProcedures sbe voter govActIdentifier (unVotingProcedure voteProcedure) - firstExceptT WriteFileError . newExceptT $ writeFileTextEnvelope oFp Nothing votingProcedures - -runLegacyGovernanceNewConstitutionCmd :: () - => Ledger.Network - -> AnyShelleyBasedEra - -> Lovelace - -> VerificationKeyOrFile StakePoolKey - -> Maybe (TxId, Word32) - -> ProposalUrl - -> ProposalHashSource - -> ConstitutionUrl - -> ConstitutionHashSource - -> File ConstitutionText Out - -> ExceptT GovernanceCmdError IO () -runLegacyGovernanceNewConstitutionCmd network sbe deposit stakeVoteCred mPrevGovAct proposalUrl proposalHashSource constitutionUrl constitutionHashSource oFp = do - vStakePoolKeyHash - <- fmap (verificationKeyHash . castVerificationKey) - <$> firstExceptT ReadFileError . newExceptT - $ readVerificationKeyOrFile AsStakePoolKey stakeVoteCred - - constitutionHash <- - constitutionHashSourceToHash constitutionHashSource - & firstExceptT GovernanceCmdConstitutionError - - let constitutionAnchor = Ledger.Anchor - { Ledger.anchorUrl = unConstitutionUrl constitutionUrl - , Ledger.anchorDataHash = constitutionHash - } - - let prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovAct - let govAct = ProposeNewConstitution prevGovActId constitutionAnchor - - runLegacyGovernanceCreateActionCmd network sbe deposit vStakePoolKeyHash proposalUrl proposalHashSource govAct oFp - runLegacyGovernanceMIRCertificatePayStakeAddrs :: AnyShelleyToBabbageEra -> Ledger.MIRPot @@ -153,34 +74,6 @@ runLegacyGovernanceMIRCertificateTransfer runLegacyGovernanceMIRCertificateTransfer (AnyShelleyToBabbageEra w) = runGovernanceMIRCertificateTransfer w -runLegacyGovernanceCreateActionCmd - :: Ledger.Network - -> AnyShelleyBasedEra - -> Lovelace - -> Hash StakeKey - -> ProposalUrl - -> ProposalHashSource - -> GovernanceAction - -> File a Out - -> ExceptT GovernanceCmdError IO () -runLegacyGovernanceCreateActionCmd network anyEra deposit depositReturnAddr proposalUrl proposalHashSource govAction oFp = do - AnyShelleyBasedEra sbe <- pure anyEra - - proposalHash <- - proposalHashSourceToHash proposalHashSource - & firstExceptT GovernanceCmdProposalError - - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash - } - - let proposal = createProposalProcedure sbe network deposit depositReturnAddr govAction proposalAnchor - - firstExceptT WriteFileError . newExceptT - $ shelleyBasedEraConstraints sbe - $ writeFileTextEnvelope oFp Nothing proposal - runLegacyGovernanceGenesisKeyDelegationCertificate :: AnyShelleyBasedEra -> VerificationKeyOrHashOrFile GenesisKey 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 e685bc4b92..ba071d853b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -1259,8 +1259,6 @@ Usage: cardano-cli legacy governance | create-poll | answer-poll | verify-poll - | vote - | action ) Governance commands @@ -1406,58 +1404,6 @@ Usage: cardano-cli legacy governance verify-poll --poll-file FILE Verify an answer to a given SPO poll -Usage: cardano-cli legacy governance vote create-vote - - Vote related commands. - -Usage: cardano-cli legacy governance vote create-vote (--yes | --no | --abstain) - ( --constitutional-committee-member - | --drep - | --spo - ) - --governance-action-tx-id TXID - --governance-action-index WORD32 - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - ) - [--conway-era] - --out-file FILE - - Create a vote for a proposed governance action. - -Usage: cardano-cli legacy governance action create-action - - Governance action related commands. - -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 - ) - [--governance-action-tx-id TXID - --governance-action-index WORD32] - --proposal-url TEXT - ( --proposal-text TEXT - | --proposal-file FILE - | --proposal-hash HASH - ) - --constitution-url TEXT - ( --constitution-text TEXT - | --constitution-file FILE - | --constitution-hash HASH - ) - --out-file FILE - - Create a constitution. - Usage: cardano-cli legacy genesis ( key-gen-genesis | key-gen-delegate @@ -2628,8 +2574,6 @@ Usage: cardano-cli governance | create-poll | answer-poll | verify-poll - | vote - | action ) Governance commands @@ -2775,58 +2719,6 @@ Usage: cardano-cli governance verify-poll --poll-file FILE Verify an answer to a given SPO poll -Usage: cardano-cli governance vote create-vote - - Vote related commands. - -Usage: cardano-cli governance vote create-vote (--yes | --no | --abstain) - ( --constitutional-committee-member - | --drep - | --spo - ) - --governance-action-tx-id TXID - --governance-action-index WORD32 - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - ) - [--conway-era] - --out-file FILE - - Create a vote for a proposed governance action. - -Usage: cardano-cli governance action create-action - - Governance action related commands. - -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 - ) - [--governance-action-tx-id TXID - --governance-action-index WORD32] - --proposal-url TEXT - ( --proposal-text TEXT - | --proposal-file FILE - | --proposal-hash HASH - ) - --constitution-url TEXT - ( --constitution-text TEXT - | --constitution-file FILE - | --constitution-hash HASH - ) - --out-file FILE - - Create a constitution. - Usage: cardano-cli genesis ( key-gen-genesis | key-gen-delegate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance.cli index 22ef6d26f5..d06eba4ede 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance.cli @@ -5,8 +5,6 @@ Usage: cardano-cli governance | create-poll | answer-poll | verify-poll - | vote - | action ) Governance commands @@ -23,5 +21,3 @@ Available commands: create-poll Create an SPO poll answer-poll Answer an SPO poll verify-poll Verify an answer to a given SPO poll - vote Vote related commands. - action Governance action related commands. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action.cli deleted file mode 100644 index 6664cf5900..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action.cli +++ /dev/null @@ -1,9 +0,0 @@ -Usage: cardano-cli governance action create-action create-constitution - - Create a governance action. - -Available options: - -h,--help Show this help text - -Available commands: - create-constitution Create a constitution. 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 deleted file mode 100644 index 54fa085060..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_action_create-action_create-constitution.cli +++ /dev/null @@ -1,49 +0,0 @@ -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 - ) - [--governance-action-tx-id TXID - --governance-action-index WORD32] - --proposal-url TEXT - ( --proposal-text TEXT - | --proposal-file FILE - | --proposal-hash HASH - ) - --constitution-url TEXT - ( --constitution-text TEXT - | --constitution-file FILE - | --constitution-hash HASH - ) - --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. - --stake-pool-verification-key STRING - 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 - --proposal-text TEXT Input proposal as UTF-8 encoded text. - --proposal-file FILE Input proposal as a text file. - --proposal-hash HASH Proposal anchor data hash. - --constitution-url TEXT Constitution URL. - --constitution-text TEXT Input constitution as UTF-8 encoded text. - --constitution-file FILE Input constitution as a text file. - --constitution-hash HASH Constitution anchor data hash. - --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 deleted file mode 100644 index b25e1ab29d..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_vote_create-vote.cli +++ /dev/null @@ -1,31 +0,0 @@ -Usage: cardano-cli governance vote create-vote (--yes | --no | --abstain) - ( --constitutional-committee-member - | --drep - | --spo - ) - --governance-action-tx-id TXID - --governance-action-index WORD32 - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - ) - [--conway-era] - --out-file FILE - - Create a vote for a proposed governance action. - -Available options: - --constitutional-committee-member - Member of the constiutional committee - --drep Delegate representative - --spo Stake pool operator - --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 - Filepath of the stake pool verification key. - --conway-era Specify the Conway era - --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/legacy_governance.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance.cli index 6dc23552b5..b8aa60f019 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance.cli @@ -5,8 +5,6 @@ Usage: cardano-cli legacy governance | create-poll | answer-poll | verify-poll - | vote - | action ) Governance commands @@ -23,5 +21,3 @@ Available commands: create-poll Create an SPO poll answer-poll Answer an SPO poll verify-poll Verify an answer to a given SPO poll - vote Vote related commands. - action Governance action related commands. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action.cli deleted file mode 100644 index a1f110e0db..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action.cli +++ /dev/null @@ -1,9 +0,0 @@ -Usage: cardano-cli legacy governance action create-action create-constitution - - Create a governance action. - -Available options: - -h,--help Show this help text - -Available commands: - create-constitution Create a constitution. 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 deleted file mode 100644 index a35a201378..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_action_create-action_create-constitution.cli +++ /dev/null @@ -1,49 +0,0 @@ -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 - ) - [--governance-action-tx-id TXID - --governance-action-index WORD32] - --proposal-url TEXT - ( --proposal-text TEXT - | --proposal-file FILE - | --proposal-hash HASH - ) - --constitution-url TEXT - ( --constitution-text TEXT - | --constitution-file FILE - | --constitution-hash HASH - ) - --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. - --stake-pool-verification-key STRING - 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 - --proposal-text TEXT Input proposal as UTF-8 encoded text. - --proposal-file FILE Input proposal as a text file. - --proposal-hash HASH Proposal anchor data hash. - --constitution-url TEXT Constitution URL. - --constitution-text TEXT Input constitution as UTF-8 encoded text. - --constitution-file FILE Input constitution as a text file. - --constitution-hash HASH Constitution anchor data hash. - --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 deleted file mode 100644 index c0f9eccd00..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_vote_create-vote.cli +++ /dev/null @@ -1,31 +0,0 @@ -Usage: cardano-cli legacy governance vote create-vote (--yes | --no | --abstain) - ( --constitutional-committee-member - | --drep - | --spo - ) - --governance-action-tx-id TXID - --governance-action-index WORD32 - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - ) - [--conway-era] - --out-file FILE - - Create a vote for a proposed governance action. - -Available options: - --constitutional-committee-member - Member of the constiutional committee - --drep Delegate representative - --spo Stake pool operator - --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 - Filepath of the stake pool verification key. - --conway-era Specify the Conway era - --out-file FILE Output filepath of the vote. - -h,--help Show this help text