Skip to content

Commit

Permalink
fix(circuits): ensure we account for correct num signups in messageVa…
Browse files Browse the repository at this point in the history
…lidator
  • Loading branch information
ctrlc03 committed Feb 16, 2024
1 parent 208fa21 commit 0ac3712
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions circuits/circom/messageValidator.circom
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ template MessageValidator() {
signal input stateTreeIndex;
// how many signups we have in the state tree
signal input numSignUps;
// we check that the state tree index is <= than the number of signups
// we check that the state tree index is < than the number of signups
// as first validation
// it is <= because the state tree index is 1-based
// it is < because the state tree index is 0-based
// 0 is for blank state leaf then 1 for the first actual user
// which is where the numSignUps starts
component validStateLeafIndex = SafeLessEqThan(252);
component validStateLeafIndex = SafeLessThan(252);
validStateLeafIndex.in[0] <== stateTreeIndex;
validStateLeafIndex.in[1] <== numSignUps;

Expand Down
7 changes: 3 additions & 4 deletions circuits/circom/messageValidatorNonQv.circom
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ template MessageValidatorNonQv() {
signal input stateTreeIndex;
// how many signups we have in the state tree
signal input numSignUps;
// we check that the state tree index is <= than the number of signups
// we check that the state tree index is < than the number of signups
// as first validation
// it is <= because the state tree index is 1-based
// it is < because the state tree index is 0-based
// 0 is for blank state leaf then 1 for the first actual user
// which is where the numSignUps starts
component validStateLeafIndex = SafeLessEqThan(252);
component validStateLeafIndex = SafeLessThan(252);
validStateLeafIndex.in[0] <== stateTreeIndex;
validStateLeafIndex.in[1] <== numSignUps;

Expand Down

0 comments on commit 0ac3712

Please sign in to comment.