scipr-lab / libsnark

C++ library for zkSNARKs
Other
1.8k stars 570 forks source link

assert(!qap_wit.coefficients_for_H[qap_wit.degree()-2].is_zero()) needed? #185

Open meilof opened 3 years ago

meilof commented 3 years ago

I am using libsnark with the Groth16 proofs, and it seems to work fine, except that in some small examples, the assertion

assert(!qap_wit.coefficients_for_H[qap_wit.degree()-2].is_zero());

in r1cs_gg_ppzksnark_prover fires. This happens in particular with a constraint system like this:

x*x=y x*y=z 0*0=z-a

I saw that some other users experienced the same error: https://github.com/pepper-project/pequin/issues/55

I was wondering if this assertion is actually needed. I quickly scanned through Groth16 and it does not seem to mention that the degree of H has to be exactly qap_wit.degree()-2 or that the input constraint systems need to satisfy some kind of property? Do you have an explanation of why this assertion is there or exactly for what kinds of constraint systems it occurs?

Thanks!