mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-05-02 06:16:03 -04:00
add explicit constraints to fee and receiver inputs
This commit is contained in:
parent
5e6c7392de
commit
f65058dad3
1 changed files with 6 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue