akosba / xjsnark

A high-level framework for developing efficient zk-SNARK circuits
MIT License
184 stars 34 forks source link

Problem with evaluating an exported circuit #15

Closed sanchopansa closed 5 years ago

sanchopansa commented 5 years ago

Copying @HarryR as I'm unsure if this is an issue with the export functionality in xjsnark or with the circuit reader and/or the Pinocchio toolkit in EthSnarks.

I am exporting the circuit for the EC_KeyKnowledge example included with xjsnark. Attached are the .arith and .in files. The evaluation of the circuit inside xjsnark is successful. However, I'm getting an error when doing the evaluation with pinocchio on the exported circuit:

./pinocchio ~/keyknowledge-circuit/EC_KeyKnowledge.arith eval ~/keyknowledge-circuit/EC_KeyKnowledge_Sample_Run1.in
Error: not satisfied!

I noticed that this is not always the case, e.g. for the SHA-256 and for the AES examples the evaluation is successful with pinocchio as well.

@akosba -- could this be some problem related to verifyEq? (both the SHA-256 and AES example don't use this built-in). eckeyknowledge-circuit.zip

akosba commented 5 years ago

@sanchopansa I tried your exported circuits on the original CircuitReader interface that comes with jsnark directly, and it seemed to work. Instructions are here. Let me know if you try this approach and hit any issues with it. I looked into EthSnarks' modified version of CircuitReader and reported some observations as in the issue referenced above.

sanchopansa commented 5 years ago

Thank you @akosba for looking into this! I also see in the issue you opened with Ethsnarks that you talk about the mismatching number of constraints, which was going to be one of my follow-up questions.

I hadn't realized that you can run the exported circuits in libsnark using jsnark; not sure how I missed that when going through the README, but I will go with this approach for now. I will let you know if I hit any issues with it.

Thank you for your continued support and many timely responses & updates!