From 326ea2f0c19e446a9c68581a9fdc93504550f860 Mon Sep 17 00:00:00 2001 From: Miros Date: Mon, 11 Oct 2021 14:45:21 +0200 Subject: [PATCH] update-docs+remove-escaping --- .../docs/circom-language/basic-operators.md | 4 +- .../code-quality/code-assertion.md | 2 +- .../code-quality/debugging-operations.md | 2 +- mkdocs/docs/circom-language/control-flow.md | 10 +- mkdocs/docs/circom-language/data-types.md | 8 +- mkdocs/docs/circom-language/functions.md | 6 +- mkdocs/docs/circom-language/include.md | 2 +- .../templates-and-components.md | 2 +- .../variables-and-mutability.md | 2 +- .../getting-started/computing-the-witness.md | 2 +- .../docs/getting-started/proving-circuits.md | 2 +- .../writing-compiling-circuits.md | 4 +- mkdocs/mkdocs.yml | 4 +- mkdocs/site/404.html | 104 ++++---- .../background/index.html | 243 ++++++++++-------- .../basic-operators/index.html | 117 +++++---- .../circom-insight/circom-library/index.html | 106 ++++---- .../circom-insight/circom-phases/index.html | 106 ++++---- .../compiler-messages/index.html | 106 ++++---- .../circom-insight/unknowns/index.html | 106 ++++---- .../code-quality/code-assertion/index.html | 108 ++++---- .../debugging-operations/index.html | 108 ++++---- .../circom-language/comment-lines/index.html | 106 ++++---- .../constraint-generation/index.html | 106 ++++---- .../circom-language/control-flow/index.html | 116 +++++---- .../circom-language/data-types/index.html | 114 ++++---- .../site/circom-language/functions/index.html | 112 ++++---- .../circom-language/identifiers/index.html | 106 ++++---- .../site/circom-language/include/index.html | 108 ++++---- mkdocs/site/circom-language/pragma/index.html | 106 ++++---- .../reserved-keywords/index.html | 106 ++++---- .../site/circom-language/scoping/index.html | 106 ++++---- .../site/circom-language/signals/index.html | 110 ++++---- .../templates-and-components/index.html | 108 ++++---- .../the-main-component/index.html | 106 ++++---- .../variables-and-mutability/index.html | 108 ++++---- .../computing-the-witness/index.html | 108 ++++---- .../getting-started/installation/index.html | 196 +++++--------- .../proving-circuits/index.html | 183 +++++++------ .../testing-circuits/index.html | 106 ++++---- .../writing-compiling-circuits/index.html | 112 ++++---- mkdocs/site/index.html | 135 ++++++---- mkdocs/site/search/search_index.json | 2 +- mkdocs/site/sitemap.xml | 56 ++-- mkdocs/site/sitemap.xml.gz | Bin 512 -> 507 bytes 45 files changed, 1893 insertions(+), 1677 deletions(-) rename mkdocs/site/{getting-started => background}/background/index.html (90%) diff --git a/mkdocs/docs/circom-language/basic-operators.md b/mkdocs/docs/circom-language/basic-operators.md index cb40249..4161d90 100644 --- a/mkdocs/docs/circom-language/basic-operators.md +++ b/mkdocs/docs/circom-language/basic-operators.md @@ -2,7 +2,7 @@ Circom provides boolean, arithmetic, and bitwise operators. They have the standard semantics but the arithmetic operators applied to numeric values work modulo p. -The precedence and association of the operators are like in Rust \(defined [here](https://doc.rust-lang.org/1.22.1/reference/expressions/operator-expr.html#operator-precedence)\). +The precedence and association of the operators are like in Rust (defined [here](https://doc.rust-lang.org/1.22.1/reference/expressions/operator-expr.html#operator-precedence)). Expressions can be built using the next operators, but the conditional operator `?_:_` can only occur at the top level. @@ -14,7 +14,7 @@ A field element is a value in the domain of Z/pZ, where p is the prime number se As such, field elements are operated in arithmetic modulo p. -The circom language is parametric to this number, and it can be changed without affecting the rest of the language \(using `GLOBAL_FIELD_P`\). +The circom language is parametric to this number, and it can be changed without affecting the rest of the language (using `GLOBAL_FIELD_P`). ## Conditional expressions diff --git a/mkdocs/docs/circom-language/code-quality/code-assertion.md b/mkdocs/docs/circom-language/code-quality/code-assertion.md index 3b72fca..fb69e80 100644 --- a/mkdocs/docs/circom-language/code-quality/code-assertion.md +++ b/mkdocs/docs/circom-language/code-quality/code-assertion.md @@ -1,6 +1,6 @@ # Code Assertion -**assert\(bool\_expression\);** +**assert(bool_expression);** This statement introduces conditions to be checked at execution time. If the condition fails, the witness generation is interrupted and the error is reported. diff --git a/mkdocs/docs/circom-language/code-quality/debugging-operations.md b/mkdocs/docs/circom-language/code-quality/debugging-operations.md index 31ad93d..933123a 100644 --- a/mkdocs/docs/circom-language/code-quality/debugging-operations.md +++ b/mkdocs/docs/circom-language/code-quality/debugging-operations.md @@ -1,6 +1,6 @@ # Debugging Operations -In circom there is an operation that can be used while developing circuits to help the programmer debug \(note that there are no input/output operations on the standard input/output channels\). To this end, the operation `log` has as parameter a non-conditional expression \(i.e., not including the _`?`_`;_` operator\). The execution of this instruction prints the result of the evaluation of the expression in the standard error stream. As examples consider: +In circom there is an operation that can be used while developing circuits to help the programmer debug (note that there are no input/output operations on the standard input/output channels). To this end, the operation `log` has as parameter a non-conditional expression (i.e., not including the _`?`_`;_` operator). The execution of this instruction prints the result of the evaluation of the expression in the standard error stream. As examples consider: ```text log(135); diff --git a/mkdocs/docs/circom-language/control-flow.md b/mkdocs/docs/circom-language/control-flow.md index 76ea485..5f9c55f 100644 --- a/mkdocs/docs/circom-language/control-flow.md +++ b/mkdocs/docs/circom-language/control-flow.md @@ -4,7 +4,7 @@ We have standard constructions for defining the control flow of the program. ## Conditional statement: if-then-else -**if \( boolean\_condition \) block\_of\_code else block\_of\_code** +**if ( boolean_condition ) block_of_code else block_of_code** The else part is optional. When omitted, it means “else do nothing”. @@ -21,9 +21,9 @@ if (x >= 0) { ## Loop statement: for -**for \( initialization\_code ; boolean\_condition ; step\_code \) block\_of\_code** +**for ( initialization_code ; boolean_condition ; step_code ) block_of_code** -If the initialization\_code includes a var declaration then its scope is reduced to the for statement and hence, using it later on \(without defining it again\) will produce a compilation error. +If the initialization_code includes a var declaration then its scope is reduced to the for statement and hence, using it later on (without defining it again) will produce a compilation error. ```text var y = 0; @@ -34,7 +34,7 @@ for(var i = 0; i < 100; i++){ ## Loop statement: while -**while \( boolean\_condition \) block\_of\_code** +**while ( boolean_condition ) block_of_code** It executes the block of code while the condition holds. The condition is checked every time before executing the block of code. @@ -47,7 +47,7 @@ while(i < 100){ } ``` -**Important**: when constraints are generated in any block inside an if-then-else or loop statement, the condition cannot be unknown \(see [Unknowns](/circom-language/circom-insight/unknowns)\). This is because the constraint generation must be unique and cannot depend on unknown input signals. +**Important**: when constraints are generated in any block inside an if-then-else or loop statement, the condition cannot be unknown (see [Unknowns](/circom-language/circom-insight/unknowns)). This is because the constraint generation must be unique and cannot depend on unknown input signals. In case the expression in the condition is unknown and some constraint is generated, the compiler will generate the next error message: "_There are constraints depending on the value of the condition and it can be unknown during the constraint generation phase_". diff --git a/mkdocs/docs/circom-language/data-types.md b/mkdocs/docs/circom-language/data-types.md index 9aee889..dc3f901 100644 --- a/mkdocs/docs/circom-language/data-types.md +++ b/mkdocs/docs/circom-language/data-types.md @@ -2,8 +2,8 @@ The basic var types in circom are: -* **Field element values**: integer values modulo the prime number _p_ \(see [Signals](/circom-language/signals)\). This is the default type for all signals and basic variables. -* **Arrays**: they can hold a finite number of elements \(known at compilation time\) of the same type \(signal, var, or the same type of components or arrays again\). The elements are numbered from zero on and can be accessed using the corresponding index of their position. Array access is made using square brackets. Declaration of an array of a given type is made by adding \[\] aside of the variable identifier and including the size between the brackets \(which should be defined using constant values and/or numeric parameters of templates\). +* **Field element values**: integer values modulo the prime number _p_ (see [Signals](/circom-language/signals)). This is the default type for all signals and basic variables. +* **Arrays**: they can hold a finite number of elements (known at compilation time) of the same type (signal, var, or the same type of components or arrays again). The elements are numbered from zero on and can be accessed using the corresponding index of their position. Array access is made using square brackets. Declaration of an array of a given type is made by adding \[\] aside of the variable identifier and including the size between the brackets (which should be defined using constant values and/or numeric parameters of templates). The access and the declaration should be consistent with their type and hence we access and declare with m\[i\]\[j\], since m\[i\] is an array. Examples of declarations with and without initialization: @@ -14,7 +14,7 @@ var dbl[16][2] = base; var y[5] = someFunction(n); ``` -The notation m\[i,j\] for arrays of arrays \(matrices\) is not allowed. +The notation m\[i,j\] for arrays of arrays (matrices) is not allowed. On the other hand, the following case will produce a compilation error, since the size of the array should be explicitly given; @@ -30,7 +30,7 @@ Finally, the type of signals needs to be declared as they cannot be assigned glo signal intermediate[4]; ``` -An array of components must be instantiated with the same template with \(optionally\) different parameters. +An array of components must be instantiated with the same template with (optionally) different parameters. ```text pragma circom 2.0.0; diff --git a/mkdocs/docs/circom-language/functions.md b/mkdocs/docs/circom-language/functions.md index dd4e1e7..2f47e6f 100644 --- a/mkdocs/docs/circom-language/functions.md +++ b/mkdocs/docs/circom-language/functions.md @@ -11,7 +11,7 @@ function funid ( param1, ... , paramn ) { } ``` -Functions compute numeric \(or arrays of\) values or expressions. Functions can be recursive. Consider the [next function](https://github.com/iden3/circomlib/blob/master/circuits/binsum.circom) from the circom library. +Functions compute numeric (or arrays of) values or expressions. Functions can be recursive. Consider the [next function](https://github.com/iden3/circomlib/blob/master/circuits/binsum.circom) from the circom library. ```text /* @@ -30,7 +30,7 @@ function nbits(a) { } ``` - Functions cannot declare signals or generate constraints \(use templates if you need so\). The next function produces the error message: "Template operator found". + Functions cannot declare signals or generate constraints (use templates if you need so). The next function produces the error message: "Template operator found". ```text function nbits(a) { @@ -46,7 +46,7 @@ function nbits(a) { } ``` -As usual, there can be many return statements, but every execution trace must end in a return statement \(otherwise, a compile error will be produced\). The execution of the return statement returns the control to the caller of the function. +As usual, there can be many return statements, but every execution trace must end in a return statement (otherwise, a compile error will be produced). The execution of the return statement returns the control to the caller of the function. ```text function example(N){ diff --git a/mkdocs/docs/circom-language/include.md b/mkdocs/docs/circom-language/include.md index a9cbdb8..c6e9c0e 100644 --- a/mkdocs/docs/circom-language/include.md +++ b/mkdocs/docs/circom-language/include.md @@ -1,6 +1,6 @@ # Include -Templates, like other code, can be found in other files like in libraries. In order to use code in other files, we have to include them in our program by using the keyword include, with the corresponding name of the file \(.circom extension is the default\). +Templates, like other code, can be found in other files like in libraries. In order to use code in other files, we have to include them in our program by using the keyword include, with the corresponding name of the file (.circom extension is the default). ```text include "montgomery.circom"; diff --git a/mkdocs/docs/circom-language/templates-and-components.md b/mkdocs/docs/circom-language/templates-and-components.md index 299c0e8..8495fef 100644 --- a/mkdocs/docs/circom-language/templates-and-components.md +++ b/mkdocs/docs/circom-language/templates-and-components.md @@ -145,7 +145,7 @@ template Main() { component main = Main(); ``` -**Components are immutable** \(like signals\). A component can be declared first and initialized in a second step. If there are several initialization instructions \(in different execution paths\) they all need to be instantiations of the same template \(maybe with different values for the parameters\). +**Components are immutable** (like signals). A component can be declared first and initialized in a second step. If there are several initialization instructions (in different execution paths) they all need to be instantiations of the same template (maybe with different values for the parameters). ```text template A(N){ diff --git a/mkdocs/docs/circom-language/variables-and-mutability.md b/mkdocs/docs/circom-language/variables-and-mutability.md index 955cc49..bd10c27 100644 --- a/mkdocs/docs/circom-language/variables-and-mutability.md +++ b/mkdocs/docs/circom-language/variables-and-mutability.md @@ -6,7 +6,7 @@ Variables are identifiers that hold non-signal data and are mutable. Variables a var x; ``` -They hold either numerical values of the field or arithmetic expressions when they are used to build constraints \(see [Constraint Generation](/circom-language/constraint-generation)\). They can be named using a variable identifier or can be stored in arrays. +They hold either numerical values of the field or arithmetic expressions when they are used to build constraints (see [Constraint Generation](/circom-language/constraint-generation)). They can be named using a variable identifier or can be stored in arrays. Variable assignment is made using the equal symbol `=`. Declarations may also include an initialization, as in the following examples: diff --git a/mkdocs/docs/getting-started/computing-the-witness.md b/mkdocs/docs/getting-started/computing-the-witness.md index a8bfbd4..4d0c20e 100644 --- a/mkdocs/docs/getting-started/computing-the-witness.md +++ b/mkdocs/docs/getting-started/computing-the-witness.md @@ -9,7 +9,7 @@ description: >- Before creating the proof, we need to calculate all the signals of the circuit that match all the constraints of the circuit. For that, we will use the `Wasm` module generated by`circom` that helps to do this job. It can also be done with the `C++` code in a similar way (see below). -Let us start with the `Wasm` code. Using the generated `Wasm` binary and three JavaScript files, we simply need to provide a file with the inputs and the module will execute the circuit and calculate all the intermediate signals and the output. The set of inputs, intermediate signals and output is called [witness](/getting-started/background#witness). +Let us start with the `Wasm` code. Using the generated `Wasm` binary and three JavaScript files, we simply need to provide a file with the inputs and the module will execute the circuit and calculate all the intermediate signals and the output. The set of inputs, intermediate signals and output is called [witness](/background/background#witness). In our case, we want to prove that we are able to factor the number 33. So, we assign `a = 3` and `b = 11`. diff --git a/mkdocs/docs/getting-started/proving-circuits.md b/mkdocs/docs/getting-started/proving-circuits.md index 3a80956..67d69f7 100644 --- a/mkdocs/docs/getting-started/proving-circuits.md +++ b/mkdocs/docs/getting-started/proving-circuits.md @@ -6,7 +6,7 @@ contains all the computed signals and a file with extension .r1cs that contains Now, we will use the `snarkjs` tool to generate and validate our zk-SNARK. In particular, using the multiplier2, **we will prove that we are able to provide the two factors of the number 33**. That is, we will show that we know two integers `a` and `b` such that when we multiply them, it results in the number 33. -Before generating the proof, you will need to generate a [trusted setup](/getting-started/background#trusted-setup). Generating a trusted setup consists of 2 parts: powers of tau and phase 2. Next, we provide a very basic ceremony for creating the trusted setup for the [Groth16](https://eprint.iacr.org/2016/260) zk-SNARK protocol. We also provide the basic commands to create and verify [Groth16](https://eprint.iacr.org/2016/260) proofs. Review the related [Background](/getting-started/background) section and check [the snarkjs tutorial](https://github.com/iden3/snarkjs) for further information. +Before generating the proof, you will need to generate a [trusted setup](/background/background#trusted-setup). Generating a trusted setup consists of 2 parts: powers of tau and phase 2. Next, we provide a very basic ceremony for creating the trusted setup for the [Groth16](https://eprint.iacr.org/2016/260) zk-SNARK protocol. We also provide the basic commands to create and verify [Groth16](https://eprint.iacr.org/2016/260) proofs. Review the related [Background](/background/background) section and check [the snarkjs tutorial](https://github.com/iden3/snarkjs) for further information. ## Trusted setup: Powers of Tau diff --git a/mkdocs/docs/getting-started/writing-compiling-circuits.md b/mkdocs/docs/getting-started/writing-compiling-circuits.md index ce64f80..8420bdd 100644 --- a/mkdocs/docs/getting-started/writing-compiling-circuits.md +++ b/mkdocs/docs/getting-started/writing-compiling-circuits.md @@ -103,8 +103,8 @@ circom multiplier2.circom --r1cs --wasm --sym --c With these options we generate three types of files: -* `--r1cs`: it generates the file `multiplier2.r1cs` that contains the [R1CS constraint system](/getting-started/background#rank-1-constraint-system) of the circuit in binary format. -* `--wasm`: it generates the directory `multiplier2_js` that contains the `Wasm` code (multiplier2.wasm) and other files needed to generate the [witness](/getting-started/background#witness). +* `--r1cs`: it generates the file `multiplier2.r1cs` that contains the [R1CS constraint system](/background/background#rank-1-constraint-system) of the circuit in binary format. +* `--wasm`: it generates the directory `multiplier2_js` that contains the `Wasm` code (multiplier2.wasm) and other files needed to generate the [witness](/background/background#witness). * `--sym` : it generates the file `multiplier2.sym` , a symbols file required for debugging or for printing the constraint system in an annotated mode. * `--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. diff --git a/mkdocs/mkdocs.yml b/mkdocs/mkdocs.yml index bcbeda7..8cb6c93 100644 --- a/mkdocs/mkdocs.yml +++ b/mkdocs/mkdocs.yml @@ -1,5 +1,5 @@ site_name: Circom 2 Documentation -site_url: http://127.0.0.1:8000 +site_url: http://docs.circom.io theme: name: material palette: @@ -8,7 +8,7 @@ theme: # favicon: images/favicon.png features: - navigation.tabs - - navigation.top + - navigation.tabs.sticky repo_url: https://github.com/iden3/circom markdown_extensions: - pymdownx.arithmatex: diff --git a/mkdocs/site/404.html b/mkdocs/site/404.html index aeecbf8..941a678 100644 --- a/mkdocs/site/404.html +++ b/mkdocs/site/404.html @@ -71,7 +71,9 @@ -
+ + +
- + + +
+ +
+ +
@@ -280,20 +294,6 @@ -
  • - - Background on ZK - -
  • - - - - - - - - -
  • Installation @@ -358,22 +358,37 @@ +
  • + + Background in ZK + +
  • + + + + + + + + + +
  • - + -
  • - - - Back to top - - @@ -893,7 +903,7 @@

    404 - Not found

    - + diff --git a/mkdocs/site/getting-started/background/index.html b/mkdocs/site/background/background/index.html similarity index 90% rename from mkdocs/site/getting-started/background/index.html rename to mkdocs/site/background/background/index.html index 075e063..f956425 100644 --- a/mkdocs/site/getting-started/background/index.html +++ b/mkdocs/site/background/background/index.html @@ -11,14 +11,14 @@ - + - Background on ZK - Circom 2 Documentation + Background in ZK - Circom 2 Documentation @@ -80,7 +80,9 @@ -
    + + +
    - + + +
    + +
    + +
    @@ -264,14 +278,12 @@ - - -
  • +
  • - + @@ -292,6 +304,70 @@ + +
  • + + Installation + +
  • + + + + + + + + + +
  • + + Writing and compiling circuits + +
  • + + + + + + + + + +
  • + + Computing the witness + +
  • + + + + + + + + + +
  • + + Proving circuits with ZK + +
  • + + + + + + + + + + + + + + + + @@ -304,12 +380,12 @@ - Background on ZK + Background in ZK @@ -388,69 +464,6 @@ - - - - - - - -
  • - - Installation - -
  • - - - - - - - - - -
  • - - Writing and compiling circuits - -
  • - - - - - - - - - -
  • - - Computing the witness - -
  • - - - - - - - - - -
  • - - Proving circuits with ZK - -
  • - - - - - - - - - @@ -463,18 +476,18 @@
  • - + -
  • - - - Back to top - - @@ -1125,15 +1133,30 @@

    Summary