mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-11-22 17:50:19 +01:00
Merge pull request #26 from peppersec/audit-circuit-fix-2
Audit circuit fix 2
This commit is contained in:
commit
2de4f9c721
@ -26,11 +26,11 @@ template DualMux() {
|
|||||||
|
|
||||||
// Verifies that merkle proof is correct for given merkle root and a leaf
|
// Verifies that merkle proof is correct for given merkle root and a leaf
|
||||||
// pathIndices input is an array of 0/1 selectors telling whether given pathElement is on the left or right side of merkle path
|
// pathIndices input is an array of 0/1 selectors telling whether given pathElement is on the left or right side of merkle path
|
||||||
template MerkleTree(levels) {
|
template MerkleTreeChecker(levels) {
|
||||||
signal input leaf;
|
signal input leaf;
|
||||||
signal input root;
|
signal input root;
|
||||||
signal private input pathElements[levels];
|
signal input pathElements[levels];
|
||||||
signal private input pathIndices[levels];
|
signal input pathIndices[levels];
|
||||||
|
|
||||||
component selectors[levels];
|
component selectors[levels];
|
||||||
component hashers[levels];
|
component hashers[levels];
|
||||||
|
@ -4,8 +4,8 @@ include "merkleTree.circom";
|
|||||||
|
|
||||||
// computes Pedersen(nullifier + secret)
|
// computes Pedersen(nullifier + secret)
|
||||||
template CommitmentHasher() {
|
template CommitmentHasher() {
|
||||||
signal private input nullifier;
|
signal input nullifier;
|
||||||
signal private input secret;
|
signal input secret;
|
||||||
signal output commitment;
|
signal output commitment;
|
||||||
signal output nullifierHash;
|
signal output nullifierHash;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ template Withdraw(levels) {
|
|||||||
hasher.secret <== secret;
|
hasher.secret <== secret;
|
||||||
hasher.nullifierHash === nullifierHash;
|
hasher.nullifierHash === nullifierHash;
|
||||||
|
|
||||||
component tree = MerkleTree(levels);
|
component tree = MerkleTreeChecker(levels);
|
||||||
tree.leaf <== hasher.commitment;
|
tree.leaf <== hasher.commitment;
|
||||||
tree.root <== root;
|
tree.root <== root;
|
||||||
for (var i = 0; i < levels; i++) {
|
for (var i = 0; i < levels; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user