Skip to content

Commit 8ebe6c1

Browse files
commit move pages
1 parent 6ea5750 commit 8ebe6c1

File tree

7 files changed

+51
-46
lines changed

7 files changed

+51
-46
lines changed
Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
The emergence of various zkEVMs ignited the debate of how 'equivalent' is a given zkEVM to the Ethereum virtual machine (EVM).
1+
The Polygon CDK type-1 prover is a zk-evm proving component used for creating proofs on your ZK-EVM chain. It has been developed in collaboration with the Toposware team.
22

3-
Vitalik Buterin has since introduced some calibration to EVM-equivalence in his article, "[The different types of zkEVMs](https://vitalik.eth.limo/general/2022/08/04/zkevm.html)". He made a distinction among five types of zkEVMs, which boils down to the inevitable trade-off between Ethereum equivalence and the efficacy of the zero-knowledge proving scheme involved. For brevity, we refer to this proving scheme as the zk-prover or simply, prover.
3+
## Get started
44

5-
The types of zkEVMs, as outlined by Vitalik, are as follows;
5+
If you want to get up and running quickly, follow the [how to deploy the type-1 prover guide](../../how-to/deploy-t1-prover.md).
66

7-
- **Type-1** zkEVMs strive for full Ethereum-equivalence. These types of zkEVMs do not change anything in the Ethereum stack except adding a zk-prover. They can therefore verify Ethereum and environments that are exactly like Ethereum.
8-
- **Type-2** zkEVMs aim at full EVM-equivalence instead of Ethereum-equivalence. These zkEVMs make some minor changes to the Ethereum stack with the exception of the Application layer. As a result, they are fully compatible with almost all Ethereum apps, and thus offer the same UX as with Ethereum.
9-
- **Type-2.5** zkEVMs endeavor for EVM-equivalence but make changes to gas costs. These zkEVMs achieve fast generation of proofs but introduces a few incompatibles.
10-
- **Type-3** zkEVMs seek to be EVM-equivalent but make a few minor changes to the Application layer. These type of zkEVMs achieve faster generation of proofs, and are not compatible with most Ethereum apps.
11-
- **Type-4** zkEVMs are high-level-language equivalent zkEVMs. These type of zkEVMs take smart contract code written in Solidity, Vyper or other high-level languages and compile it to a specialized virtual machine and prove it. Type-4 zkEVMs attain the fastest proof generation time.
7+
!!! warning
8+
Throughout this section, we refer to ZK-EVM chains in a general sense and this should not be confused with Polygon's zkEVM product which is a specific example of a ZK-EVM.
129

13-
The below figure gives a visual summary of the zkEVM types, contrasting compatibility with performance.
10+
## Type definitions
1411

15-
![Figure: zkEVM types](../../../img/cdk/zkevm-types-vitalik.png)
12+
The emergence of various ZK-EVMs ignited the debate of how 'equivalent' is a given ZK-EVM to the Ethereum virtual machine (EVM).
1613

17-
Ultimately, choosing which type of zkEVM to develop involves a trade-off between EVM-equivalence and performance.
14+
Vitalik Buterin has since introduced some calibration to EVM-equivalence in his article, "[The different types of ZK-EVMs](https://vitalik.eth.limo/general/2022/08/04/zkevm.html)". He made a distinction among five types of ZK-EVMs, which boils down to the inevitable trade-off between Ethereum equivalence and the efficacy of the zero-knowledge proving scheme involved. For brevity, we refer to this proving scheme as the zk-prover or simply, prover.
15+
16+
The types, as outlined by Vitalik, are as follows;
17+
18+
- **Type-1** ZK-EVMs strive for full Ethereum-equivalence. These types do not change anything in the Ethereum stack except adding a zk-prover. They can therefore verify Ethereum and environments that are exactly like Ethereum.
19+
- **Type-2** ZK-EVMs aim at full EVM-equivalence instead of Ethereum-equivalence. These ZK-EVMs make some minor changes to the Ethereum stack with the exception of the Application layer. As a result, they are fully compatible with almost all Ethereum apps, and thus offer the same UX as with Ethereum.
20+
- **Type-2.5** ZK-EVMs endeavor for EVM-equivalence but make changes to gas costs. These ZK-EVMs achieve fast generation of proofs but introduces a few incompatibles.
21+
- **Type-3** ZK-EVMs seek to be EVM-equivalent but make a few minor changes to the Application layer. These type of ZK-EVMs achieve faster generation of proofs, and are not compatible with most Ethereum apps.
22+
- **Type-4** ZK-EVMs are high-level-language equivalent ZK-EVMs. These type of ZK-EVMs take smart contract code written in Solidity, Vyper or other high-level languages and compile it to a specialized virtual machine and prove it. Type-4 ZK-EVMs attain the fastest proof generation time.
23+
24+
The figure below gives a visual summary of the types, contrasting compatibility with performance.
25+
26+
![Figure: ZK-EVM types](../../../img/cdk/zkevm-types-vitalik.png)
27+
28+
Ultimately, choosing which type of ZK-EVM to develop involves a trade-off between EVM-equivalence and performance.
1829

1930
The challenge this poses for developers who favor exact Ethereum-equivalence is to devise ingenious designs and clever techniques to implement faster zk-provers. Vitalik mentions one mitigation strategy to improve proof generation times: Cleverly engineered, and massively parallelized provers.

docs/cdk/architecture/type-1-prover/overview.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
Polygon Type-1 zkEVM is designed for efficient implementation of the STARK proving and verification of Ethereum transactions. It achieves efficiency by restricting the Algebraic Intermediate Representation (AIR) to constraints of degree 3.
1+
The Polygon CDK type-1 prover is designed for efficient implementation of STARK proofs and verification of Ethereum transactions. It achieves efficiency by restricting the Algebraic Intermediate Representation (AIR) to constraints of degree 3.
22

33
The execution trace needed to generate a STARK proof can be assimilated to a large matrix, where columns are registers and each row represents a view of the registers at a given time.
44

55
From the initial register values on the first row to the final one, validity of each internal state transition is enforced through a set of dedicated constraints. Generating the execution trace for a given transaction unfortunately yields a considerable overhead for the prover.
66

77
A naïve design strategy would be to utilize a single table, which is solely dedicated to the entire EVM execution. Such a table would have thousands of columns, and although it would be a highly sparse matrix, the prover would treat it as fully dense.
88

9-
10-
### Modular design strategy
9+
## Modular design strategy
1110

1211
Since most of the operations involved in the EVM can be independently executed, the execution trace is split into separate STARK modules, where each is responsible for ensuring integrity of its own computations.
1312

1413
These STARK modules are:
1514

16-
- **Arithmetic module** handles binary operations including ordinary addition, multiplication, subtraction and division, comparison operations such as 'Less than' and 'Greater than', as well as ternary operations like modular operations.
15+
- **Arithmetic module** handles binary operations including ordinary addition, multiplication, subtraction and division, comparison operations such as 'less than' and 'greater than', as well as ternary operations like modular operations.
1716
- **Keccak module** is responsible for computing a Keccak permutation.
1817
- **KeccakSponge module** is dedicated to the sponge construction's 'absorbing' and 'squeezing' functions.
1918
- **Logic module** specializes in performing bitwise logic operations such as AND, OR, or XOR.
@@ -26,52 +25,44 @@ In addition to the constraints of each module, this design requires an additiona
2625

