diff --git a/circuits/anchor/withdraw.circom b/circuits/anchor/withdraw.circom index 368cbfd0c..bf5645423 100644 --- a/circuits/anchor/withdraw.circom +++ b/circuits/anchor/withdraw.circom @@ -5,7 +5,7 @@ include "merkleTree.circom"; // computes Poseidon(chainID, nullifier, secret) template CommitmentHasher() { signal input nullifier; - signal input secret; + signal input secret; signal output commitment; signal output nullifierHash; @@ -23,16 +23,16 @@ template CommitmentHasher() { // Verifies that commitment that corresponds to given secret and nullifier is included in the merkle tree of deposits template Withdraw(levels) { - signal input root; - signal input nullifierHash; - signal input recipient; // not taking part in any computations - signal input relayer; // not taking part in any computations - signal input fee; // not taking part in any computations - signal input refund; // not taking part in any computations - signal input nullifier; - signal input secret; - signal input pathElements[levels]; - signal input pathIndices[levels]; + signal input root; // public + signal input nullifierHash; // public + signal input recipient; // public - not taking part in any computations + signal input relayer; // public - not taking part in any computations + signal input fee; // public - not taking part in any computations + signal input refund; // public - not taking part in any computations + signal input nullifier; // private + signal input secret; // private + signal input pathElements[levels]; // private + signal input pathIndices[levels]; // private component hasher = CommitmentHasher(); hasher.nullifier <== nullifier; diff --git a/circuits/bridge/manyMerkleTree.circom b/circuits/bridge/manyMerkleTree.circom index 407853407..8b69f6b0f 100644 --- a/circuits/bridge/manyMerkleTree.circom +++ b/circuits/bridge/manyMerkleTree.circom @@ -31,7 +31,7 @@ template SetMembership(length) { template DualMux() { signal input in[2]; signal input s; - signal output out[2]; + signal output out[2]; s * (1 - s) === 0; out[0] <== (in[1] - in[0])*s + in[0]; diff --git a/circuits/bridge/withdraw.circom b/circuits/bridge/withdraw.circom index a4d385935..1fe26bf48 100644 --- a/circuits/bridge/withdraw.circom +++ b/circuits/bridge/withdraw.circom @@ -7,7 +7,7 @@ template CommitmentHasher() { signal input chainID; signal input nullifier; signal input secret; - signal output commitment; + signal output commitment; signal output nullifierHash; component poseidon3Hasher = Hasher3(); @@ -25,27 +25,27 @@ template CommitmentHasher() { // Verifies that commitment that corresponds to given secret and nullifier is included in the merkle tree of deposits template Withdraw(levels, length) { - signal input nullifierHash; - signal input recipient; // not taking part in any computations - signal input relayer; // not taking part in any computations - signal input fee; // not taking part in any computations - signal input refund; // not taking part in any computations + signal input nullifierHash; // public + signal input recipient; // public - not taking part in any computations + signal input relayer; // public - not taking part in any computations + signal input fee; // public - not taking part in any computations + signal input refund; // public - not taking part in any computations // chainID fixes a withdrawal proof to the destination since // this will be taken as a public input from the smart contract. - signal input chainID; + signal input chainID; // public // the set of roots to prove membership within, provided // as a public input from the smart contract. - signal input roots[length]; - signal input refreshCommitment; // not taking part in any computations + signal input roots[length]; // public + signal input refreshCommitment; // public - not taking part in any computations - signal input nullifier; - signal input secret; - signal input pathElements[levels]; - signal input pathIndices[levels]; + signal input nullifier; // private + signal input secret; // private + signal input pathElements[levels]; // private + signal input pathIndices[levels]; // private // the differences of the root one is proving against and // all the roots provided as a public input in the `roots` signal. - signal input diffs[length]; + signal input diffs[length]; // private component hasher = CommitmentHasher(); hasher.chainID <== chainID; diff --git a/circuits/semaphore/semaphore-base.circom b/circuits/semaphore/semaphore-base.circom index 531103098..cd6f4d688 100644 --- a/circuits/semaphore/semaphore-base.circom +++ b/circuits/semaphore/semaphore-base.circom @@ -7,7 +7,7 @@ include "./tree.circom"; template CalculateSecret() { signal input identity_nullifier; - signal input identity_trapdoor; + signal input identity_trapdoor; signal output out; @@ -30,14 +30,14 @@ template CalculateIdentityCommitment() { template CalculateNullifierHash() { signal input external_nullifier; signal input identity_nullifier; - signal input n_levels; + signal input n_levels; // private signal output out; component hasher = Poseidon(3); - hasher.inputs[0] <== external_nullifier; - hasher.inputs[1] <== identity_nullifier; - hasher.inputs[2] <== n_levels; + hasher.inputs[0] <== external_nullifier; + hasher.inputs[1] <== identity_nullifier; + hasher.inputs[2] <== n_levels; out <== hasher.out; } @@ -71,17 +71,17 @@ template Semaphore(n_levels, length) { var LEAVES_PER_NODE = 5; var LEAVES_PER_PATH_LEVEL = LEAVES_PER_NODE - 1; - signal input nullifier_hash; - signal input signal_hash; - signal input external_nullifier; - signal input roots[length]; + signal input nullifier_hash; // public + signal input signal_hash; // public + signal input external_nullifier; // public + signal input roots[length]; // public - signal input identity_nullifier; - signal input identity_trapdoor; - signal input identity_path_index[n_levels]; - signal input path_elements[n_levels][LEAVES_PER_PATH_LEVEL]; - signal input diffs[length]; + signal input identity_nullifier; // private + signal input identity_trapdoor; // private + signal input identity_path_index[n_levels]; // private + signal input path_elements[n_levels][LEAVES_PER_PATH_LEVEL]; // private + signal input diffs[length]; // private component secret = CalculateSecret(); secret.identity_nullifier <== identity_nullifier; diff --git a/circuits/semaphore/tree.circom b/circuits/semaphore/tree.circom index 6d40c8729..f54b40c47 100644 --- a/circuits/semaphore/tree.circom +++ b/circuits/semaphore/tree.circom @@ -21,7 +21,7 @@ template CalculateTotal(n) { template QuinSelector(choices) { signal input in[choices]; signal input index; - signal output out; + signal output out; component lessThan = LessThan(3); lessThan.in[0] <== index; @@ -90,7 +90,7 @@ template QuinTreeInclusionProof(levels) { signal input leaf; signal input path_index[levels]; signal input path_elements[levels][LEAVES_PER_PATH_LEVEL]; - signal output root; + signal output root; var i; var j; diff --git a/circuits/test/anchor_withdraw_30.circom b/circuits/test/anchor_withdraw_30.circom index f1e4f2ce3..61cf9435d 100644 --- a/circuits/test/anchor_withdraw_30.circom +++ b/circuits/test/anchor_withdraw_30.circom @@ -2,4 +2,6 @@ pragma circom 2.0.0; include "../anchor/withdraw.circom"; -component main = Withdraw(30); \ No newline at end of file +component main {public [root, nullifierHash, recipient, relayer, fee, refund]} = Withdraw(30); + + diff --git a/circuits/test/poseidon_bridge_2.circom b/circuits/test/poseidon_bridge_2.circom index 9f09c903d..322e595e0 100644 --- a/circuits/test/poseidon_bridge_2.circom +++ b/circuits/test/poseidon_bridge_2.circom @@ -2,4 +2,6 @@ pragma circom 2.0.0; include "../bridge/withdraw.circom"; -component main = Withdraw(30, 2); +component main {public [nullifierHash, recipient, relayer, fee, + refund, chainID, roots, refreshCommitment]} = Withdraw(30, 2); + diff --git a/circuits/test/poseidon_bridge_3.circom b/circuits/test/poseidon_bridge_3.circom index b32d6012c..8ba35c361 100644 --- a/circuits/test/poseidon_bridge_3.circom +++ b/circuits/test/poseidon_bridge_3.circom @@ -2,4 +2,5 @@ pragma circom 2.0.0; include "../bridge/withdraw.circom"; -component main = Withdraw(30, 3); +component main {public [nullifierHash, recipient, relayer, fee, + refund, chainID, roots, refreshCommitment]} = Withdraw(30, 3); diff --git a/circuits/test/poseidon_bridge_4.circom b/circuits/test/poseidon_bridge_4.circom index 0663e6cd2..811f1c237 100644 --- a/circuits/test/poseidon_bridge_4.circom +++ b/circuits/test/poseidon_bridge_4.circom @@ -2,4 +2,5 @@ pragma circom 2.0.0; include "../bridge/withdraw.circom"; -component main = Withdraw(30, 4); +component main {public [nullifierHash, recipient, relayer, fee, + refund, chainID, roots, refreshCommitment]} = Withdraw(30, 4); diff --git a/circuits/test/poseidon_bridge_5.circom b/circuits/test/poseidon_bridge_5.circom index 1094d91f4..d7ac1f3cd 100644 --- a/circuits/test/poseidon_bridge_5.circom +++ b/circuits/test/poseidon_bridge_5.circom @@ -2,4 +2,5 @@ pragma circom 2.0.0; include "../bridge/withdraw.circom"; -component main = Withdraw(30, 5); +component main {public [nullifierHash, recipient, relayer, fee, + refund, chainID, roots, refreshCommitment]} = Withdraw(30, 5); diff --git a/circuits/test/poseidon_bridge_6.circom b/circuits/test/poseidon_bridge_6.circom index 4bf1d58ba..cdf257d64 100644 --- a/circuits/test/poseidon_bridge_6.circom +++ b/circuits/test/poseidon_bridge_6.circom @@ -2,4 +2,5 @@ pragma circom 2.0.0; include "../bridge/withdraw.circom"; -component main = Withdraw(30, 6); +component main {public [nullifierHash, recipient, relayer, fee, + refund, chainID, roots, refreshCommitment]} = Withdraw(30, 6); diff --git a/circuits/test/semaphore_bridge_2.circom b/circuits/test/semaphore_bridge_2.circom index 981bb2b5f..d105fe282 100644 --- a/circuits/test/semaphore_bridge_2.circom +++ b/circuits/test/semaphore_bridge_2.circom @@ -2,4 +2,5 @@ pragma circom 2.0.0; include "../semaphore/semaphore-base.circom"; -component main = Semaphore(20, 2); +component main {public [nullifier_hash, signal_hash, external_nullifier, roots]} = Semaphore(20, 2); + diff --git a/scripts/bash/compile_circom.sh b/scripts/bash/compile_circom.sh index 1c2ed333d..73ea21c85 100755 --- a/scripts/bash/compile_circom.sh +++ b/scripts/bash/compile_circom.sh @@ -51,7 +51,7 @@ compile bridge poseidon_preimage_3 ### echo "Compiling Set membership of length 5 circuit..." -compile bridge set_membership_5 +# compile bridge set_membership_5 ### # WEBB SEMPAHORES