File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ pragma circom 2.0.0;
33include " ../node_modules/circomlib/circuits/poseidon.circom" ;
44include " ../node_modules/circomlib/circuits/bitify.circom" ;
55include " ../node_modules/circomlib/circuits/switcher.circom" ;
6- include " ../node_modules/circomlib/circuits/comparators.circom" ;
76
87// Merkle Proof Verification Template
98// Verifies that a leaf is in a Merkle tree with a given root
@@ -13,16 +12,9 @@ template MerkleProof(levels) {
1312 signal input leafIndex;
1413 signal output root;
1514
16- // Range check: leafIndex < 2^levels
17- component indexRange = LessThan(levels + 1 );
18- indexRange.in [0 ] <== leafIndex;
19- indexRange.in [1 ] <== 1 << levels;
20- indexRange.out === 1 ;
21-
2215 component switcher[levels];
2316 component hasher[levels];
24-
25- component indexBits = Num2Bits_strict(levels);
17+ component indexBits = Num2Bits(levels);
2618 indexBits.in <== leafIndex;
2719
2820 for (var i = 0 ; i < levels; i++ ) {
Original file line number Diff line number Diff line change @@ -3,23 +3,16 @@ pragma circom 2.0.0;
33include " ../node_modules/circomlib/circuits/poseidon.circom" ;
44include " ../node_modules/circomlib/circuits/bitify.circom" ;
55include " ../node_modules/circomlib/circuits/switcher.circom" ;
6- include " ../node_modules/circomlib/circuits/comparators.circom" ;
76
87template MerkleProof (levels ) {
98 signal input leaf;
109 signal input pathElements[levels];
1110 signal input leafIndex;
1211 signal output root;
1312
14- // Range check: leafIndex < 2^levels
15- component indexRange = LessThan(levels + 1 );
16- indexRange.in [0 ] <== leafIndex;
17- indexRange.in [1 ] <== 1 << levels;
18- indexRange.out === 1 ;
19-
2013 component switcher[levels];
2114 component hasher[levels];
22- component indexBits = Num2Bits_strict (levels);
15+ component indexBits = Num2Bits (levels);
2316 indexBits.in <== leafIndex;
2417
2518 for (var i = 0 ; i < levels; i++ ) {
Original file line number Diff line number Diff line change @@ -14,4 +14,3 @@ template Nullifier() {
1414 nullifier === hasher.out;
1515}
1616
17- component main { public [verification_id, nullifier] } = Nullifier();
Original file line number Diff line number Diff line change 1+ pragma circom 2.0 .0 ;
2+
3+ include " ./nullifier.circom" ;
4+
5+ component main { public [verification_id, nullifier] } = Nullifier();
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ echo ""
6060
6161# Single nullifier circuit
6262echo -e " ${BLUE} [5/9]${NC} Compiling nullifier.circom..."
63- circom circuits/nullifier .circom \
63+ circom circuits/nullifier_main .circom \
6464 --r1cs --wasm --sym -o build
6565echo -e " ${GREEN} ✓${NC} Single circuit compiled"
6666echo " "
You can’t perform that action at this time.
0 commit comments