From ab11997f5ed7ba2bc5e32a2d100d82282478b002 Mon Sep 17 00:00:00 2001 From: Dimitri Date: Fri, 25 Oct 2024 18:45:37 +0700 Subject: [PATCH] chore: fix readme for testing --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eb5e83d..528ca00 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The regular expressions supported by our compiler version 2.1.1 are **audited by 5. Regular expressions that, when converted to DFA, have multiple accepting states are not supported. 6. Decomposed regex defintions must alternate public and private states. -Note that all international characters are supported. +Note that all international characters are supported. If you want to use this circuit in practice, we strongly recommend using [AssertZero](https://github.com/zkemail/zk-email-verify/blob/29d5c873161c30ebb98a00efb3a145275d0f0833/packages/circuits/utils/array.circom#L144) on the bytes before and after your match. This is because you likely have shift viaan unconstrained index passed in as the witnesss to represent the start of the regex match. Since that value can be arbitrarily manipulated, you need to manually constrain that there are no extra matches that can be used to exploit the circuit. You can see how we do this in [zk-email here](https://github.com/zkemail/zk-email-verify/blob/29d5c873161c30ebb98a00efb3a145275d0f0833/packages/circuits/email-verifier.circom#L99). @@ -90,7 +90,7 @@ You can generate its regex circom as follows. This command generates a regex circom from a raw string of the regex definition and a json file that defines state transitions in DFA to be revealed. For example, to verify the regex `1=(a|b) (2=(b|c)+ )+d` and reveal its alphabets, 1. Visualize DFA of the regex using [this website](https://zkregex.com). -2. Find state transitions matching with the substrings to be revealed. In this case, they are `2->3` for the alphabets after `1=`, `6->7` and `7->7` for those after `2=`, and `8->9` for `d`. +2. Find state transitions matching with the substrings to be revealed. In this case, they are `2->3` for the alphabets after `1=`, `6->7` and `7->7` for those after `2=`, and `8->9` for `d`. 3. Make a json file at `./simple_regex_substrs.json` that defines the state transitions. For example, ``` { @@ -122,7 +122,7 @@ For example, to verify the regex `1=(a|b) (2=(b|c)+ )+d` and reveal its alphabet ``` 4. Run `zk-regex raw -r "1=(a|b) (2=(b|c)+ )+d" -s ./simple_regex_substrs.json -c ./simple_regex.circom -t SimpleRegex -g true`. It outputs a circom file at `./simple_regex.circom` that has a `SimpleRegex` template. -