Ethan-000 / halo2_backend

Apache License 2.0
37 stars 11 forks source link

Map Witnesses to Assigned Cells (for instance values & permutations) #16

Closed jp4g closed 1 year ago

jp4g commented 1 year ago

BTreeMap of Witness to a vector of AssignedCell structs.

For public IO: If noir circuit has public inputs and/or return values add a single instance column. At end of proof synthesis iterate through public inputs/ outputs and constrain values to be instance values. Use index of public inputs (then num public inputs + index of public output) to determine row of instance column to assign

For equality constraints: Idea WIP - when assigning advice, check if witness already has cell assignment. If assignments >= 1 constrain current assignment to be equal to previously assigned cell instead of assigning witness from OpCode

jp4g commented 1 year ago

25 implements described assignment map for the PSE fork for all main_gate constraints. Needs some tweaking for PSE ECC chip compatibility but will be very quick. Such a construction will quickly port over to the zcash_halo2 backend.

Axiom's use of contexts abstracts witness assignment to a point where further considerations are required to do correctly,

Also, will switch from mapping witness indices to a vector of assigned cells to mapping to the latest assigned cell to minimize cost profile in a cleanup branch for the PSE fork