Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(circuits): ensure we account for correct num signups in messageValidator #1200

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading