From 5140294a1228a30e8881c3b0527aea2c295f5907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Fri, 6 Oct 2023 15:21:49 +0200 Subject: [PATCH 1/2] rename create-new-committee to update-commitee in Haskell files --- .../EraBased/Commands/Governance/Actions.hs | 34 +++++++++---------- .../EraBased/Options/Governance/Actions.hs | 20 +++++------ .../CLI/EraBased/Run/Governance/Actions.hs | 6 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) 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 617f106d8d..03bae312b3 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -5,7 +5,7 @@ module Cardano.CLI.EraBased.Commands.Governance.Actions ( AnyStakeIdentifier(..) , GovernanceActionCmds(..) - , NewCommitteeCmd(..) + , UpdateCommitteeCmd(..) , NewConstitutionCmd(..) , NewInfoCmd(..) , NoConfidenceCmd(..) @@ -27,9 +27,9 @@ data GovernanceActionCmds era = GovernanceActionCreateConstitutionCmd (ConwayEraOnwards era) NewConstitutionCmd - | GoveranceActionCreateNewCommitteeCmd + | GoveranceActionUpdateCommitteeCmd (ConwayEraOnwards era) - NewCommitteeCmd + UpdateCommitteeCmd | GovernanceActionCreateNoConfidenceCmd (ConwayEraOnwards era) NoConfidenceCmd @@ -47,18 +47,18 @@ data GovernanceActionCmds era NewInfoCmd deriving Show -data NewCommitteeCmd - = NewCommitteeCmd - { ebNetwork :: Ledger.Network - , ebDeposit :: Lovelace - , ebReturnAddress :: AnyStakeIdentifier - , ebProposalUrl :: ProposalUrl - , ebProposalHashSource :: ProposalHashSource - , ebOldCommittee :: [VerificationKeyOrHashOrFile CommitteeColdKey] - , ebNewCommittee :: [(VerificationKeyOrHashOrFile CommitteeColdKey, EpochNo)] - , ebRequiredQuorum :: Rational - , ebPreviousGovActionId :: Maybe (TxId, Word32) - , ebFilePath :: File () Out +data UpdateCommitteeCmd + = UpdateCommitteeCmd + { ucNetwork :: Ledger.Network + , ucDeposit :: Lovelace + , ucReturnAddress :: AnyStakeIdentifier + , ucProposalUrl :: ProposalUrl + , ucProposalHashSource :: ProposalHashSource + , ucOldCommittee :: [VerificationKeyOrHashOrFile CommitteeColdKey] + , ucNewCommittee :: [(VerificationKeyOrHashOrFile CommitteeColdKey, EpochNo)] + , ucRequiredQuorum :: Rational + , ucPreviousGovActionId :: Maybe (TxId, Word32) + , ucFilePath :: File () Out } deriving Show data NewConstitutionCmd @@ -119,8 +119,8 @@ renderGovernanceActionCmds = ("governance action " <>) . \case GovernanceActionTreasuryWithdrawalCmd {} -> "create-treasury-withdrawal" - GoveranceActionCreateNewCommitteeCmd {} -> - "create-new-committee" + GoveranceActionUpdateCommitteeCmd {} -> + "update-committee" GovernanceActionCreateNoConfidenceCmd {} -> "create-no-confidence" 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 58330a4d55..2d000c2993 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -32,7 +32,7 @@ pGovernanceActionCmds era = ] ) [ pGovernanceActionNewConstitutionCmd era - , pGovernanceActionNewCommitteeCmd era + , pGovernanceActionUpdateCommitteeCmd era , pGovernanceActionNewInfoCmd era , pGovernanceActionNoConfidenceCmd era , pGovernanceActionProtocolParametersUpdateCmd era @@ -81,22 +81,22 @@ pGovernanceActionNewConstitutionCmd era = do ) $ Opt.progDesc "Create a constitution." -pGovernanceActionNewCommitteeCmd +pGovernanceActionUpdateCommitteeCmd :: CardanoEra era -> Maybe (Parser (GovernanceActionCmds era)) -pGovernanceActionNewCommitteeCmd era = do +pGovernanceActionUpdateCommitteeCmd era = do cOn <- forEraMaybeEon era pure - $ subParser "create-new-committee" + $ subParser "update-committee" $ Opt.info - ( GoveranceActionCreateNewCommitteeCmd cOn - <$> pNewCommitteeCmd + ( GoveranceActionUpdateCommitteeCmd cOn + <$> pUpdateCommitteeCmd ) - $ Opt.progDesc "Create a new committee proposal." + $ Opt.progDesc "Create or update a new committee proposal." -pNewCommitteeCmd :: Parser NewCommitteeCmd -pNewCommitteeCmd = - NewCommitteeCmd +pUpdateCommitteeCmd :: Parser UpdateCommitteeCmd +pUpdateCommitteeCmd = + UpdateCommitteeCmd <$> pNetwork <*> pGovActionDeposit <*> pAnyStakeIdentifier Nothing 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 199fa23930..e303d63a3c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -40,7 +40,7 @@ runGovernanceActionCmds = \case GovernanceActionTreasuryWithdrawalCmd cOn treasuryWithdrawal -> runGovernanceActionTreasuryWithdrawalCmd cOn treasuryWithdrawal - GoveranceActionCreateNewCommitteeCmd con newCommittee -> + GoveranceActionUpdateCommitteeCmd con newCommittee -> runGovernanceActionCreateNewCommitteeCmd con newCommittee GovernanceActionCreateNoConfidenceCmd cOn noConfidence -> @@ -136,9 +136,9 @@ runGovernanceActionCreateConstitutionCmd cOn (NewConstitutionCmd network deposit -- with the new ledger types runGovernanceActionCreateNewCommitteeCmd :: ConwayEraOnwards era - -> NewCommitteeCmd + -> UpdateCommitteeCmd -> ExceptT GovernanceActionsError IO () -runGovernanceActionCreateNewCommitteeCmd cOn (NewCommitteeCmd network deposit retAddr proposalUrl proposalHashSource old new q prevActId oFp) = do +runGovernanceActionCreateNewCommitteeCmd cOn (UpdateCommitteeCmd network deposit retAddr proposalUrl proposalHashSource old new q prevActId oFp) = do let sbe = conwayEraOnwardsToShelleyBasedEra cOn -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards govActIdentifier = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> prevActId quorumRational = toRational q From 7b2bc45ad43684cbb5cd922d943c7b1c0d12dc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Fri, 6 Oct 2023 15:23:02 +0200 Subject: [PATCH 2/2] Adapt golden files --- .../cardano-cli-golden/files/golden/help.cli | 66 +++++++++---------- .../golden/help/conway_governance_action.cli | 4 +- ...ay_governance_action_update-committee.cli} | 64 +++++++++--------- 3 files changed, 67 insertions(+), 67 deletions(-) rename cardano-cli/test/cardano-cli-golden/files/golden/help/{conway_governance_action_create-new-committee.cli => conway_governance_action_update-committee.cli} (52%) 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 72c2386611..b3560a874b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -6278,7 +6278,7 @@ Usage: cardano-cli conway governance query committee-state Usage: cardano-cli conway governance action ( create-constitution - | create-new-committee + | update-committee | create-info | create-no-confidence | create-protocol-parameters-update @@ -6315,39 +6315,39 @@ Usage: cardano-cli conway governance action create-constitution Create a constitution. -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 - | --stake-verification-key STRING - | --stake-verification-key-file FILE - | --stake-key-hash HASH - ) - --proposal-url TEXT - ( --proposal-text TEXT - | --proposal-file FILE - | --proposal-hash HASH - ) - [ --remove-cc-cold-verification-key STRING - | --remove-cc-cold-verification-key-file FILE - | --remove-cc-cold-verification-key-hash STRING - ] - [ - ( --add-cc-cold-verification-key STRING - | --add-cc-cold-verification-key-file FILE - | --add-cc-cold-verification-key-hash STRING - ) - --epoch NATURAL] - --quorum RATIONAL - [--governance-action-tx-id TXID - --governance-action-index WORD32] - --out-file FILE +Usage: cardano-cli conway governance action update-committee + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILE + | --stake-pool-id STAKE_POOL_ID + | --stake-verification-key STRING + | --stake-verification-key-file FILE + | --stake-key-hash HASH + ) + --proposal-url TEXT + ( --proposal-text TEXT + | --proposal-file FILE + | --proposal-hash HASH + ) + [ --remove-cc-cold-verification-key STRING + | --remove-cc-cold-verification-key-file FILE + | --remove-cc-cold-verification-key-hash STRING + ] + [ + ( --add-cc-cold-verification-key STRING + | --add-cc-cold-verification-key-file FILE + | --add-cc-cold-verification-key-hash STRING + ) + --epoch NATURAL] + --quorum RATIONAL + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --out-file FILE - Create a new committee proposal. + Create or update a new committee proposal. Usage: cardano-cli conway governance action create-info (--mainnet | --testnet) --governance-action-deposit NATURAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action.cli index e0bf9081a2..cf9ca37671 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action.cli @@ -1,6 +1,6 @@ Usage: cardano-cli conway governance action ( create-constitution - | create-new-committee + | update-committee | create-info | create-no-confidence | create-protocol-parameters-update @@ -14,7 +14,7 @@ Available options: Available commands: create-constitution Create a constitution. - create-new-committee Create a new committee proposal. + update-committee Create or update a new committee proposal. create-info Create an info action. create-no-confidence Create a no confidence proposal. create-protocol-parameters-update 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_update-committee.cli similarity index 52% rename from cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-new-committee.cli rename to cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_update-committee.cli index bdc5408e79..4b4eee2618 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_update-committee.cli @@ -1,36 +1,36 @@ -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 - | --stake-verification-key STRING - | --stake-verification-key-file FILE - | --stake-key-hash HASH - ) - --proposal-url TEXT - ( --proposal-text TEXT - | --proposal-file FILE - | --proposal-hash HASH - ) - [ --remove-cc-cold-verification-key STRING - | --remove-cc-cold-verification-key-file FILE - | --remove-cc-cold-verification-key-hash STRING - ] - [ - ( --add-cc-cold-verification-key STRING - | --add-cc-cold-verification-key-file FILE - | --add-cc-cold-verification-key-hash STRING - ) - --epoch NATURAL] - --quorum RATIONAL - [--governance-action-tx-id TXID - --governance-action-index WORD32] - --out-file FILE +Usage: cardano-cli conway governance action update-committee + ( --mainnet + | --testnet + ) + --governance-action-deposit NATURAL + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILE + | --stake-pool-id STAKE_POOL_ID + | --stake-verification-key STRING + | --stake-verification-key-file FILE + | --stake-key-hash HASH + ) + --proposal-url TEXT + ( --proposal-text TEXT + | --proposal-file FILE + | --proposal-hash HASH + ) + [ --remove-cc-cold-verification-key STRING + | --remove-cc-cold-verification-key-file FILE + | --remove-cc-cold-verification-key-hash STRING + ] + [ + ( --add-cc-cold-verification-key STRING + | --add-cc-cold-verification-key-file FILE + | --add-cc-cold-verification-key-hash STRING + ) + --epoch NATURAL] + --quorum RATIONAL + [--governance-action-tx-id TXID + --governance-action-index WORD32] + --out-file FILE - Create a new committee proposal. + Create or update a new committee proposal. Available options: --mainnet Use the mainnet magic id.