Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit ToJSON/FromJSON conversions for costing types #5945

Open
kwxm opened this issue May 2, 2024 · 0 comments
Open

Explicit ToJSON/FromJSON conversions for costing types #5945

kwxm opened this issue May 2, 2024 · 0 comments
Labels
Costing Anything relating to costs, fees, gas, etc. Internal status: triaged

Comments

@kwxm
Copy link
Contributor

kwxm commented May 2, 2024

We need to be able to convert our costing types to and from JSON, for example so that we can read cost models from JSON configuration files. Currently all of this is done using Aeson's FromJSON and ToJSON classes, and the instances are all automatically derived, which involves automatically generating JSON tags from constructor names. This is convenient in some ways, but not in others. For example, if we generalise a costing function type then the names of the tags may change and we'll no longer be able to read in old configuration files: see this Note. To maintain compatibility with the Alonzo genesis file we've had to retain at least one old type that's been subsumed by a newer more general type. If we had explicit JSON conversions then we'd be able to convert JSON data with the old tag into objects of the new type and remove the old type again. We'd need a lot of code for explicit conversions, but that would probably be justified by the extra flexibility.

[Radical alternative: do away with JSON altogether and use some other textual format.]

@kwxm kwxm added Costing Anything relating to costs, fees, gas, etc. status: triaged Internal labels May 2, 2024
@github-actions github-actions bot added the status: needs triage GH issues that requires triage label May 2, 2024
@effectfully effectfully removed the status: needs triage GH issues that requires triage label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Costing Anything relating to costs, fees, gas, etc. Internal status: triaged
Projects
None yet
Development

No branches or pull requests

2 participants