From 1498c3a739ec5312c42eab4d0a25f1fbe2a1a950 Mon Sep 17 00:00:00 2001 From: poma Date: Fri, 2 Aug 2019 12:24:37 +0300 Subject: [PATCH] split extra constraints back to 2 --- circuits/withdraw.circom | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/circuits/withdraw.circom b/circuits/withdraw.circom index 8b3146c..b94fe19 100644 --- a/circuits/withdraw.circom +++ b/circuits/withdraw.circom @@ -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);