remove input range check

This commit is contained in:
poma 2021-08-25 13:20:48 +03:00 committed by Alexey Pertsev
parent 98b2e238b9
commit 5b9f1567e7

View File

@ -43,7 +43,6 @@ template Transaction(levels, nIns, nOuts, zeroLeaf) {
component inKeypair[nIns]; component inKeypair[nIns];
component inUtxoHasher[nIns]; component inUtxoHasher[nIns];
component nullifierHasher[nIns]; component nullifierHasher[nIns];
component inAmountCheck[nIns];
component tree[nIns]; component tree[nIns];
component checkRoot[nIns]; component checkRoot[nIns];
var sumIns = 0; var sumIns = 0;
@ -77,9 +76,9 @@ template Transaction(levels, nIns, nOuts, zeroLeaf) {
checkRoot[tx].in[1] <== tree[tx].root; checkRoot[tx].in[1] <== tree[tx].root;
checkRoot[tx].enabled <== inAmount[tx]; checkRoot[tx].enabled <== inAmount[tx];
// Check that amount fits into 248 bits to prevent overflow // We don't need to range check input amounts, since all inputs are valid UTXOs that
inAmountCheck[tx] = Num2Bits(248); // were already checked as outputs in the previous transaction (or zero amount UTXOs that don't
inAmountCheck[tx].in <== inAmount[tx]; // need to be checked either).
sumIns += inAmount[tx]; sumIns += inAmount[tx];
} }