iden3 / circom

zkSnark circuit compiler
GNU General Public License v3.0
1.31k stars 253 forks source link

Problems generating verifier.sol #233

Open FredericoBaptista opened 8 months ago

FredericoBaptista commented 8 months ago

Hello,

I've been working on a project for almost a year now and circom was always working flawlessly, but now I've faced a change in the way the verifier.sol is generated that makes me change all the structure of the project and I wanted to know if it's something that is a normal behavior of circom or no.

I generate a verifier.sol contract by using: snarkjs zkey export solidityverifier ${circuit}_0001.zkey verifier.sol

Before I used to get a code with 2 contracts, both a Verifier and a Pairing. Now, I only get a Groth16Verifier contract.

The issue is that in the previous contract (Verifier), the inputs were memory-type inputs and in this new one (Groth16Verifier) they are calldata which obliges me to change all the other contracts that are based on the verifier.sol contract.

Can you please help me with this issue? I don't find an answer or a reference in any place.

kdai-910hr commented 4 months ago

https://ethereum.stackexchange.com/questions/103437/converting-bytes-memory-to-bytes-calldata This may help you : )

Arvolear commented 2 months ago

Hey @FredericoBaptista, we have built a pretty cool circom environment thingy - hardhat-zkit - which generates Solidity verifiers with memory variables instead of calldata.

Else you may fork snarkjs and substitute this template verifier in the snarkjs renderer function. You may need to shadow the verifier_id ejs variable for compatibility.