Consensys / corset

4 stars 10 forks source link

Support `JSON` for generated `bin` files #88

Closed DavePearce closed 1 month ago

DavePearce commented 1 month ago

The goal here is to support JSON output for outputting compiled constraints.

DavePearce commented 1 month ago

@powerslider FYI

DavePearce commented 1 month ago

So, there is a problem here. The field ConstraintSet.constants cannot be deserialised / serialised to JSON because it is a map from keys which are not strings (see here). This can be resolved easily by adding a conversion for Handle to string. But, it will change the normal non-JSON output as well.

One possible solution here might be to use an configuration attribute (i.e. a feature flag) so that JSON output is not supported by default. That way, the behaviour can remain the same in the default case.