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

Feat/fix select regex reveal #214

Merged
merged 2 commits into from
Aug 29, 2024
Merged

Conversation

SoraSuegami
Copy link
Collaborator

@SoraSuegami SoraSuegami commented Aug 28, 2024

Description

This PR has the following three updates.

  1. Fix the SelectRegexReveal template in circuits/utils/regex.circom to constrain that the given startIndex is less than maxArrayLen.
  2. Add a note about an assumption that there should be only one consecutive sequence of non-zero bytes in in given to the SelectRegexReveal template.
  3. Add new tests for the SelectRegexReveal template to circuits/tests/select-regex-reveal.test.ts.

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist:

  • I have discussed with the team prior to submitting this PR
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@@ -26,6 +27,10 @@ template SelectRegexReveal(maxArrayLen, maxRevealLen) {
signal isPreviousZero[maxArrayLen];
signal isAboveMaxRevealLen[maxArrayLen];

// Assert startIndex < maxArrayLen
Copy link
Member

@saleel saleel Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoraSuegami Isn't this check already enforced in VarShiftLeft - https://github.com/zkemail/zk-email-verify/blob/main/packages/circuits/utils/array.circom#L121-L122 ?

(Num2Bits will fail if out of bounds)

Copy link
Member

@saleel saleel Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoraSuegami ^ Ignore above comment. I think we need both (bit range check and less thank check).

@SoraSuegami
Copy link
Collaborator Author

Thank you for your review!

@SoraSuegami SoraSuegami merged commit d718290 into main Aug 29, 2024
5 checks passed
shreyas-londhe pushed a commit that referenced this pull request Sep 12, 2024
* Fix SelectRegexReveal

* Add a new test for the SelectRegexReveal template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants