IntersectMBO / cardano-ledger

The ledger implementation and specifications of the Cardano blockchain.
Apache License 2.0
257 stars 158 forks source link

Revisit the unlawful FromJSON CostModels instance #2796

Closed JaredCorduan closed 7 months ago

JaredCorduan commented 2 years ago

In #2792 we changed the FromJSON CostModels instance to translate the legacy Plutus V1 cost model parameter names to the current ones, thus keeping the Alonzo genesis file unchanged. The ToJSON instance was unchanged. This means that there are cost model params cmps where (fromJSON . toJSON) cmps =/= cmps.

We could change the Alonzo genesis config if we wanted to, but this comes with it's own set of troubles. (ie, we could use a list of integers, as the CBOR instances do, and fill in the keys on deserialization).

We could also remove the validation from JSON instances, and provide translation tools and validation tools.

Maybe there are other options?

lehins commented 7 months ago

This was fixed in #3367 and improved further in #3954