2726
For this reason, this design utilizes _Cross-table lookups_ (CTLs), based on a [logUp argument](https://eprint.iacr.org/2022/1530.pdf) designed by Ulrich Haböck, to cheaply add copy-constraints in the overall system.
2827

29-
Polygon Type-1 zkEVM uses a central component dubbed the **CPU** to orchestrate the entire flow of data that occurs among the STARK modules during execution of EVM transactions. The CPU dispatches instructions and inputs to specific STARK modules, as well as fetches their corresponding outputs.
28+
The Polygon CDK type-1 prover uses a central component dubbed the **CPU** to orchestrate the entire flow of data that occurs among the STARK modules during execution of EVM transactions. The CPU dispatches instructions and inputs to specific STARK modules, as well as fetches their corresponding outputs.
3029

3130
Note here that “dispatching” and “fetching” means that initial values and final values resulting from a given operation are being copied with the CTLs to and from the targeted STARK module.
3231

32+
## Prover primitives
3333

34-
35-
### Prover primitives
36-
37-
This document discusses the cryptographic primitives used to engineer Polygon Type-1 zkEVM, which is a custom-built zkEVM capable of tracing, proving and verifying the execution of the EVM through all state changes.
34+
We now look at the cryptographic primitives used to engineer the Polygon CDK type-1 prover, which is a custom-built prover capable of tracing, proving, and verifying the execution of the EVM through all state changes.
3835

3936
The proving and verification process is made possible by the zero-knowledge (ZK) technology. In particular, a combination of STARK[^1] and SNARK[^2], proving and verification schemes, respectively.
4037

41-
#### STARK for proving
38+
### STARK for proving
4239

43-
Polygon Type-1 zkEVM prover implements a STARK proving scheme, a robust cryptographic technique with fast proving time.
40+
The Polygon CDK type-1 prover implements a STARK proving scheme, a robust cryptographic technique with fast proving time.
4441

4542
Such a scheme has a proving component, called the STARK prover, and a verifying component called the STARK verifier. A proof produced by the STARK prover is referred to as a STARK proof.
4643

4744
The process begins with constructing a detailed record of all the operations performed when transactions are executed. The record, called the `execution trace`, is then passed to a STARK prover, which in turn generates a STARK proof attesting to correct computation of transactions.
4845

4946
Although STARK proofs are relatively big in size, they are put through a series of recursive SNARK proving, where each SNARK proof is more compact than the previous one. This way the final transaction proof becomes significantly more succinct than the initial one, and hence the verification process is highly accelerated.
5047

51-
Ultimately, this SNARK proof can stand alone or be combined with preceding blocks of proofs, resulting in a single zkEVM validity proof that validates the entire blockchain back from genesis.
48+
Ultimately, this SNARK proof can stand alone or be combined with preceding blocks of proofs, resulting in a single validity proof that validates the entire blockchain back from genesis.
5249

53-
#### Plonky2 SNARK for verification
50+
### Plonky2 SNARK for verification
5451

55-
Polygon Type-1 prover implements a SNARK called [Plonky2](https://github.com/0xPolygonZero/plonky2), which is a SNARK designed for fast recursive proofs composition. Although its arithmetization is based on [TurboPLONK](https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf), it replaces the polynomial commitment scheme of [PLONK](https://eprint.iacr.org/2019/953) with a scheme based on [FRI](https://drops.dagstuhl.de/storage/00lipics/lipics-vol107-icalp2018/LIPIcs.ICALP.2018.14/LIPIcs.ICALP.2018.14.pdf). This allows encoding the witness in 64-bit words, represented as field elements of a low-characteristic field.
52+
The CDK type-1 prover implements a SNARK called [Plonky2](https://github.com/0xPolygonZero/plonky2), which is a SNARK designed for fast recursive proofs composition. Although the math is based on [TurboPLONK](https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf), it replaces the polynomial commitment scheme of [PLONK](https://eprint.iacr.org/2019/953) with a scheme based on [FRI](https://drops.dagstuhl.de/storage/00lipics/lipics-vol107-icalp2018/LIPIcs.ICALP.2018.14/LIPIcs.ICALP.2018.14.pdf). This allows encoding the witness in 64-bit words, represented as field elements of a low-characteristic field.
5653

5754
The field used, denoted by $\mathbb{F}_p$ , is called Goldilocks. It is a prime field where the prime $p$ is of the form $p = 2^{64} - 2^{32} + 1$.
5855

5956
Since SNARKs are succinct, a Plonky2 proof is published as the validity proof that attests to the integrity of a number of aggregated STARK proofs. This results in reduced verification costs.
6057

61-
This innovative approach holds the promise of a succinct, verifiable chain state, marking a significant milestone in the quest for blockchain verifiability, scalability, and integrity. It is the very innovation that plays a central role in Polygon Type-1 zkEVM.
62-
63-
64-
### Documentation remarks
65-
66-
The documentation of Polygon Type-1 zkEVM is still WIP, and some of the documents are in the Github repo.
67-
68-
The STARK modules, which are also referred to as **STARK tables**, have been documented in the Github repo [here](https://github.com/0xPolygonZero/plonky2/tree/main/evm/spec/tables). The **CPU component** is documented below, while the **CPU logic** is in the [repo](https://github.com/0xPolygonZero/plonky2/blob/main/evm/spec/cpulogic.tex).
69-
70-
In order to complete the STARK framework, the cross-table lookups (CTLs) and the **CTL protocol** can be found in this document, while **range-checks** are also discussed below.
71-
72-
Details on **Merkle Patricia tries** and how they are used in Polygon Type-1 zkEVM, can be found [here](https://github.com/0xPolygonZero/plonky2/blob/main/evm/spec/mpts.tex). Included in there are outlines on the prover's internal memory, data encoding and hashing, and prover input format.
58+
This innovative approach holds the promise of a succinct, verifiable chain state, marking a significant milestone in the quest for blockchain verifiability, scalability, and integrity. It is the very innovation that plays a central role in the CDK type-1 prover.
7359

60+
!!! info "Further reading"
7461

62+
- The STARK modules, which are also referred to as **STARK tables**, have been documented in the Github repo [here](https://github.com/0xPolygonZero/plonky2/tree/main/evm/spec/tables).
63+
- We have documented [the CPU component](t1-cpu-component.md) while the CPU logic documentation can be found in the [repo](https://github.com/0xPolygonZero/plonky2/blob/main/evm/spec/cpulogic.tex).
64+
- In order to complete the STARK framework, read more about the [cross-table lookups (CTLs) and the CTL protocol](t1-ctl-protocol.md) and [range-checks](t1-rangechecks.md).
65+
- Details on **Merkle Patricia tries** and how they are used in the CDK type-1 prover can be found [here](https://github.com/0xPolygonZero/plonky2/blob/main/evm/spec/mpts.tex). Included are outlines on the prover's internal memory, data encoding and hashing, and prover input format.
7566

7667
[^1]: STARK is short for Scalable Transparent Argument of Knowledge
7768
[^2]: SNARK is short for Succinct Non-interactive Argument of Knowledge.

docs/cdk/architecture/type-1-prover/t1-design-challenge.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The EVM wasn't designed with zero-knowledge proving and verification in mind, and this makes the design of an efficient Type-1 zkEVM extremely challenging.
1+
The EVM wasn't designed with zero-knowledge proving and verification in mind, and this makes the design of an efficient type-1 prover extremely challenging.
22

33
Some of the challenges stem from the way the EVM is implemented. Here are some of the discrepancies that occur when deploying the most common zero-knowledge primitives to the EVM.
44

@@ -24,5 +24,5 @@ Some of the challenges stem from the way the EVM is implemented. Here are some o
2424

2525
Although the EVM supports precompiles of hash functions such as SHA2-256, RIPEMD-160, and Blake2f, they are all quite heavy for a ZK proving system.
2626

27-
4. **State representation**: Ethereum uses Merkle Patricia Tries with RLP encoding. Both of these are not zero-knowledge-friendly primitives, and incur huge overheads on transaction processing within a zkEVM context.
27+
4. **State representation**: Ethereum uses Merkle Patricia Tries with RLP encoding. Both of these are not zero-knowledge-friendly primitives, and incur huge overheads on transaction processing within a ZK-EVM context.
2828

File renamed without changes.

docs/cdk/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ hide:
1919
</div>
2020

2121
<div class="grid-container">
22+
<div class="grid-item">
23+
<a href="./architecture/type-1-prover/intro-t1-prover">
24+
<div class="product-list-item-header">
25+
<div class="feature-card-heading">CDK type-1 prover</div>
26+
</div>
27+
<p class="feature-paragraph">Find out about the CDK type-1 prover component.</p>
28+
</a>
29+
</div>
2230
<div class="grid-item">
2331
<a href="./get-started/quickstart-rollup">
2432
<div class="product-list-item-header">

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ nav:
8181
- Start services: cdk/get-started/deploy-rollup/start-services.md
8282
- Connect to CDK testnet: cdk/get-started/connect-testnet.md
8383
- How to:
84+
- Deploy type-1 prover: cdk/how-to/deploy-t1-prover.md
8485
- Manage allowlists with policies: cdk/how-to/manage-policies.md
8586
- Architecture:
8687
- DAC: cdk/architecture/dac.md
8788
- Polgon CDK type-1 prover:
88-
- Overview: cdk/architecture/type-1-prover/overview.md
89-
- zkEVM-type definitions: cdk/architecture/type-1-prover/intro-t1-prover.md
89+
- Introduction and definitions: cdk/architecture/type-1-prover/intro-t1-prover.md
9090
- Type-1 design challenges: cdk/architecture/type-1-prover/t1-design-challenge.md
9191
- Architectural overview: cdk/architecture/type-1-prover/t1-architecture.md
9292
- How to run the type-1 prover: cdk/architecture/type-1-prover/deploy-t1-prover.md

0 commit comments

Comments
 (0)