Skip to content

Commit

Permalink
Disambiguate only governance-action-deposit (partial revert of 7617763)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhammann committed Nov 1, 2023
1 parent 4612740 commit c197965
Show file tree
Hide file tree
Showing 17 changed files with 936 additions and 991 deletions.
307 changes: 153 additions & 154 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pGovernanceActionNewInfoCmd era = do
( fmap Cmd.GovernanceActionInfoCmd $
Cmd.GovernanceActionInfoCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit Nothing
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pProposalUrl
<*> pProposalHashSource
Expand All @@ -87,7 +87,7 @@ pGovernanceActionNewConstitutionCmd era = do
( fmap Cmd.GovernanceActionCreateConstitutionCmd $
Cmd.GovernanceActionCreateConstitutionCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit Nothing
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pPreviousGovernanceAction
<*> pProposalUrl
Expand Down Expand Up @@ -117,7 +117,7 @@ pUpdateCommitteeCmd :: ()
pUpdateCommitteeCmd eon =
Cmd.GoveranceActionUpdateCommitteeCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit Nothing
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pProposalUrl
<*> pProposalHashSource
Expand All @@ -142,7 +142,7 @@ pGovernanceActionNoConfidenceCmd era = do
( fmap Cmd.GovernanceActionCreateNoConfidenceCmd $
Cmd.GovernanceActionCreateNoConfidenceCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit Nothing
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pProposalUrl
<*> pProposalHashSource
Expand Down Expand Up @@ -170,7 +170,7 @@ pUpdateProtocolParametersPostConway :: ConwayEraOnwards era -> Parser (Cmd.Updat
pUpdateProtocolParametersPostConway conwayOnwards =
Cmd.UpdateProtocolParametersConwayOnwards conwayOnwards
<$> pNetwork
<*> pGovActionDeposit Nothing
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pProposalUrl
<*> pProposalHashSource
Expand Down Expand Up @@ -215,7 +215,7 @@ pCostModelsFile =
(const $ pure Nothing)
( \alonzoOnwards ->
fmap (Cmd.CostModelsFile alonzoOnwards . File)
<$> optional (pCostModels (Just "new"))
<$> optional pCostModels
)

pGovernanceActionProtocolParametersUpdateCmd :: ()
Expand Down Expand Up @@ -248,61 +248,61 @@ mkProtocolVersionOrErr (majorProtVer, minorProtVer) =
pCommonProtocolParameters :: Parser CommonProtocolParametersUpdate
pCommonProtocolParameters =
CommonProtocolParametersUpdate
<$> convertToLedger toShelleyLovelace (optional $ pMinFeeConstantFactor $ Just "new")
<*> convertToLedger toShelleyLovelace (optional $ pMinFeePerByteFactor $ Just "new")
<*> convertToLedger id (optional $ pMaxBodySize $ Just "new")
<*> convertToLedger id (optional $ pMaxTransactionSize $ Just "new")
<*> convertToLedger id (optional $ pMaxBlockHeaderSize $ Just "new")
<*> convertToLedger toShelleyLovelace (optional $ pKeyRegistDeposit $ Just "new")
<*> convertToLedger toShelleyLovelace (optional $ pPoolDeposit $ Just "new")
<*> convertToLedger id (optional $ pEpochBoundRetirement $ Just "new")
<*> convertToLedger id (optional $ pNumberOfPools $ Just "new")
<*> convertToLedger toNonNegativeIntervalOrErr (optional $ pPoolInfluence $ Just "new")
<*> convertToLedger toUnitIntervalOrErr (optional $ pTreasuryExpansion $ Just "new")
<*> convertToLedger toUnitIntervalOrErr (optional $ pMonetaryExpansion $ Just "new")
<*> convertToLedger mkProtocolVersionOrErr (optional $ pProtocolVersion $ Just "new")
<*> convertToLedger toShelleyLovelace (optional $ pMinPoolCost $ Just "new")
<$> convertToLedger toShelleyLovelace (optional pMinFeeConstantFactor)
<*> convertToLedger toShelleyLovelace (optional pMinFeePerByteFactor)
<*> convertToLedger id (optional pMaxBodySize)
<*> convertToLedger id (optional pMaxTransactionSize)
<*> convertToLedger id (optional pMaxBlockHeaderSize)
<*> convertToLedger toShelleyLovelace (optional pKeyRegistDeposit)
<*> convertToLedger toShelleyLovelace (optional pPoolDeposit)
<*> convertToLedger id (optional pEpochBoundRetirement)
<*> convertToLedger id (optional pNumberOfPools)
<*> convertToLedger toNonNegativeIntervalOrErr (optional pPoolInfluence)
<*> convertToLedger toUnitIntervalOrErr (optional pTreasuryExpansion)
<*> convertToLedger toUnitIntervalOrErr (optional pMonetaryExpansion)
<*> convertToLedger mkProtocolVersionOrErr (optional pProtocolVersion)
<*> convertToLedger toShelleyLovelace (optional pMinPoolCost)


pDeprecatedAfterMaryPParams :: Parser (DeprecatedAfterMaryPParams ledgerera)
pDeprecatedAfterMaryPParams =
DeprecatedAfterMaryPParams
<$> convertToLedger toShelleyLovelace (optional $ pMinUTxOValue $ Just "new")
<$> convertToLedger toShelleyLovelace (optional pMinUTxOValue)

pShelleyToAlonzoPParams :: Parser (ShelleyToAlonzoPParams' ledgerera)
pShelleyToAlonzoPParams =
ShelleyToAlonzoPParams'
<$> convertToLedger id (optional $ toLedgerNonce <$> pExtraEntropy (Just "new"))
<*> convertToLedger toUnitIntervalOrErr (optional $ pDecentralParam $ Just "new")
<$> convertToLedger id (optional $ toLedgerNonce <$> pExtraEntropy)
<*> convertToLedger toUnitIntervalOrErr (optional pDecentralParam)

pAlonzoOnwardsPParams :: Parser (AlonzoOnwardsPParams ledgerera)
pAlonzoOnwardsPParams =
AlonzoOnwardsPParams SNothing
<$> convertToLedger (either (\e -> error $ "pAlonzoOnwardsPParams: " <> show e) id . toAlonzoPrices)
(optional $ pExecutionUnitPrices $ Just "new")
<*> convertToLedger toAlonzoExUnits (optional $ pMaxTxExecutionUnits $ Just "new")
<*> convertToLedger toAlonzoExUnits (optional $ pMaxBlockExecutionUnits $ Just "new")
<*> convertToLedger id (optional $ pMaxValueSize $ Just "new")
<*> convertToLedger id (optional $ pCollateralPercent $ Just "new")
<*> convertToLedger id (optional $ pMaxCollateralInputs $ Just "new")
(optional pExecutionUnitPrices)
<*> convertToLedger toAlonzoExUnits (optional pMaxTxExecutionUnits)
<*> convertToLedger toAlonzoExUnits (optional pMaxBlockExecutionUnits)
<*> convertToLedger id (optional pMaxValueSize)
<*> convertToLedger id (optional pCollateralPercent)
<*> convertToLedger id (optional pMaxCollateralInputs)


pIntroducedInBabbagePParams :: Parser (IntroducedInBabbagePParams ledgerera)
pIntroducedInBabbagePParams =
IntroducedInBabbagePParams
<$> convertToLedger (CoinPerByte . toShelleyLovelace) (optional $ pUTxOCostPerByte $ Just "new")
<$> convertToLedger (CoinPerByte . toShelleyLovelace) (optional pUTxOCostPerByte)

pIntroducedInConwayPParams :: Parser (IntroducedInConwayPParams ledgerera)
pIntroducedInConwayPParams =
IntroducedInConwayPParams
<$> convertToLedger id (optional $ pPoolVotingThresholds $ Just "new")
<*> convertToLedger id (optional $ pDRepVotingThresholds $ Just "new")
<*> convertToLedger id (optional $ pMinCommitteeSize $ Just "new")
<*> convertToLedger id (optional $ pCommitteeTermLength $ Just "new")
<*> convertToLedger id (optional $ pGovActionLifetime $ Just "new")
<*> convertToLedger toShelleyLovelace (optional $ pGovActionDeposit $ Just "new")
<*> convertToLedger toShelleyLovelace (optional $ pDRepDeposit $ Just "new")
<*> convertToLedger id (optional $ pDRepActivity $ Just "new")
<$> convertToLedger id (optional pPoolVotingThresholds)
<*> convertToLedger id (optional pDRepVotingThresholds)
<*> convertToLedger id (optional pMinCommitteeSize)
<*> convertToLedger id (optional pCommitteeTermLength)
<*> convertToLedger id (optional pGovActionLifetime)
<*> convertToLedger toShelleyLovelace (optional pNewGovActionDeposit)
<*> convertToLedger toShelleyLovelace (optional pDRepDeposit)
<*> convertToLedger id (optional pDRepActivity)

-- Not necessary in Conway era onwards
pProtocolParametersUpdateGenesisKeys :: Parser [VerificationKeyFile In]
Expand Down Expand Up @@ -353,7 +353,7 @@ pGovernanceActionTreasuryWithdrawalCmd era = do
( fmap Cmd.GovernanceActionTreasuryWithdrawalCmd $
Cmd.GovernanceActionTreasuryWithdrawalCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit Nothing
<*> pGovActionDeposit
<*> pAnyStakeIdentifier (Just "deposit-return")
<*> pProposalUrl
<*> pProposalHashSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pRegistrationCertificateCmd era = do
where
mkParser w = GovernanceDRepRegistrationCertificateCmd w
<$> pDRepVerificationKeyOrHashOrFile
<*> pKeyRegistDeposit Nothing
<*> pKeyRegistDeposit
<*> pDRepMetadata
<*> pOutputFile

Expand Down Expand Up @@ -133,7 +133,7 @@ pRetirementCertificateCmd era = do
$ Opt.info
( GovernanceDRepRetirementCertificateCmd w
<$> pDRepVerificationKeyOrHashOrFile
<*> pDrepDeposit Nothing
<*> pDrepDeposit
<*> pOutputFile
)
$ Opt.progDesc "Create a DRep retirement certificate."
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pStakeAddressRegistrationCertificateCmd era = do
$ Opt.info
( StakeAddressRegistrationCertificateCmd w
<$> pStakeIdentifier
<*> optional (pKeyRegistDeposit Nothing)
<*> optional pKeyRegistDeposit
<*> pOutputFile
)
$ Opt.progDesc "Create a stake address registration certificate"
Expand All @@ -115,7 +115,7 @@ pStakeAddressDeregistrationCertificateCmd era = do
$ Opt.info
( StakeAddressDeregistrationCertificateCmd (conwayEraOnwardsToShelleyBasedEra conwayOnwards)
<$> pStakeIdentifier
<*> fmap Just (pKeyRegistDeposit Nothing)
<*> fmap Just pKeyRegistDeposit
<*> pOutputFile
)
$ Opt.progDesc "Create a stake address deregistration certificate"
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli/src/Cardano/CLI/Legacy/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ pStakeAddressCmds envCli =
StakeAddressRegistrationCertificateCmd
<$> pAnyShelleyBasedEra envCli
<*> pStakeIdentifier
<*> optional (pKeyRegistDeposit Nothing)
<*> optional pKeyRegistDeposit
<*> pOutputFile

pStakeAddressDeregistrationCertificateCmd :: Parser LegacyStakeAddressCmds
pStakeAddressDeregistrationCertificateCmd =
StakeAddressDeregistrationCertificateCmd
<$> pAnyShelleyBasedEra envCli
<*> pStakeIdentifier
<*> optional (pKeyRegistDeposit Nothing)
<*> optional pKeyRegistDeposit
<*> pOutputFile

pStakeAddressStakeDelegationCertificateCmd :: Parser LegacyStakeAddressCmds
Expand Down Expand Up @@ -868,7 +868,7 @@ pGovernanceCmds envCli =
<*> pEpochNoUpdateProp
<*> some pGenesisVerificationKeyFile
<*> pProtocolParametersUpdate
<*> optional (pCostModels $ Just "new")
<*> optional pCostModels

pGovernanceCreatePoll :: Parser LegacyGovernanceCmds
pGovernanceCreatePoll =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ hprop_golden_conway_governance_action_create_protocol_parameters_update =
, "--stake-verification-key-file", stakeAddressVKeyFile
, "--governance-action-deposit", "12345"
, "--new-governance-action-deposit", "123454321"
, "--new-max-tx-size", "1234"
, "--new-cost-model-file", costModelsFile
, "--max-tx-size", "1234"
, "--cost-model-file", costModelsFile
, "--out-file", actionFile
]

Expand Down
51 changes: 25 additions & 26 deletions cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,28 @@ hprop_golden_view_shelley_yaml = let
void $
execCardanoCLI
[ "legacy", "governance", "create-update-proposal"
, "--decentralization-parameter", "63/64"
, "--epoch", "64"
, "--extra-entropy", extraEntropySeed
, "--genesis-verification-key-file"
, "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key"
, "--new-decentralization-parameter", "63/64"
, "--new-extra-entropy", extraEntropySeed
, "--new-key-reg-deposit-amt", "71"
, "--new-max-block-body-size", "72"
, "--new-max-block-header-size", "73"
, "--new-max-tx-size", "74"
, "--new-min-fee-constant", "75"
, "--new-min-fee-linear", "76"
, "--new-min-pool-cost", "77"
, "--new-min-utxo-value", "78"
, "--new-monetary-expansion", "79/80"
, "--new-number-of-pools", "80"
, "--new-pool-influence", "82/83"
, "--new-pool-reg-deposit", "83"
, "--new-pool-retirement-epoch-boundary", "84"
, "--new-protocol-major-version", "8"
, "--new-protocol-minor-version", "86"
, "--new-treasury-expansion", "87/88"
, "--key-reg-deposit-amt", "71"
, "--max-block-body-size", "72"
, "--max-block-header-size", "73"
, "--max-tx-size", "74"
, "--min-fee-constant", "75"
, "--min-fee-linear", "76"
, "--min-pool-cost", "77"
, "--min-utxo-value", "78"
, "--monetary-expansion", "79/80"
, "--number-of-pools", "80"
, "--out-file", updateProposalFile
, "--pool-influence", "82/83"
, "--pool-reg-deposit", "83"
, "--pool-retirement-epoch-boundary", "84"
, "--protocol-major-version", "8"
, "--protocol-minor-version", "86"
, "--treasury-expansion", "87/88"
]

-- Create transaction body
Expand Down Expand Up @@ -288,14 +288,13 @@ hprop_golden_view_alonzo_yaml =
, "--epoch", "190"
, "--genesis-verification-key-file"
, "test/cardano-cli-golden/files/input/shelley/keys/genesis_keys/verification_key"
, "--new-utxo-cost-per-word", "194"
, "--new-price-execution-steps", "195/196"
, "--new-price-execution-memory", "196/197"
, "--new-max-tx-execution-units", "(197, 198)"
, "--new-max-block-execution-units", "(198, 199)"
, "--new-max-value-size", "199"
, "--new-collateral-percent", "200"
, "--new-max-collateral-inputs", "201"
, "--price-execution-steps", "195/196"
, "--price-execution-memory", "196/197"
, "--max-tx-execution-units", "(197, 198)"
, "--max-block-execution-units", "(198, 199)"
, "--max-value-size", "199"
, "--collateral-percent", "200"
, "--max-collateral-inputs", "201"
, "--out-file", updateProposalFile
]

Expand Down
Loading

0 comments on commit c197965

Please sign in to comment.