zcash / halo2

The Halo2 zero-knowledge proving system
https://zcash.github.io/halo2/
Other
743 stars 499 forks source link

Enable Layouter to assign loose cells #160

Open str4d opened 3 years ago

str4d commented 3 years ago

Layouter currently only exposes an assign_region function, inside which we respect relative offsets. But there are cases where a circuit doesn't care about relative offsets and just needs to assign a value somewhere into a column. We could use a single-cell region for this, but that becomes very expensive in the layouter.

Instead, we should allow "loose cells" to be allocated directly by the layouter. These cells would specify a column, but not a row. The layouter could then lay out the normal regions, and fill in the holes in the circuit with the loose cells.

Note that these loose cells can't be used in gates with any relative offsets, even "no offset". That is, to assign several cells on the same row, a region is required.

daira commented 3 years ago

I don't think the case where you only want to assign a single cell is going to be very common (if it happens at all). The case where you want to use several cells in a single row (with zero row offset), OTOH, is going to be very common, since that includes Standard PLONK gates.