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
Various Layer 2 solutions aimed at improving the scalability of the Ethereum network, primarily transaction throughput, have been developed over the past years. The ultimate and intended benefit for Ethereum network users is a reduction in gas fees, while maintaining decentralisation and security.
1
+
Various layer 2 solutions aimed at improving the scalability of the Ethereum network, primarily transaction throughput, have been developed over the past years. The ultimate and intended benefit for Ethereum network users is a reduction in gas fees, while maintaining decentralisation and security.
2
2
3
-
Polygon zkEVM is a Layer 2 Rollup solution that combines data availability and execution verification in Layer 1 of the Ethereum blockchain to ensure L2 state transition security and reliability.
3
+
Polygon zkEVM is a layer 2 rollup solution that combines data availability and execution verification in layer 1 of the Ethereum blockchain to ensure L2 state transition security and reliability.
4
4
5
5
This section will describe the infrastructure that Polygon designed and implemented for its zkEVM, with a focus on providing an overview of the components used in the development of the zkEVM Protocol.
6
6
@@ -10,59 +10,59 @@ This section describes the components used in the Polygon zkEVM to enable transa
10
10
11
11
The three main components of zkEVM protocol are:
12
12
13
-
- Trusted sequencer
14
-
- Trusted aggregator, and
15
-
- Consensus Contract (PolygonZkEVM.sol, deployed on L1)
13
+
- Trusted sequencer.
14
+
- Trusted aggregator.
15
+
- Consensus contract (PolygonZkEVM.sol, deployed on L1).
16
16
17
17
### Trusted sequencer
18
18
19
-
The Trusted sequencer component is in charge of receiving L2 transactions from users, ordering them, generating batches, and submitting them to the Consensus contract's storage slots in the form of sequences.
19
+
The trusted sequencer component is in charge of receiving L2 transactions from users, ordering them, generating batches, and submitting them to the consensus contract's storage slots in the form of sequences.
20
20
21
21
The sequencer executes and broadcasts batches of transactions to L2 network nodes in order to achieve fast finality and reduce costs associated with high network usage. That's before even submitting them to L1.
22
22
23
-
The Trusted sequencer must run a zkEVM node in sequencer mode and be in control of a Consensus Contract-enforced Ethereum account.
23
+
The Trusted sequencer must run a zkEVM node in sequencer mode and be in control of a consensus contract-enforced Ethereum account.
24
24
25
25
### Trusted aggregator
26
26
27
-
The Trusted aggregator component can compute the L2 State based on batches of L2 transactions executed by the Trusted sequencer.
27
+
The trusted aggregator component can compute the L2 State based on batches of L2 transactions executed by the trusted sequencer.
28
28
29
-
The main role of the Trusted aggregator, on the other hand, is to take the L2 batches committed by the Trusted sequencer and generate Zero-Knowledge proofs attesting to the batches' computational integrity. These ZK proofs are generated by the aggregator using a special off-chain EVM interpreter.
29
+
The main role of the trusted aggregator, on the other hand, is to take the L2 batches committed by the trusted sequencer and generate zero-Knowledge proofs attesting to the batches' computational integrity. These ZK proofs are generated by the aggregator using a special off-chain EVM interpreter.
30
30
31
-
The Consensus Contract's logic validates the Zero-Knowledge proofs, resulting in the zkEVM inheriting the L1 security. Verification is required before committing new L2 State roots to the Consensus Contract. A verified proof is an irrefutable evidence that a given sequence of batches led to a specific L2 State.
31
+
The consensus contract's logic validates the zero-Knowledge proofs, resulting in the zkEVM inheriting the L1 security. Verification is required before committing new L2 state roots to the consensus contract. A verified proof is an irrefutable evidence that a given sequence of batches led to a specific L2 state.
32
32
33
33
!!!info
34
-
L2 State Root
34
+
L2 state root
35
35
36
-
An L2 State root is a concise cryptographic digest of the L2 State. In case you want to read more about State roots, please check out [this article](https://ethereum.org/en/developers/docs/scaling/zk-rollups/#state-commitments).
36
+
An L2 state root is a concise cryptographic digest of the L2 state. In case you want to read more about state roots, please check out [this article](https://ethereum.org/en/developers/docs/scaling/zk-rollups/#state-commitments).
37
37
38
-
The Trusted aggregator should run a zkEVM node in aggregator mode and must control a specific Ethereum account enforced in a Consensus Contract.
38
+
The trusted aggregator should run a zkEVM node in aggregator mode and must control a specific Ethereum account enforced in a consensus contract.
39
39
40
40
### Consensus contract
41
41
42
-
The Consensus Contract used by both the Trusted sequencer and the Trusted aggregator in their interactions with L1 is the PolygonZkEVM.sol contract.
42
+
The consensus contract used by both the trusted sequencer and the trusted aggregator in their interactions with L1 is the `PolygonZkEVM.sol` contract.
43
43
44
-
The Trusted sequencer can commit batch sequences to L1 and store them in the `PolygonZkEVM.sol` contract, creating a historical repository of sequences.
44
+
The trusted sequencer can commit batch sequences to L1 and store them in the `PolygonZkEVM.sol` contract, creating a historical repository of sequences.
45
45
46
-
The `PolygonZkEVM.sol`Contract also enables the aggregator to publicly verify transitions from one L2 State root to the next. The Consensus Contract accomplishes this by validating the aggregator's ZK-proofs, which attest to the proper execution of transaction batches.
46
+
The `PolygonZkEVM.sol`contract also enables the aggregator to publicly verify transitions from one L2 state root to the next. The consensus contract accomplishes this by validating the aggregator's zk-proofs, which attest to the proper execution of transaction batches.
47
47
48
48
## zkEVM node execution modes
49
49
50
50
zkEVM node is a software package containing all components needed to run zkEVM network. It can be run in three different modes; as a sequencer, an aggregator, or RPC.
51
51
52
52
### Sequencer mode
53
53
54
-
In the sequencer mode, the node holds an instance of L2 State, manages batch broadcasting to other L2 network nodes, and has a built-in API to handle L2 user interactions (transaction requests and L2 State queries).
54
+
In the sequencer mode, the node holds an instance of L2 state, manages batch broadcasting to other L2 network nodes, and has a built-in API to handle L2 user interactions (transaction requests and L2 State queries).
55
55
56
-
There is also a database to temporarily store transactions that have not yet been ordered and executed (pending transactions pool), as well as all the components required to interact with L1 in order to sequence transaction batches and keep its local L2 State up to date.
56
+
There is also a database to temporarily store transactions that have not yet been ordered and executed (pending transactions pool), as well as all the components required to interact with L1 in order to sequence transaction batches and keep its local L2 state up to date.
57
57
58
58
### Aggregator mode
59
59
60
-
In the aggregator mode, the node has all the components needed to execute transaction batches, compute the resulting L2 State and generate the Zero-Knowledge proofs of computational integrity.
60
+
In the aggregator mode, the node has all the components needed to execute transaction batches, compute the resulting L2 state and generate the zero-knowledge proofs of computational integrity.
61
61
62
-
Also, has all the components needed to fetch transaction batches committed in L1 by the Trusted sequencer and call the functions to publicly verify the L2 State transitions on L1.
62
+
Also, has all the components needed to fetch transaction batches committed in L1 by the trusted sequencer and call the functions to publicly verify the L2 state transitions on L1.
63
63
64
64
### RPC mode
65
65
66
-
In the RPC mode, the zKEVM node has a limited functionality. It primarily maintains an up-to-date instance of L2 State, initially with respect to batches broadcast by the Trusted sequencer, and later with sequences of batches fetched from the Consensus Contract.
66
+
In the RPC mode, the zKEVM node has a limited functionality. It primarily maintains an up-to-date instance of L2 state, initially with respect to batches broadcast by the trusted sequencer, and later with sequences of batches fetched from the consensus contract.
67
67
68
-
The node continuously interacts with L1 in order to keep the local L2 State up to date, as well as to check the synchronization of L2 State roots. The default syncing rate for the synchroniser is every 2 seconds, unless stipulated otherwise in the configuration.
68
+
The node continuously interacts with L1 in order to keep the local L2 state up to date, as well as to check the synchronization of L2 state roots. The default syncing rate for the synchronizer is every 2 seconds, unless stipulated otherwise in the configuration.
Copy file name to clipboardExpand all lines: docs/zkEVM/architecture/protocol/state-management.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
This document aims to explain how the Polygon zkEVM Protocol manages the L2 Rollup's states while providing state transition verifiability and security.
1
+
This document aims to explain how the Polygon zkEVM protocol manages the L2 rollup's states while providing state transition verifiability and security.
2
2
3
3
## Trustless L2 state management
4
4
5
-
The Trusted sequencer generates batches, but in order to achieve fast finality of L2 transactions and avoid the need to wait for the next L1 block, they are shared with L2 network nodes via a broadcasting channel. Each node will run the batches to compute the resulting L2 state locally.
5
+
The trusted sequencer generates batches, but in order to achieve fast finality of L2 transactions and avoid the need to wait for the next L1 block, they are shared with L2 network nodes via a broadcasting channel. Each node will run the batches to compute the resulting L2 state locally.
6
6
7
-
Once the Trusted sequencer has committed the sequences of batches fetched directly from L1, L2 network nodes will execute them again, and they will no longer have to trust it.
7
+
Once the trusted sequencer has committed the sequences of batches fetched directly from L1, L2 network nodes will execute them again, and they will no longer have to trust it.
8
8
9
-
The off-chain execution of the batches will eventually be verified on-chain via a Zero-Knowledge proof, and the resulting L2 state root will be committed. As the zkEVM protocol progresses, new L2 state roots will be synchronized directly from L1 by L2 network nodes.
9
+
The off-chain execution of the batches will eventually be verified on-chain via a zero-knowledge proof, and the resulting L2 state root will be committed. As the zkEVM protocol progresses, new L2 state roots will be synchronized directly from L1 by L2 network nodes.
10
10
11
11
!!!info
12
12
Both data availability and verification of transaction execution rely only on L1 security assumptions and at the final stage of the protocol, the nodes will only rely on data present in L1 to stay synchronized with each L2 state transition.
@@ -15,21 +15,21 @@ The off-chain execution of the batches will eventually be verified on-chain via
15
15
16
16
As shown in the above figure, L2 nodes can receive batch data in three different ways:
17
17
18
-
1. Directly from the Trusted Sequencer before the batches are committed to L1, or
19
-
2. Straight from L1 after the batches have been sequenced, or
20
-
3. Only after correctness of execution has been proved by the Aggregator and verified by the `PolygonZkEVM.sol` contract.
18
+
1. Directly from the trusted sequencer before the batches are committed to L1.
19
+
2. Straight from L1 after the batches have been sequenced.
20
+
3. Only after correctness of execution has been proved by the aggregator and verified by the `PolygonZkEVM.sol` contract.
21
21
22
22
It is worth noting that the three batch data formats are received by L2 nodes in the chronological order listed above.
23
23
24
24
## Three L2 states
25
25
26
26
There are three stages of the L2 state, each corresponding to the three different ways in which L2 nodes can update their state. All three cases depend on the format of batch data used to update the L2 state.
27
27
28
-
In the first instance, the update is informed solely by the information (i.e., Batches consisting of ordered transactions) coming directly from the Trusted Sequencer, before any data availability on L1. The resulting L2 state is called the Trusted state.
28
+
In the first instance, the update is informed solely by the information (i.e., Batches consisting of ordered transactions) coming directly from the trusted sequencer, before any data availability on L1. The resulting L2 state is called the trusted state.
29
29
30
-
In the second case, the update is based on information retrieved from the L1 network by L2 nodes. That is, after the batches have been sequenced and data has been made available on L1. The L2 state is referred to as the Virtual state at this point.
30
+
In the second case, the update is based on information retrieved from the L1 network by L2 nodes. That is, after the batches have been sequenced and data has been made available on L1. The L2 state is referred to as the virtual state at this point.
31
31
32
-
The information used to update the L2 state in the last case includes verified zero-knowledge proofs of computational integrity. That is, after the Zero-Knowledge proof has been successfully verified in L1, L2 nodes synchronise their local L2 state root with the one committed in L1 by the Trusted Aggregator. As a result, such an L2 state is known as the Consolidated state.
32
+
The information used to update the L2 state in the last case includes verified zero-knowledge proofs of computational integrity. That is, after the zero-knowledge proof has been successfully verified in L1, L2 nodes synchronize their local L2 state root with the one committed in L1 by the trusted aggregator. As a result, such an L2 state is known as the consolidated state.
33
33
34
34
The figure below depicts the timeline of L2 State stages from a batch perspective, as well as the actions that trigger progression from one stage to the next.
0 commit comments