circuit: fix build issues

This commit is contained in:
Saleel
2024-05-16 22:15:52 +04:00
parent 36920c2548
commit d667a1c4d6
4 changed files with 11 additions and 13 deletions

View File

@@ -45,8 +45,8 @@ template EmailVerifier(maxHeadersLength, maxBodyLength, n, k, ignoreBodyHashChec
// Assert `emailHeaderLength` fits in `ceil(log2(maxHeadersLength))`
component n2b = Num2Bits(log2Ceil(maxHeadersLength));
n2b.in <== emailHeaderLength;
component n2bHeaderLength = Num2Bits(log2Ceil(maxHeadersLength));
n2bHeaderLength.in <== emailHeaderLength;
// Assert `emailHeader` data after `emailHeaderLength` are zeros
@@ -91,8 +91,8 @@ template EmailVerifier(maxHeadersLength, maxBodyLength, n, k, ignoreBodyHashChec
// Assert `emailBodyLength` fits in `ceil(log2(maxBodyLength))`
component n2b = Num2Bits(log2Ceil(maxBodyLength));
n2b.in <== emailBodyLength;
component n2bBodyLength = Num2Bits(log2Ceil(maxBodyLength));
n2bBodyLength.in <== emailBodyLength;
// Assert data after the body (`maxBodyLength - emailBody.length`) is all zeroes

View File

@@ -7,9 +7,9 @@ include "./fp.circom";
/// @notice Verifies an RSA signature with exponent 65537.
/// @param n Number of bits per chunk the modulus is split into. Recommended to be 121.
/// @param k Number of chunks the modulus is split into. Recommended to be 17.
/// @input message[k] The message that was signed; assumes to consist of `k` chunks that fit in `n` bits (also contrained implicitly).
/// @input signature[k] The signature to verify; assumes to consist of `k` chunks that fit in `n` bits (also contrained implicitly).
/// @input modulus[k] The modulus of the RSA key (pubkey); assumes to consist of `k` chunks that fit in `n` bits (also contrained implicitly).
/// @input message[k] The message that was signed; assumes to consist of `k` chunks that fit in `n` bits (also constrained implicitly).
/// @input signature[k] The signature to verify; assumes to consist of `k` chunks that fit in `n` bits (also constrained implicitly).
/// @input modulus[k] The modulus of the RSA key (pubkey); assumes to consist of `k` chunks that fit in `n` bits (also constrained implicitly).
template RSAVerifier65537(n, k) {
signal input message[k];
signal input signature[k];

View File

@@ -19,9 +19,9 @@ template ItemAtIndex(maxArrayLen) {
signal output out;
component calcTotal = CalculateTotal(maxArrayLen);
component eqs[maxArrayLen];
component calcTotalValue = CalculateTotal(maxArrayLen);
component calcTotalIndex = CalculateTotal(maxArrayLen);
component eqs[maxArrayLen];
// For each item, check whether its index equals the input index.
for (var i = 0; i < maxArrayLen; i ++) {
@@ -30,7 +30,7 @@ template ItemAtIndex(maxArrayLen) {
eqs[i].in[1] <== index;
// eqs[i].out is 1 if the index matches - so calcTotal is sum of 0s + 1 * valueAtIndex
calcTotal.nums[i] <== eqs[i].out * in[i];
calcTotalValue.nums[i] <== eqs[i].out * in[i];
// Take the sum of all eqs[i].out and assert that it is at most 1.
calcTotalIndex.nums[i] <== eqs[i].out;
@@ -39,7 +39,7 @@ template ItemAtIndex(maxArrayLen) {
// Assert that the sum of eqs[i].out is 1. This is to ensure the index passed is valid.
calcTotalIndex.sum === 1;
out <== calcTotal.sum;
out <== calcTotalValue.sum;
}

View File

@@ -105,8 +105,6 @@ template DigitBytesToInt(n) {
signal sums[n+1];
sums[0] <== 0;
// TODO: Should we constrain the input ASCII to be between 48 and 57?
for(var i = 0; i < n; i++) {
sums[i + 1] <== 10 * sums[i] + (in[i] - 48);
}