diff --git a/circuits/withdraw.circom b/circuits/withdraw.circom index bed8cd6..54c3838 100644 --- a/circuits/withdraw.circom +++ b/circuits/withdraw.circom @@ -50,6 +50,18 @@ template Withdraw(levels) { tree.pathElements[i] <== pathElements[i]; tree.pathIndices[i] <== pathIndices[i]; } + + // Add hidden signals to make sure that tampering with recipient 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 recipientSquare; + signal feeSquare; + signal relayerSquare; + signal refundSquare; + recipientSquare <== recipient * recipient; + feeSquare <== fee * fee; + relayerSquare <== relayer * relayer; + refundSquare <== refund * refund; } component main = Withdraw(20);