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

WARNING: Coefficient larger than prime #62

Open noresistence opened 5 years ago

noresistence commented 5 years ago

What does WARNING: Coefficient larger than prime during setup mean? I just ran my code with a moderately larger input size than usual, and got 5MB worth of this warning in my output. The setup finishes without errors, though.

Now I want to know: what effect has this warning? What might happen if I choose to ignore it? Will the resulting zk-SNARK not fulfill mathematical properties that it should? Or is this an issue that is not a big problem, because the size of coefficients will be reduced to a 'safe' size later in the process?

EDIT: for the record, the following steps (input generation, proof, verification) all complete successfully without warnings or errors and with the expected results.

maxhowald commented 5 years ago

This warning was introduced in #22, to warn about constraints with coefficients larger than the prime p of the underlying prime field used by the backend. Any coefficients or outputs of your computation that are larger than this will be reduced modulo p, which might not be what you expect if you're working with very large values.

Note for the default BN128 curve, the parameters are defined here (bn128_modulus_r is 253 bits).