From f65058dad3b1edf3d50c6cacdc8d7940c55e99bd Mon Sep 17 00:00:00 2001 From: poma Date: Thu, 1 Aug 2019 22:29:40 +0300 Subject: [PATCH] add explicit constraints to fee and receiver inputs --- circuits/withdraw.circom | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/circuits/withdraw.circom b/circuits/withdraw.circom index b94fe19..63d758c 100644 --- a/circuits/withdraw.circom +++ b/circuits/withdraw.circom @@ -51,13 +51,11 @@ template Withdraw(levels, rounds) { tree.pathIndex[i] <== pathIndex[i]; } - // 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; + // 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; } -component main = Withdraw(16, 220); +component main = Withdraw(2, 220);