Closed HarryR closed 5 years ago
I have a branch of the pinocchio
compiler and the circuit reader from jsnark, am importing circuit reader into the ethsnarks code base (porting to gadgetlib1/ethsnarks etc) and hopefully should have something interesting working soon.
Making good progress in this branch: https://github.com/HarryR/ethsnarks/tree/pinocchio
However, need to put together some more thorough and verifiable tests for all of the opcodes.
So, I'm going to be taking the following approach to Pinocchio support:
circuit_operation
class which takes input and output wires, has auxiliary variables, functions to generate a witness, and to generate the constraintscircuit_operation
classCircuitReader
use these new classesSo, the generic circuit_operaiton
class forms the basis. Then there needs to be a circuit_reader
class, which parses the input file format into properties and operations. Then construct the circuit from the properties and operations.
Essentially I want to abstract the underlying operations from the input file format, and the circuit as a whole from the operations, so each component can be tested independently.
The downside to this is that every circuit operation will be a virtual class with method dispatch, and the memory overhead will be many times greater compared to what it is now.
I think a more immediately viable interim measure would be to split the existing CircuitReader into two phases for circuit and witness generation, where it operates on lines of text directly.
It would be really good to support the common opcode format used by JSnark/xJSnark and make it Ethereum compatible, the source code looks fairly simple and would be trivial to include in ethsnarks.
This would allow any circuit written using XJSnark and JSnark to be proven on Ethereum.
Relevant papers:
Relevant source:
It would be good to get some static examples of opcodes + inputs, and a way of verifying the circuit and generating witnesses etc.
The Pinocchio compiler and JSnark seem to be generally compatible with each other, and thus I think this is a good direction to go in.
There are also other compilers, but they are more difficult to directly support due to requiring JavaScript or WebAssembly blocks for witness computation, so the circuit cannot be simulated easily...