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

Running tolling example? #17

Open samgalen opened 6 years ago

samgalen commented 6 years ago

Hi, I'm trying to get the tolling example to run using this tool. The issue that I'm currently running into is that when I try to run the binary pepper_prover_tolling, I get an assertion error that a constraint hasn't been satisfied.

I note that in your documentation, you mention that some of the examples may "porting the verifier's input generation function from the main release". What does that mean? Do you have any examples of some ported functions?

I'm happy to make a pull request with a working example once I'm done!

maxhowald commented 6 years ago

I was able to reproduce the assertion failure you mentioned.

It indicates that the prover's solution to the constraints is not valid, which means that either there is a bug in the way the prover is solving the constraints, or that the computation is set up incorrectly in some way, so that there is no valid solution.

The way input generation works is that, when you create a new computation, or compile one of the example computations without a corresponding file under input_gen, a default implementation is generated which sets all the inputs to the computation randomly. This will not work for all applications though, so you can edit this function, and it will not be overwritten if it exists already.

For the tolling example this is already done, see this file, which was adapted from the original here.

I'm pretty sure that when I added this code last year, it ran without an assertion failure, and the only other commits since then have been to update the version of libsnark used. In other words, if you check out commit fdc4a2db, (and blow away / re-install the dependencies using the script in thirdparty) you probably won't get the assertion failure any more, but, most likely, this just indicates that there is a bug that wasn't being caught before.

Unfortunately, the tolling example is large and thus a pain to debug. I'm not sure when I'll have time to look into it myself, but as a start, you can probably change some build flags in libsnark to enable extra debugging output to see which constraint is not being satisfied. Since the computation consists of thousands of constraints though, this might not be super-useful.