Skip to content

Commit

Permalink
Fix error messages in Cardano.Api.ProtocolParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed May 24, 2022
1 parent 67f30e2 commit c4c3af2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cardano-api/src/Cardano/Api/ProtocolParameters.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,10 +1353,10 @@ toShelleyPParams ProtocolParameters {
= let (maj, minor) = protocolParamProtocolVersion
in Ledger.ProtVer maj minor
, Shelley._d = case protocolParamDecentralization of
Nothing -> error "toAlonzoPParams: Decentralization value required in Shelley era"
Nothing -> error "toShelleyPParams: Decentralization value required in Shelley era"
Just pDecentral ->
fromMaybe
(error "toAlonzoPParams: invalid Decentralization value")
(error "toShelleyPParams: invalid Decentralization value")
(Ledger.boundRational pDecentral)
, Shelley._extraEntropy = toLedgerNonce protocolParamExtraPraosEntropy
, Shelley._maxBHSize = protocolParamMaxBlockHeaderSize
Expand All @@ -1371,13 +1371,13 @@ toShelleyPParams ProtocolParameters {
, Shelley._eMax = protocolParamPoolRetireMaxEpoch
, Shelley._nOpt = protocolParamStakePoolTargetNum
, Shelley._a0 = fromMaybe
(error "toAlonzoPParams: invalid PoolPledgeInfluence value")
(error "toShelleyPParams: invalid PoolPledgeInfluence value")
(Ledger.boundRational protocolParamPoolPledgeInfluence)
, Shelley._rho = fromMaybe
(error "toAlonzoPParams: invalid MonetaryExpansion value")
(error "toShelleyPParams: invalid MonetaryExpansion value")
(Ledger.boundRational protocolParamMonetaryExpansion)
, Shelley._tau = fromMaybe
(error "toAlonzoPParams: invalid TreasuryCut value")
(error "toShelleyPParams: invalid TreasuryCut value")
(Ledger.boundRational protocolParamTreasuryCut)
}
toShelleyPParams ProtocolParameters { protocolParamMinUTxOValue = Nothing } =
Expand Down Expand Up @@ -1512,25 +1512,25 @@ toBabbagePParams ProtocolParameters {
, Babbage._eMax = protocolParamPoolRetireMaxEpoch
, Babbage._nOpt = protocolParamStakePoolTargetNum
, Babbage._a0 = fromMaybe
(error "toAlonzoPParams: invalid PoolPledgeInfluence value")
(error "toBabbagePParams: invalid PoolPledgeInfluence value")
(Ledger.boundRational protocolParamPoolPledgeInfluence)
, Babbage._rho = fromMaybe
(error "toAlonzoPParams: invalid MonetaryExpansion value")
(error "toBabbagePParams: invalid MonetaryExpansion value")
(Ledger.boundRational protocolParamMonetaryExpansion)
, Babbage._tau = fromMaybe
(error "toAlonzoPParams: invalid TreasuryCut value")
(error "toBabbagePParams: invalid TreasuryCut value")
(Ledger.boundRational protocolParamTreasuryCut)

-- New params in Babbage.
, Babbage._coinsPerUTxOByte = coinsPerUTxOWordToCoinsPerUTxOByte
(toShelleyLovelace utxoCostPerWord)

, Babbage._costmdls = either
(\e -> error $ "toAlonzoPParams: invalid cost models, error: " <> e)
(\e -> error $ "toBabbagePParams: invalid cost models, error: " <> e)
id
(toAlonzoCostModels protocolParamCostModels)
, Babbage._prices = fromMaybe
(error "toAlonzoPParams: invalid Price values")
(error "toBabbagePParams: invalid Price values")
(toAlonzoPrices prices)
, Babbage._maxTxExUnits = toAlonzoExUnits maxTxExUnits
, Babbage._maxBlockExUnits = toAlonzoExUnits maxBlockExUnits
Expand Down

0 comments on commit c4c3af2

Please sign in to comment.