You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pragma circom 2.0.0;
include "circomlib/circuits/poseidon.circom";
/*
* This is a simple commitment circuit that takes a nullifier and
* a secret, returning their commitment.
*
* The commitment is the result of hashing the secret and the nullifier
* together via the Poseidon hash function.
*/
template Commitment() {
signal input nullifier;
signal input secret;
signal output commitment;
signal output nullifierHash;
component commitmentHash = Poseidon(2);
commitmentHash.inputs[0] <== nullifier;
commitmentHash.inputs[1] <== secret;
commitment <== commitmentHash.out;
component nullifierHasher = Poseidon(1);
nullifierHasher.inputs[0] <== nullifier;
nullifierHash <== nullifierHasher.out;
}
component main = Commitment();
I have an issue, that using build-circuit
Have as result graph with 456 signals
number of nodes 44503, signals 456
Removed 42278 unused nodes
Propagated 20 constants
Global value numbering applied
Found 0 constants
Removed 165 unused nodes
Converted to Montgomery form
number of nodes after optimize 2060, signals 456
and as result witness also have the same length, but zKey have length 935.
When trying to generate proof using snarkjs with zkey and such witness having an error:
I believe your circuit is completely fine. I think there might be an issue with the zkey generation. It was created using a different r1cs file. I checked your circuit using the test_circuits.sh script, and the test passed.
Please try everything once more. You can refer to the steps for generating the witness and proof from the test_circuits.sh script.
@olomix Ok, FYI: it seems I solved the issue.
I did the same as you - put this circuit to the test circuits to be executed by test_circuits.sh
And I had the same issue as before. (935 and 456 different lengths)
About this test here - I found that the issue was that I had 2 circom compilers (2.1.9 which comes with zkit : https://github.com/dl-solarity/hardhat-zkit) and 2.2.1 which I manually compiled from latest code base repo
(and seems somehow to compile circuit at the test 2.1.9 was used, but circom alliance which calling from test_circuits.sh use 2.2.1), so I had the same issue with different signals length
So I put everywhere 2.1.9 and tests here start passing for me.
Also, I will leave it here in case somebody bumps into this with zkit like me - to make zkit artifacts compatible with this lib - you need to set at the zkit config: optimization: '02' at the zkit.compilationSettings
Was forced to dive deep into the code to understand that.
Thank you!
All my issues are resolved - please fill free to mark this issue as resolved, thnx!
At the example circuit:
I have an issue, that using
build-circuit
Have as result graph with 456 signals
and as result witness also have the same length, but zKey have length 935.
When trying to generate proof using
snarkjs
with zkey and such witness having an error:If generate a witness with generate_witness.js - its indeed creating another witness, which have 935 and everything works as expected.
Here is an input json example:
Could you please give a hint on what its could be
@olomix cc
The text was updated successfully, but these errors were encountered: