split extra constraints back to 2

This commit is contained in:
poma 2019-08-02 12:24:37 +03:00
parent 67ebbfbcb4
commit 1498c3a739
No known key found for this signature in database
GPG Key ID: 530BBEE4AE8C3604
1 changed files with 7 additions and 5 deletions

View File

@ -51,11 +51,13 @@ template Withdraw(levels, rounds) {
tree.pathIndex[i] <== pathIndex[i];
}
// Add hidden signal to make sure that tampering with receiver or fee will invalidate the snark proof
// Most likely it is not required, but it's better to stay on the safe side and it only takes 1 constraint
// Multiplication is used to prevent optimizer from removing this constraint
signal unused;
unused <== receiver * fee;
// Add hidden signals to make sure that tampering with receiver or fee will invalidate the snark proof
// Most likely it is not required, but it's better to stay on the safe side and it only takes 2 constraints
// Squares are used to prevent optimizer from removing those constraints
signal receiverSquare;
signal feeSquare;
receiverSquare <== receiver * receiver;
feeSquare <== fee * fee;
}
component main = Withdraw(16, 220);