File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
eras/alonzo/impl/src/Cardano/Ledger/Alonzo
src/Cardano/Ledger/Plutus Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ instance FromJSON AlonzoExtraConfig where
112112 parseJSON = Aeson. withObject " Extra Config" $ \ o ->
113113 o .:? " costModels" >>= \ case
114114 Nothing -> pure $ AlonzoExtraConfig Nothing
115- Just val -> AlonzoExtraConfig . Just <$> parseCostModels True val
115+ Just val -> AlonzoExtraConfig . Just <$> parseCostModels True [] val
116116
117117instance ToJSON AlonzoExtraConfig where
118118 toJSON (AlonzoExtraConfig cms) = Aeson. object [" costModels" .= cms]
@@ -221,7 +221,7 @@ instance ToCBOR AlonzoGenesis where
221221instance FromJSON AlonzoGenesis where
222222 parseJSON = Aeson. withObject " Alonzo Genesis" $ \ o -> do
223223 agCoinsPerUTxOWord <- o .: " lovelacePerUTxOWord"
224- cms <- parseCostModels False =<< o .: " costModels"
224+ cms <- parseCostModels False [ PlutusV1 ] =<< o .: " costModels"
225225 agPrices <- o .: " executionPrices"
226226 agMaxTxExUnits <- o .: " maxTxExUnits"
227227 agMaxBlockExUnits <- o .: " maxBlockExUnits"
Original file line number Diff line number Diff line change 22
33## 1.19.0.0
44
5+ * Changed type of ` parseCostModels ` by adding ` [Language] ` argument
56* Add ` cddl ` sub-library.
67* Limit ` DecCBORGroup ` decoding of ` ProtVer ` fields to ` Word32 ` starting from protocol version ` 12 `
78* Change ` Relation ` type to only be visible at the type level
Original file line number Diff line number Diff line change @@ -134,17 +134,24 @@ instance NFData CostModel where
134134 rnf (CostModel lang cm ectx) = lang `deepseq` cm `deepseq` rnf ectx
135135
136136instance FromJSON CostModels where
137- parseJSON = parseCostModels True
137+ parseJSON = parseCostModels True []
138138
139139parseCostModels ::
140140 -- | Do not restrict number of parameters to the initial count and allow parsing of cost models
141141 -- for unknown plutus versions.
142142 Bool ->
143+ -- | Restrict parsable Plutus language versions to the given list.
144+ -- If left empty, no restrictions are applied and all non-native languages
145+ -- are parsed.
146+ [Language ] ->
143147 Value ->
144148 Parser CostModels
145- parseCostModels isLenient =
149+ parseCostModels isLenient languages =
146150 withObject " CostModels" $ \ o -> do
147- cms <- mapM (parseCostModel isLenient o) nonNativeLanguages
151+ cms <-
152+ if null languages
153+ then mapM (parseCostModel isLenient o) nonNativeLanguages
154+ else mapM (parseCostModel isLenient o) languages
148155 let cmsMap = Map. fromList [(cmLanguage cm, cm) | Just cm <- cms]
149156 unknownCostModels <-
150157 if isLenient
You can’t perform that action at this time.
0 commit comments