zcash / halo2

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

SynthesisError obscure errors whith copy constraints #384

Closed CPerezz closed 2 years ago

CPerezz commented 3 years ago

Hello mantainers.

Today while debugging a circuit with @therealyingtong we encountered a case that implied the usage of constraining an Advice to public inputs.

When you add region.assign_advice_from_instance(....) in your CustomConfig but you don't add the meta.enable_equality(COLUMN_INVOLVED_IN_COPY_CONSTRAINT) the MockProver fails with error:

panicked at 'called `Result::unwrap()` on an `Err` value: SynthesisError'

When indeed the error could be more specific and reflect that it's due to the fact that the copy constraints have not been enabled using meta.enable_equality in the Circuit::configure().

Maybe the error handling could be more specific and improved in that regard? Something like:

panicked at 'called `Result::unwrap()` on an `Err` value: SynthesisError(CopyConstraintsNotEnabled)'

Maybe even add a small description pointing to the meta.enable_equalty() function or something similar would be nice.

Thanks for this awesome piece of software BTW :smile:

DreamWuGit commented 3 years ago

@CPerezz maybe the issue #364 related to you 😸.

CPerezz commented 3 years ago

Hey @DreamWuGit no, I don't think so. The issue is not related to debug values inside of the CS or Cells but rather the Error not being enough expressive when the copy constraints haven't been enabled.

At least I think so.