pepper-project / pequin

A system for verifying outsourced computations, and applying SNARKs. Simplified release of the main Pepper codebase.
Other
122 stars 46 forks source link

AssignmentStatement.allowBigConstraints Not Used in ZCC.java #7

Open wrv opened 6 years ago

wrv commented 6 years ago

Looking at the frontend code in compiler/frontend/src/zcc/ZCC.java, AssignmentStatement.allowBigConstraints gets assigned, but does not seem to get used anywhere.

What is the intended purpose of this parameter?

maxhowald commented 6 years ago

The original purpose of that flag was to allow the compiler to perform optimizations which decrease number of constraints, but increase size of those constraints.

As you have observed though, it isn't actually used anywhere! This is just an educated guess, but it is probably never necessary or worth it to make this trade-off (more numerous but smaller constraints), which is why it never got implemented.

wrv commented 6 years ago

What are the constraints that are referred to here? What does it mean to increase the size of the constraints?

maxhowald commented 6 years ago

"Constraints" refers to the representation of a verifiable computation as a set of equations in a form suitable for use with the back-end cryptographic protocol. Sometimes this is referred to as a circuit representation, but constraints are a bit more general than circuits.

A larger constraint is a constraint which contains more variables or terms than another.

For example, x1 * x2 + x3 = 0 is larger than x1 + x2 = 0.

maxhowald commented 6 years ago

See also section 2.2 in this paper: https://eprint.iacr.org/2012/622.pdf (specifically the paragraph titled Computations and constraints) for an intro to how computations are represented as constraints.