anoma / vamp-ir

Vamp-IR is a proof-system-agnostic language for writing arithmetic circuits
https://anoma.github.io/VampIR-Book/
Apache License 2.0
156 stars 44 forks source link

Feature request: Add compile API from to build circuit from source and assignments #115

Open paulcadman opened 1 year ago

paulcadman commented 1 year ago

vamp-ir is used as a library in the taiga product. It will be used to compile and execute circuits provided from user input in transactions. Both the vamp-ir code for a circuit and its inputs will be fields on some transaction data structure rather than files in the file-system.

It would be convenient to have a vamp-ir compile API to support this use case.

As a starting off point for discussion let's consider:

compile_from_source(
        vamp_ir_source: &str,
        named_field_assignments: HashMap<String, Fp>
        field_ops: &dyn FieldOps,
        config: &Config) -> Result<Halo2Module<FP>, VampIRError>

This could be made generic on the PrimeField (and module type? - not sure I don't know rust well).

requirements / questions / comments: