-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple publics from witness trace cell in Halo2 #2522
Comments
Isn't this already enforced by your
On the lowest level, constraints are wrapping, which means that |
It's been a while, but my understanding of the Halo2 API is that there are special "instance columns" (which I think would be of a length equal to the number of publics and is a polynomial that's interpolated by the verifier) that has a cell for each public and can participate in copy constraints. On the other hand, the Plonky3 API (which is what we want to adopt, see #1633) is that a public is just a scalar known at proof & verification time that can appear in any constraint. To my knowledge, that's not supported in Halo2 (but please double-check!): Publics are always tied to specific instance column cells via copy constraints. Copy constraints only connect two cells, and which cells must be known at compile time. To emulate this semantics in Halo2, one way would be to:
This way, Obviously, this is quite costly (commits to the value N times instead of once, adding a new column for each public), so if there is a better way, we should do this :) But it's also not prohibitive if we assume that the number of publics are fairly low compared to the number of columns we have anyways.
I don't quite understand this.
Actually, not anymore! I changed it to use rotations (which is cheaper) some time ago, see this code. |
After reviewing our Halo2 backend code, I noticed that we currently expose publics by copy-constraining trace cells in witness to public values in the single instance column using
constrain_instance
: https://github.com/powdr-labs/powdr/blob/main/backend/src/halo2/circuit_builder.rs#L483-L498.To decouple publics from witness trace cell in Halo2, we would need to create witness columns (advice) in the Halo2 backend and:
advice_column.cur() - public_reference_value = 0
I think @georgwiese mentioned that we additionally need to enforce that the witness column has the same value in all rows. I wonder if this is actually needed, since we can just pass in each public reference value to the first row of a created advice column? Another related question is why we needed a separate advice column for each public value? Is this because we don't know the degree of the circuit and therefore have to only put one value in each column?
Another thing I'm confused about is the "enforce_wrapping" constraint (https://github.com/powdr-labs/powdr/blob/main/backend/src/halo2/circuit_builder.rs#L267-L284). I wonder why this is needed?
The text was updated successfully, but these errors were encountered: