-
Notifications
You must be signed in to change notification settings - Fork 129
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
fix!: correct the compile_circuit
#320
Conversation
halo2_proofs/src/plonk.rs
Outdated
#[cfg(feature = "circuit-params")] params: ConcreteCircuit::Params, | ||
) -> io::Result<VerifyingKey<C>> | ||
where | ||
C::Scalar: SerdePrimeField + FromUniformBytes<64>, | ||
{ | ||
let (_, cs, _) = compile_circuit_cs::<_, ConcreteCircuit>( | ||
compress_selectors, | ||
let (_, cs) = compile_circuit_cs::<_, ConcreteCircuit>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a detail here that I don't understand. With this change the cs
we get here has selector columns (they have not yet been converted to fixed columns).
Then afterwards we convert the ConstraintSystem
into ConstraintSystemMid
. In that conversion we're converting Expression
into ExpressionMid
, and if the Expression
has a selector it will panic:
Expression::Selector(_) => unreachable!(), |
So I think that calling vk_read
or pk_read
for a circuit that uses Selector
s will panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't think so.
The pk_read
& vk_read
are utilities to read the keys that were already compiled & stored somewhere.
In other word, the keys include the info of fixed
columns converted from Selector
s, not Selector
s.
I think this is showing a big problem we have, we don't have enough unit tests, and the real tests that we have are examples but they are not run via github actions. I think we should run the examples as check via github actions for every PR. |
Yes, I agree. @ed255 |
compile_circuit_cs
compile_circuit
Close this PR in favor of #322 . |
Description
Correct the logic of converting selectors to fixed columns in
compile_circuit
Related issues
Changes
compile_circuit
add the logic of considering the
selectors_poly
when computingfixed
columnsContext
If you try to run the
shuffle
example in currentmain
branch, you can find that it is failing here.The reason is that there is tiny error in the implementation converting selectors to fixed column, in
compile_circuit
. This PR resolves this issue.