You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/zkEVM/architecture/zkprover/index.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,13 @@ The zkProver mainly interacts with two components, i.e. the Node and the databas
15
15
16
16
As depicted in the flow diagram above, the whole interaction works out in 4 steps.
17
17
18
-
1. The Node sends the content of Merkle trees to the database to be stored there
18
+
1. The node sends the content of Merkle trees to the database to be stored there.
19
19
20
-
2. The Node then sends the input transactions to the zkProver
20
+
2. The node then sends the input transactions to the zkProver.
21
21
22
-
3. The zkProver accesses the database and fetches the info needed to produce verifiable proofs of the transactions sent by the Node. This information consists of the Merkle roots, the keys and hashes of relevant siblings, and more
22
+
3. The zkProver accesses the database and fetches the info needed to produce verifiable proofs of the transactions sent by the Node. This information consists of the Merkle roots, the keys and hashes of relevant siblings, and more.
23
23
24
-
4. The zkProver then generates the proofs of transactions, and sends these proofs back to the Node
24
+
4. The zkProver then generates the proofs of transactions, and sends these proofs back to the Node.
25
25
26
26
However, this is really the tip of the iceberg in terms of what the zkProver does. There is a lot more detail involved in how the zkProver actually creates these verifiable proofs of transactions. It will be revealed while we dig deeper into state machines below.
27
27
@@ -114,11 +114,11 @@ Each secondary state machine therefore consists of its own executor and a PIL pr
114
114
115
115
Here is a step-by-step outline of how the system achieves proof / verification of transactions:
116
116
117
-
- Represent a given computation as a state machine (SM),
118
-
- Express the state changes of the SM as polynomials,
119
-
- Capture traces of state changes, called execution traces, as rows of a lookup table,
120
-
- Form polynomial identities / constraints that these state transitions satisfy,
121
-
- Prover uses a specific polynomial commitment scheme to commit and prove knowledge of the committed polynomials,
117
+
- Represent a given computation as a state machine (SM).
118
+
- Express the state changes of the SM as polynomials.
119
+
- Capture traces of state changes, called execution traces, as rows of a lookup table.
120
+
- Form polynomial identities and/or constraints that these state transitions satisfy.
121
+
- Prover uses a specific polynomial commitment scheme to commit and prove knowledge of the committed polynomials.
122
122
-[Plookup](https://eprint.iacr.org/2020/315.pdf) is one of the ways to check if the Prover's committed polynomials produce correct traces.
123
123
124
124
While the polynomial constraints are written in the PIL language, the instructions are initially written in zkASM but subsequently expressed and stored in JSON format. Although not all verification involves a Plookup, the diagram below, briefly illustrates the wide role Plookup plays in the zkProver.
@@ -129,13 +129,13 @@ While the polynomial constraints are written in the PIL language, the instructio
129
129
130
130
For the sake of simplicity, one can think of the zkProver as being composed of the following four components;
131
131
132
-
- The Executor or the Main state machine executor
132
+
- The Executor or the Main state machine executor.
133
133
134
-
- The STARK Recursion Component
134
+
- The STARK Recursion Component.
135
135
136
-
- The CIRCOM library
136
+
- The CIRCOM library.
137
137
138
-
- The zk-SNARK Prover
138
+
- The zk-SNARK Prover.
139
139
140
140
In the nutshell, the zkProver uses these four components to generates verifiable proofs. As a result, the constraints that each proposed batch must meet are polynomial constraints or polynomial identities. All valid batches must satisfy specific polynomial constraints.
141
141
@@ -147,32 +147,32 @@ The Executor or Main state machine Executor handles the execution of the zkEVM.
147
147
148
148
It takes as inputs; the transactions, the old and the new states, the ChainID of the Sequencer, to mention a few. The executor also needs;
149
149
150
-
1. The PIL, which is the list of polynomials, the list of the registers, and
151
-
2. The ROM, which stores the list of instructions pertaining to execution
150
+
1. The PIL, which is the list of polynomials, the list of the registers.
151
+
2. The ROM, which stores the list of instructions pertaining to execution.
152
152
153
153
The Executor sets up the polynomial constraints that every valid batch of transactions must satisfy. Another language, specially developed by the team, called Polynomial Identity Language (or PIL), is used to encode all the polynomial constraints.
154
154
155
155
The Executor executes all instructions on top of the PIL hardware and generates the committed polynomials; which are the state machine cycles, or a list of all the states. It also generates some public data, which forms part of the input to the zk-SNARK verifier.
156
156
157
157
### STARK recursion component
158
158
159
-
Once the Main state machine Executor has converted transactions and related data to committed polynomials, the STARK Recursion Component takes the following inputs;
159
+
Once the Main state machine Executor has converted transactions and related data to committed polynomials, the STARK Recursion component takes the following inputs;
160
160
161
-
1. The Committed Polynomials,
162
-
2. The Constant Polynomials,
163
-
3. Scripts, which are lists of instructions,
161
+
1. The committed polynomials.
162
+
2. The constant polynomials.
163
+
3. Scripts, which are lists of instructions.
164
164
165
165
These are taken in order to generate a zk-STARK proof. In an effort to facilitate fast zk-STARK proving, the STARK Recursion Component utilises [Fast Reed-Solomon Interactive Oracle Proofs of Proximity (RS-IOPP)](https://drops.dagstuhl.de/opus/volltexte/2018/9018/pdf/LIPIcs-ICALP-2018-14.pdf), also referred to as FRI, for each zk-proof.
166
166
167
167
The component is referred to as the STARK Recursion, because;
168
168
169
-
; It actually produces several zk-STARK proofs,
169
+
-It actually produces several zk-STARK proofs.
170
170
171
-
; Collates them into bundles of a few zk-STARK proofs,
171
+
-Collates them into bundles of a few zk-STARK proofs.
172
172
173
-
; And produces a further zk-STARK proof of each bundle,
173
+
- Produces a further zk-STARK proof for each bundle.
174
174
175
-
; The resulting zk-STARK proofs of the bundle are also collated and proved with only one zk-STARK proof.
175
+
-The resulting zk-STARK proofs of the bundles are also collated and proved with only one zk-STARK proof.
176
176
177
177
This way, hundreds of zk-STARK proofs are represented and proved with only one zk-STARK proof.
178
178
@@ -182,7 +182,7 @@ The single zk-STARK proof produced by the STARK Recursion Component is the input
182
182
183
183
The original CIRCOM [paper](https://www.techrxiv.org/articles/preprint/CIRCOM_A_Robust_and_Scalable_Language_for_Building_Complex_Zero-Knowledge_Circuits/19374986/1) describes it as both a circuits programming language to define Arithmetic circuits, and a compiler that generates two things;
184
184
185
-
1. A file containing a set of Rank-1 Constraints System (or R1CS) constraints associated with an Arithmetic circuit, and
185
+
1. A file containing a set of Rank-1 Constraints System (or R1CS) constraints associated with an Arithmetic circuit.
186
186
2. A program (written either in C++ or WebAssembly) for computing a valid assignment to all wires of the Arithmetic circuit, called a witness.
187
187
188
188
As implemented in the zkProver, CIRCOM takes as input a zk-STARK proof in order to perform two tasks;
@@ -196,7 +196,7 @@ The last component of the zkProver is the zk-SNARK Prover, in particular, Rapid
196
196
197
197
Rapid SNARK is a zk-SNARK proof generator, written in C++ and Intel Assembly, which is very fast in generating proofs of CIRCOM's outputs. With regards to the zkProver, the Rapid SNARK takes as inputs
198
198
199
-
1. The witness from CIRCOM, and
199
+
1. The witness from CIRCOM.
200
200
2. The STARK verifier data, which dictates how the Rapid SNARK must process the data, and then generate a zk-SNARK proof.
The figure above depicts a simple _Multiplier_ Arithmetic circuit with input wires labeled $\texttt{a}$ and $\texttt{b}$ and an output wire labeled $\texttt{c}$ such that $\texttt{a} \times \texttt{b\ = } \texttt{c}$. The wires are referred to as signals. The constraint related to this Multiplier circuit is:
83
+
The figure above depicts a simple _Multiplier_ Arithmetic circuit with input wires labeled $\texttt{a}$ and $\texttt{b}$ and an output wire labeled $\texttt{c}$ such that $\mathtt{a} \times \mathtt{b = }\ \texttt{c}$. The wires are referred to as signals. The constraint related to this Multiplier circuit is:
84
84
85
85
$$
86
-
\texttt{a} \times \texttt{b} \texttt{ - c = 0}
86
+
\mathtt{a} \times \mathtt{b} \mathtt{\ -\ c = 0}
87
87
$$
88
88
89
89
### The `pragma` instruction
@@ -166,7 +166,7 @@ Small circuits can be defined which can be combined to create larger circuits by
166
166
167
167
As previously mentioned, the use of the operator "<==" in the _Multiplier template_ has dual functionality:
168
168
169
-
- It captures the arithmetic relation between signals, and
169
+
- It captures the arithmetic relation between signals.
170
170
- It also provides a way to compute $\texttt{c}$ from $\texttt{a}$ and $\texttt{b}$.
171
171
172
172
In general, the description of a CIRCOM circuit also keeps dual functionality. That is, it performs both symbolic tasks and computational tasks.
After compiling the _.circom_ circuit, the compiler returns four files,
183
183
184
-
- A file with the R1CS constraints (symbolic task)
185
-
- A C++ program for computing values of the circuit wires (computational task)
186
-
- A WebAssembly program for computing values of the circuit wires (computational task)
187
-
- A file of symbols for debugging and printing the constraint system in an annotated way (symbolic task)
184
+
- A file with the R1CS constraints (symbolic task).
185
+
- A C++ program for computing values of the circuit wires (computational task).
186
+
- A WebAssembly program for computing values of the circuit wires (computational task).
187
+
- A file of symbols for debugging and printing the constraint system in an annotated way (symbolic task).
188
188
189
189
At this stage, either one of the C++ or WebAssembly programs generated by the compiler can be used to compute all signals that match the set of constraints of the circuit.
190
190
@@ -220,13 +220,13 @@ The general syntax to specify the _main_ component is the following:
220
220
component main {public [s1,..,sn]} = templateID(v1,..,vn);
221
221
```
222
222
223
-
Specifying the list of public signals of the circuit, indicated as _{public [s1,..,sn]}_, is optional.
223
+
Specifying the list of public signals of the circuit, indicated as $\mathtt{public [s1,..,sn]}$, is optional.
224
224
225
225
Note that global inputs are considered _private_ signals while global outputs are considered _public_.
226
226
227
227
However, the _main_ component has a special attribute to set a list of global inputs as public signals.
228
228
229
-
The rule of thumb is: Any other input signal not included in this list _{public [s1,..,sn]}_, is considered private.
229
+
The rule of thumb is: Any other input signal not included in this list $\mathtt{public [s1,..,sn]}$, is considered private.
Copy file name to clipboardExpand all lines: docs/zkEVM/concepts/mfibonacci/commitment-scheme.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ It describes what a commitment scheme is, the necessary properties such a scheme
9
9
10
10
## Commitment scheme protocol
11
11
12
-
In the case of our mFibonacci state machine, the prover needs to commit to the polynomials $P(X)$, $Q(X)$ $P( X \omega)$ and $Q( X \omega)$, and the verifier requests the prover to evaluate these polynomials at randomly selected points (i.e., field elements).
12
+
In the case of our mFibonacci state machine, the prover needs to commit to the polynomials $P(X)$, $Q(X)$, $P( X \omega)$ and $Q( X \omega)$, and the verifier requests the prover to evaluate these polynomials at randomly selected points (i.e., field elements).
13
13
14
14
The general protocol, in an interactive setting, is as follows;
15
15
@@ -72,12 +72,16 @@ In a typical commitment scheme, the following protocol is followed;
72
72
$$
73
73
74
74
5. In order to enable the verifier to check the boundary constraint,
the prover must send a witness $\large{\mathtt{w}}$ as proof that he or she knows the correct value of the $1024$-th term, without disclosing the actual value $A_{1023} = \mathtt{14\ 823\ 897\ 298\ 192\ 278\ 947}$.
80
+
the prover must send a witness $\large{\mathtt{w}}$ as proof that he or she knows the correct value of the $1024$-th term, without disclosing the actual value
6. The verifier then uses a formula, which is specific to the commitment scheme in use and it takes the witness as an input, to check whether the prover has computed the correct $A_{1023}$.
Copy file name to clipboardExpand all lines: docs/zkEVM/spec/pil/compiling-using-pilcom.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,10 +102,10 @@ polIdentities: 1
102
102
103
103
The debug message reflects the numbers of;
104
104
105
-
- Input committed polynomials, denoted by $\texttt{Input Pol Commitments}$,
106
-
- Quadratic polynomials, denoted by $\texttt{Q Pol Commitmets}$,
107
-
- Constant polynomials, denoted by $\texttt{Constant Pols}$,
108
-
- Intermediate polynomials, denoted by $\texttt{Im Pols}$,
105
+
- Input committed polynomials, denoted by $\texttt{Input Pol Commitments}$.
106
+
- Quadratic polynomials, denoted by $\texttt{Q Pol Commitmets}$.
107
+
- Constant polynomials, denoted by $\texttt{Constant Pols}$.
108
+
- Intermediate polynomials, denoted by $\texttt{Im Pols}$.
109
109
- The various identities that can be checked; the $\texttt{Plookup}$, the $\texttt{Permutation}$, the $\texttt{connection}$ and the $\texttt{Polynomial}$ identities.
110
110
111
111
The resulting $\texttt{JSON}$ file into which the _multiplier.pil_ code is compiled looks like this:
Copy file name to clipboardExpand all lines: docs/zkEVM/spec/pil/filling-polynomials.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,8 @@ async function execute() {
26
26
27
27
The _pilcom_ package also provides two functions; _newConstPolsArray_ and _newCommitPolsArray_. Both these functions use the _pil_ object in order to create two crucial objects:
28
28
29
-
1. First is the constant polynomials object _constPols_, which is created by the _newConstPolsArray_ function, and
29
+
1. First is the constant polynomials object _constPols_, which is created by the _newConstPolsArray_ function.
30
+
30
31
2. Second is the committed polynomials object _cmPols_, created by _newCommitPolsArray_.
0 commit comments