privacy-scaling-explorations / chiquito

DSL for Halo2 circuits
https://docs.pecadorplonkish.xyz/
161 stars 36 forks source link

Refactor wit_gen::TraceGenerator into a trait #251

Closed leolara closed 3 weeks ago

leolara commented 1 month ago

The responsability of plonkish::ir::AssignmentGenerator is to convert from wit_get::TraceWitness to plonkish::ir::Assignments.

Currently AssignmentGenerator gets injected a wit_gen::TraceGenerator. But in cases where TraceGenerator is not adecuate a empty one is passed and generate_with_witness is called instead of generate.

This smells like there is a uncovered polymorfism in TraceGenerator. The current implementation only is useful in some situations and in others a different one would be better.

I think the best solution would be to convert TraceGenerator into a trait, and parametrize AssignmentGenerator by it. Then we could have different implementations of TraceGenerator, the current one and others for the case that generate_with_witness is called. Then generate_with_witness does not have to be public anymore.

alxkzmn commented 3 weeks ago

implemented in #257