Skip to content

Commit 9fb57b6

Browse files
Miguel Isabel MárquezMiguel Isabel Márquez
authored andcommitted
New documentation and returning 0 or >0 if success or error.
1 parent ccf9add commit 9fb57b6

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

circom/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ fn main() {
1313
let result = start();
1414
if result.is_err() {
1515
eprintln!("{}", Colour::Red.paint("previous errors were found"));
16-
std::process::exit(exitcode::DATAERR);
16+
std::process::exit(1);
1717
} else {
1818
println!("{}", Colour::Green.paint("Everything went okay, circom safe"));
19-
std::process::exit(exitcode::OK);
19+
std::process::exit(0);
2020
}
2121
}
2222

mkdocs/docs/circom-language/circom-insight/circom-phases.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ description: >-
1111
1. The **construction** phase, where the constraints are generated.
1212
2. The **code generation** phase, where the code to compute the witness is generated.
1313

14+
If an error is produced in any of these two phases, circom will finish with an error code greater than 0. Otherwise, if the compiler finish successfully, it finishes returning 0.
15+

mkdocs/docs/circom-language/constraint-generation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ The following example shows the generation of expressions:
6767

6868
The last instruction produces the constraint `b === a * a + 3`.
6969

70+
Finally, programmers sometimes misuse operator `<--`, when starting to work in circom. They usually assign using this operator an expression which is quadratic and, as a consequence, no constraint is added. In this case, the operator needed to both performing the assignment and adding the constraint is operator `<==`. Since version 2.0.8, we throw a warning in this case.

mkdocs/docs/circom-language/templates-and-components.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,21 @@ template parallel NameTemplate(...){...}
213213

214214
If this tag is used, the resulting C++ file will contain the parallelized code to compute the witness. Parallelization becomes particularly relevant when dealing with large circuits.
215215

216+
Notice that the previous parallelism is declared at template level. Sometimes, it can be useful declare the parallelism for each component. Since version 2.0.8, the tag parallel can be also used at component level, with the parallel tag indicated right before the call to the template.
217+
218+
```text
219+
component comp = parallel NameTemplate(...){...}
220+
```
221+
A real example of use case is the following piece of code from the rollup code:
222+
```
223+
component rollupTx[nTx];
224+
for (i = 0; i < nTx; i++) {
225+
rollupTx[i] = parallel RollupTx(nLevels, maxFeeTx);
226+
}
227+
```
228+
229+
It is important to highlight again that this parallelism can only be exploited in C++ witness generator.
230+
216231
## Custom templates
217232

218233
Since version 2.0.6, the language allows the definition of a new type of templates, custom templates. This new construction works similarly to standard templates: they are declared analogously, just adding the keyword `custom` in its declaration after `template`; and are instantiated in the exact same way. That is, a custom template `Example` is defined and then instantiated as follows:

mkdocs/docs/getting-started/compiling-circuits.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,6 @@ With these options we generate three types of files:
7272
* `--sym` : it generates the file `multiplier2.sym` , a symbols file required for debugging or for printing the constraint system in an annotated mode.
7373
* `--c` : it generates the directory `multiplier2_cpp` that contains several files (multiplier2.cpp, multiplier2.dat, and other common files for every compiled program like main.cpp, MakeFile, etc) needed to compile the C code to generate the witness.
7474

75-
We can use the option -o to specify the directory where these files are created.
75+
We can use the option `-o` to specify the directory where these files are created.
76+
77+
Since version 2.0.8, we can use the option `-l` to indicate the directory where the directive `include` should look for the circuits indicated.

0 commit comments

Comments
 (0)