mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-02-02 15:14:41 -05:00
add explicit constraints to fee and receiver inputs
This commit is contained in:
parent
5e6c7392de
commit
f65058dad3
@ -51,13 +51,11 @@ template Withdraw(levels, rounds) {
|
|||||||
tree.pathIndex[i] <== pathIndex[i];
|
tree.pathIndex[i] <== pathIndex[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add hidden signals to make sure that tampering with receiver or fee will invalidate the snark proof
|
// 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 2 constraints
|
// Most likely it is not required, but it's better to stay on the safe side and it only takes 1 constraint
|
||||||
// Squares are used to prevent optimizer from removing those constraints
|
// Multiplication is used to prevent optimizer from removing this constraint
|
||||||
signal receiverSquare;
|
signal unused;
|
||||||
signal feeSquare;
|
unused <== receiver * fee;
|
||||||
receiverSquare <== receiver * receiver;
|
|
||||||
feeSquare <== fee * fee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component main = Withdraw(16, 220);
|
component main = Withdraw(2, 220);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user