mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-10-01 01:06:17 -04:00
make rounds number a constant
This commit is contained in:
parent
9efab84e65
commit
7193655e49
@ -1,13 +1,13 @@
|
||||
include "../node_modules/circomlib/circuits/mimcsponge.circom";
|
||||
|
||||
// Computes MiMC(left + right)
|
||||
template HashLeftRight(rounds) {
|
||||
template HashLeftRight() {
|
||||
signal input left;
|
||||
signal input right;
|
||||
|
||||
signal output hash;
|
||||
|
||||
component hasher = MiMCSponge(2, rounds, 1);
|
||||
component hasher = MiMCSponge(2, 220, 1);
|
||||
hasher.ins[0] <== left;
|
||||
hasher.ins[1] <== right;
|
||||
hasher.k <== 0;
|
||||
@ -43,7 +43,7 @@ template Selector() {
|
||||
|
||||
// Verifies that merkle proof is correct for given merkle root and a leaf
|
||||
// pathIndex 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, rounds) {
|
||||
template MerkleTree(levels) {
|
||||
signal input leaf;
|
||||
signal input root;
|
||||
signal private input pathElements[levels];
|
||||
@ -54,7 +54,7 @@ template MerkleTree(levels, rounds) {
|
||||
|
||||
for (var i = 0; i < levels; i++) {
|
||||
selectors[i] = Selector();
|
||||
hashers[i] = HashLeftRight(rounds);
|
||||
hashers[i] = HashLeftRight();
|
||||
|
||||
selectors[i].pathElement <== pathElements[i];
|
||||
selectors[i].pathIndex <== pathIndex[i];
|
||||
|
@ -27,7 +27,7 @@ template CommitmentHasher() {
|
||||
}
|
||||
|
||||
// Verifies that commitment that corresponds to given secret and nullifier is included in the merkle tree of deposits
|
||||
template Withdraw(levels, rounds) {
|
||||
template Withdraw(levels) {
|
||||
signal input root;
|
||||
signal input nullifierHash;
|
||||
signal input receiver; // not taking part in any computations
|
||||
@ -45,7 +45,7 @@ template Withdraw(levels, rounds) {
|
||||
|
||||
nullifierHash === hasher.nullifierHash;
|
||||
|
||||
component tree = MerkleTree(levels, rounds);
|
||||
component tree = MerkleTree(levels);
|
||||
tree.leaf <== hasher.commitment;
|
||||
tree.root <== root;
|
||||
for (var i = 0; i < levels; i++) {
|
||||
@ -54,4 +54,4 @@ template Withdraw(levels, rounds) {
|
||||
}
|
||||
}
|
||||
|
||||
component main = Withdraw(16, 220);
|
||||
component main = Withdraw(16);
|
||||
|
Loading…
Reference in New Issue
Block a user