-
Notifications
You must be signed in to change notification settings - Fork 29
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
Setup #1
Setup #1
Conversation
Does this circuit compile?
|
try run the test by |
Your generated circuit also creates a Ok I looked at the circom docs again, you're right that the |
That should be removed for now. It was meant for the restructure refactor.
Thanks for pointing out. Yeah. I wasn't sure if the use of count var is valid actually. Good to know this is the case. I should update the test cases to improve the coverage. |
I just pushed the code to take care of this scenario. Another issue I found is the regex compiler does not quite align with the regex gramma. For example, So I guess it would be some reviews needed to make sure the dfa processor align with the regex gramma. |
That's possible, we intended for the code to just extract specific states that are usually contiguous substrings in the context of zk-email -- I can see how it might need a bit of massaging to make certain states the same or different! It would be a great contribution to try to highlight some of those differences and help plan to modify it to make it more accurate. Curious your thoughts here. I think we are almost ready to merge here -- I just had a question about how to manage the old Python code. Perhaps it makes sense to keep it around in a folder in case anyone wants to use it, but I can also see it diverging over time as we optimize the JS and make it more feature rich. So I think it makes sense to merge this PR into master and continue to work on top of it, and just have a note with the original source of the Python code, what do you think? |
I think python needs to be deprecated when we have the JS version. As I mentioned earlier, it would be better to have a CLI to support the regex compilation and fix the bugs in the current python compiler and in the JS version derived. One thing I would like to make sure of is the maintenance of the codebase of the compiler. It is quite difficult to navigate the codebase from the lexical to the circuit generator. What I am currently trying to achieve is to make the code easier for maintenance in the long run and potentially avoid bugs that the compilers currently has. I am now prototyping with the I should be able to deliver an usable CLI to compile regex in a week. |
Awesome! These both sound like great goals, I am very excited to see it. Let me know if there's any way I can support it. |
0615ccf
to
710a35a
Compare
For now, I have created a simple CLI and wrap with the To use the CLI, now you can run the command Currently, character class, such as In the upcoming releases, the circuit generator could be updated to integrate with Meanwhile, I have added a github action to run the tests automatically for PRs. I think we can change the PR settings such that only the ones passed the CI tests can be merged. Please have a play around with the CLI, and let me know if any comments for this PR. |
f725599
to
e81c6eb
Compare
Per https://github.com/zk-email-verify/zk-email-verify/issues/23, this PR contains the following:
Converted the original python compiler to JS
All the logic should be the same, but just in JS to be consistent across the projects and potential use cases within the browser.
Use
circom_tester
to cover the circuit testKeep in mind it is for now using my version of
circom_tester
, which has a pending PR to improve the testing API.CLI
The command line hasn't been implemented due to a roadblock, which is the regex the compiler supposes right now is not a real regex as per the code here.
So at the moment, to compile with wildcard, it has it substitute with the hardcoded variables. like this. So obviously, when it comes to the command line, the users would find it confusing to compile regex as they can't use the real regex text and they have to be aware of these hardcoded variables.
To get around this, I am currently evaluating regexp-tree to help further process regex texts into the same level as the hardcoded variables for alternative string for the matching, before feeding the processed regex to the nfa processing.
Circuit template
The original regex circuit has
final_state_sum
to record the total count of the matches. Based on my tests, it seems it is not working as expected. The final value output all the1
values in the states array signal, which is equivalent to counting the matched text, instead of counting the matches.In this PR, it also attempts to fix the counting issue at here
Please have a check and feel free to let me know your thoughts.