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 c96c719cdf..c1e57fe831 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -273,7 +273,7 @@ pShelleyToAlonzoPParams = pAlonzoOnwardsPParams :: Parser (AlonzoOnwardsPParams ledgerera) pAlonzoOnwardsPParams = - AlonzoOnwardsPParams SNothing + AlonzoOnwardsPParams SNothing -- The cost models are read separately from a file, so we use 'SNothing' as the place holder here <$> convertToLedger (either (\e -> error $ "pAlonzoOnwardsPParams: " <> show e) id . toAlonzoPrices) (optional pExecutionUnitPrices) <*> convertToLedger toAlonzoExUnits (optional pMaxTxExecutionUnits) 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 23f2855817..ad51e4d1f8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -237,24 +237,20 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do <- hoistMaybe (GovernanceActionsValueUpdateProtocolParametersNotFound anyEra) $ uppPreConway eraBasedPParams' - eraBasedPParams - <- case uppCostModelsFile eraBasedPParams' of - Nothing -> pure $ uppNewPParams eraBasedPParams' - Just (Cmd.CostModelsFile alonzoOnwards costModelsFile) -> do - costModels <- firstExceptT GovernanceActionsCmdCostModelsError - $ readCostModels costModelsFile - pure . addCostModelsToEraBasedProtocolParametersUpdate alonzoOnwards costModels - $ uppNewPParams eraBasedPParams' + eraBasedPParams <- theUpdate let updateProtocolParams = createEraBasedProtocolParamUpdate sbe eraBasedPParams apiUpdateProtocolParamsType = fromLedgerPParamsUpdate sbe updateProtocolParams + genVKeys <- sequence [ firstExceptT GovernanceActionsCmdReadTextEnvelopeFileError . newExceptT $ readFileTextEnvelope (AsVerificationKey AsGenesisKey) vkeyFile | vkeyFile <- genesisVerKeys ] + let genKeyHashes = fmap verificationKeyHash genVKeys upProp = makeShelleyUpdateProposal apiUpdateProtocolParamsType genKeyHashes expEpoch + firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ writeLazyByteStringFile oFp $ textEnvelopeToJSON Nothing upProp ) @@ -267,14 +263,7 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do <- hoistMaybe (GovernanceActionsValueUpdateProtocolParametersNotFound anyEra) $ uppConwayOnwards eraBasedPParams' - eraBasedPParams - <- case uppCostModelsFile eraBasedPParams' of - Nothing -> pure $ uppNewPParams eraBasedPParams' - Just (Cmd.CostModelsFile alonzoOnwards costModelsFile) -> do - costModels <- firstExceptT GovernanceActionsCmdCostModelsError - $ readCostModels costModelsFile - pure . addCostModelsToEraBasedProtocolParametersUpdate alonzoOnwards costModels - $ uppNewPParams eraBasedPParams' + eraBasedPParams <- theUpdate returnKeyHash <- readStakeKeyHash returnAddr @@ -295,6 +284,15 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do $ writeFileTextEnvelope oFp Nothing proposalProcedure ) sbe + where + theUpdate = + case uppCostModelsFile eraBasedPParams' of + Nothing -> pure $ uppNewPParams eraBasedPParams' + Just (Cmd.CostModelsFile alonzoOnwards costModelsFile) -> do + costModels <- firstExceptT GovernanceActionsCmdCostModelsError + $ readCostModels costModelsFile + pure . addCostModelsToEraBasedProtocolParametersUpdate alonzoOnwards costModels + $ uppNewPParams eraBasedPParams' readStakeKeyHash :: VerificationKeyOrHashOrFile StakeKey -> ExceptT GovernanceActionsError IO (Hash StakeKey) readStakeKeyHash stake =