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/l2-state-tree/index.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
This document explains how the zkEVM proving system manages changes in the L2 state tree.
2
2
3
-
The main components of the zkEVM proving system are, the ROM, the prover _hashDB_, and the storage state machine's executor.
3
+
The main components of the zkEVM proving system are, the ROM, the prover HashDB, and the storage state machine's executor.
4
4
5
5
In the zkEVM context, as in Ethereum, it is crucial to ensure the accuracy of state changes resulting from the execution of transactions.
6
6
7
7
## zkEVM ROM
8
8
9
-
The zkEVM ROM, written in zero-knowledge Assembly (zkASM), is a program designed to prove computations related to correct L2 state transitions resulting from L2 transactions in a given batch.
9
+
The zkEVM ROM, written in zero-knowledge assembly (zkASM), is a program designed to prove computations related to correct L2 state transitions resulting from L2 transactions in a given batch.
10
10
11
11
Often, multiple zkASM instructions are used to implement a single zkEVM opcode.
12
12
13
13
The L2 state is captured in the form of a Merkle tree, and its Merkle root, referred to as the _state root_, uniquely represents the summary of the current state data.
14
14
15
-
The zkEVM ROM must, therefore, have the capability to correctly execute the _create_, _read_, _update_, and _delete_ (CRUD) operations on the Merkle tree.
15
+
The zkEVM ROM must, therefore, have the capability to correctly execute the `CREATE`, `READ`, `UPDATE`, and `DELETE` (CRUD) operations on the Merkle tree.
16
16
17
17
## The storage state machine
18
18
@@ -24,13 +24,13 @@ Any operation applied to the Merkle tree must be evidenced with proof, attesting
24
24
25
25
Such a proof consists of the sibling node and other relevant hash nodes sufficient for verification purposes. This is called a Merkle proof.
26
26
27
-
An example of a Merkle proof can be found in the [Concepts section](https://docs.polygon.technology/zkEVM/concepts/sparse-merkle-trees/sparse-merkle-tree/?h=merkle+proof#keys-and-navigating-a-merkle-tree).
27
+
An example of a Merkle proof can be found in the [Concepts section](../../concepts/sparse-merkle-trees/sparse-merkle-tree.md).
28
28
29
29
Verifying a Merkle proof involves using the given information to compute the Merkle root and checking if it matches the actual Merkle root.
30
30
31
31
After processing the last L2 transaction in a batch, the resulting root becomes the _new state root_.
32
32
33
-
### Example. (Proving read and update operations)
33
+
### Example. (Proving `READ` and `UPDATE` operations)
34
34
35
35
We provide illustrative examples showcasing two CRUD operations on the L2 state: _read_ and _update_ operations.
36
36
@@ -40,19 +40,19 @@ The storage state machine is responsible for providing validity proofs of these
40
40
41
41
Consider the figure above, where the objective is to read the information stored in the fourth leaf ($l_4$).
42
42
43
-
Suppose a user carries out a transaction, and let $l_4$ represent the balance of the account that initiates the transaction.
43
+
Suppose a user carries out a transaction and $l_4$ represents the balance of the account that initiates the transaction.
44
44
45
-
In the process of reading this leaf, it is crucial to verify its _inclusion_ in the current state at the specified position.
45
+
In the process of reading this leaf, it is crucial to verify its inclusion in the current state at the specified position.
46
46
47
-
This is deterministically computed from some unique properties of the data being stored, such as the account address or the type of data.
47
+
This is deterministically computed from some unique properties of the stored data, such as the account address or the data type.
48
48
49
-
In the figure above, the blue boxes represent data that must be supplied to the storage state machine for the generation of the execution trace.
49
+
In the figure above, the blue boxes represent data that must be supplied to the storage state machine for generating the execution trace.
50
50
51
-
As typically required when verifying a Merkle proof, the data stored in the blue boxes enable the storage state machine to validate that the computed root matches the state root of the Merkle tree.
51
+
As typically required when verifying a Merkle proof, the data stored in the blue boxes enables the storage state machine to validate that the computed root matches the state root of the Merkle tree.
Consider the figure above, and in this case we examine a scenario where a leaf is updated.
55
+
Consider the figure above, which depicts a scenario where a leaf is updated.
56
56
57
57
A leaf update means changing the leaf's value, which consequently modifies the state root.
58
58
@@ -62,17 +62,17 @@ The storage state machine is used once again to generate an execution trace, ens
62
62
63
63
Following the same procedure as in the _read_ case, the consistency of the state root is verified to confirm that the changes have been accurately executed.
64
64
65
-
## The storage SM executor and hashDB
65
+
## The storage state machine's executor and HashDB
66
66
67
-
All essential hashes required for computing execution traces are stored in the _hashDB_.
67
+
All essential hashes required for computing execution traces are stored in the HashDB.
68
68
69
-
During the execution of the L2 state’s related zkEVM opcodes, such as SSTORE or SLOAD, the storage state machine’s executor consistently retrieves values from the hashDB and uses them to construct the corresponding execution traces.
69
+
During the execution of the L2 state’s related zkEVM opcodes, such as `SSTORE` or `SLOAD`, the storage state machine’s executor consistently retrieves values from the HashDB and uses them to construct the corresponding execution traces.
70
70
71
-
The hashDB contains all the hashes, which are all the nodes of the Merkle tree of the L2 state.
71
+
The HashDB contains all the hashes, which are all the nodes of the Merkle tree of the L2 state.
72
72
73
-
The figure below depicts an interaction of the executor with the hashDB, when proving the state transition from $S^{L2_x}_i$ to $S^{L2_x}_{i+1}$.
73
+
The figure below depicts an interaction of the executor with the HashDB, when proving the state transition from $S^{L2_x}_i$ to $S^{L2_x}_{i+1}$.
74
74
75
-
The executor takes as inputs, the current state $S^{L2_x}_i$ and a batch of transactions, retrieves Merkle proofs from the hashDB, and produces the execution trace representing all changes to the state tree.
75
+
The executor takes as inputs, the current state $S^{L2_x}_i$ and a batch of transactions, retrieves Merkle proofs from the HashDB, and produces the execution trace representing all changes to the state tree.
0 commit comments