Skip to content

Commit b6ab630

Browse files
authored
Merge pull request 0xPolygon#185 from 0xPolygon/empieichO-docs-review
Update zkEVM - etrog doc
2 parents 3c9c8cd + 53a7f6e commit b6ab630

File tree

5 files changed

+88
-0
lines changed

5 files changed

+88
-0
lines changed
175 KB
Loading
156 KB
Loading
98 KB
Loading
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Etrog upgrade
2+
3+
This document provides details of the Etrog upgrade, which is Polygon zkEVM's upgrade that succeeds the Dragonfruit upgrade.
4+
5+
Although the Dragonfruit upgrade had some advantages over previous zkEVM versions, it has its own pain points. We take a look at what these pain points are, and how the Etrog upgrade resolves them.
6+
7+
Before discussing all these, we present the newly launched testnet that coincides with the Etrog upgrade.
8+
9+
## Cardona testnet
10+
11+
In addition to the Goërli testnet, we launched a second testnet on Sepolia dubbed Cardona.
12+
13+
Due to the looming deprecation of the Goërli testnet, the Polygon team had to put in place a second testnet. This ensures that the zkEVM can continue running even beyond the Goërli's discontinuation.
14+
15+
The Cardona testnet is ready for developers and users to connect wallets, and begin testing the Etrog upgrade of Polygon zkEVM.
16+
17+
Use the following details to connect wallets to Cardona:
18+
19+
- Network Name: Polygon zkEVM Cardona Testnet
20+
21+
- Bridge UI: https://bridge-ui.cardona.zkevm-rpc.com
22+
23+
- New RPC URL: https://rpc.cardona.zkevm-rpc.com
24+
25+
- Chain ID: 2442
26+
27+
- Currency symbol: ETH
28+
29+
- Block Explorer: https://explorer-ui.cardona.zkevm-rpc.com
30+
31+
We use the same faucet for testnet tokens, here: https://faucet.polygon.technology/
32+
33+
## zkEVM is type-2
34+
35+
The Etrog upgrade comes with support for most of the EVM's [precompiled contracts](https://www.evm.codes/precompiled?fork=shanghai); ecRecover, SHA-256, identity, modexp, ecAdd, ecMul, and ecPairing. This only leaves out the barely used RIPEMD-160 and blake2f.
36+
37+
Owing to this fact, the Etrog upgrade therefore helps Polygon zkEVM reach one of its major milestones, becoming a type-2 zkEVM.
38+
39+
The below table displays Polygon zkEVM's precompiled status.
40+
41+
![Figure: etrog-precompiled](../../../img/zkEVM/etrog-precompiled.png)
42+
43+
## Dragonfruit issues
44+
45+
Dragonfruit upgrade inherited from its predecessors the configuration that each block in the zkEVM is equivalent to one L2 transaction.
46+
47+
The justification for the _one block per transaction_ configuration was that it achieves minimum delay when creating blocks.
48+
49+
It however results in a few issues when blocks are processed.
50+
51+
The first issue is that it generates a lot of data in the database due to the huge amount of L2 blocks being created.
52+
53+
The second being, the approach lacks a way to provide different timestamps for blocks within a batch. So, all blocks in a batch have the same timestamp. However, attaching one timestamp to several blocks causes breaks in dApps that rely on timestamps for proper timing of smart contracts' actions.
54+
55+
The crucial alterations made in the Etrog upgrade are therefore on; the _one block per transaction_ approach, and the _one timestamp for many blocks_ problem.
56+
## Etrog blocks
57+
58+
Up until the Dragonfruit upgrade, each L2 block contained a single transaction. This is the same approach taken by Optimism.
59+
60+
Since a block is formed when the sequencer decides to include a transaction in a batch, prior to the Etrog upgrade, every batch contained as many blocks as transactions. As mentioned above, this resulted in bloated databases.
61+
62+
Due to this problem, blocks in the Etrog upgrade have been reconstructed to contain more than one transaction.
63+
64+
Blocks with several transactions are achieved by using a small timeout of a few seconds, or a number of milliseconds, when creating the block and waiting for transactions to be added.
65+
66+
The figure below shows the structure of the blocks in Etrog versus those of the Dragonfruit upgrade.
67+
68+
![Figure: etrog-blocks-vs-dragonfruit](../../../img/zkEVM/etrog-blocks-vs-dragonfruit.png)
69+
70+
## Etrog timestamps
71+
72+
In order to circumvent the above-mentioned issue related to the _one timestamp for many blocks_ problem, each block in the Etrog upgrade's batch receives its own unique timestamp. This is in addition to allowing more than one transaction per block.
73+
74+
The solution is achieved by enabling the sequencer to change the timestamp for different blocks within a batch. To do so, a special transaction or marker, called `changeL2Block`, is introduced within a batch to mark whenever there is a block change.
75+
76+
The figure below shows how `changeL2Block` is used to change the timestamp whenever a new block is formed.
77+
78+
![Figure: etrog-changel2block](../../../img/zkEVM/etrog-changel2block.png)
79+
80+
## Conclusion
81+
82+
The Etrog upgrade comes with groundbreaking amendments aimed at improving UX and developer experience. The most important additions with this upgrade are the two adjustments that solve the two issues mentioned-above:
83+
84+
- Being able to add multiple transactions to one block.
85+
- Allowing granularity on the timestamp within a batch.
86+
87+
Attaining the Type-2 status is remarkable.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ nav:
103103
- Architecture: zkEVM/architecture/index.md
104104
- zkEVM protocol:
105105
- zkEVM protocol: zkEVM/architecture/protocol/index.md
106+
- Etrog upgrade: zkEVM/architecture/protocol/etrog-upgrade.md
106107
- State management: zkEVM/architecture/protocol/state-management.md
107108
- Transaction life cycle:
108109
- Submit transactions: zkEVM/architecture/protocol/transaction-life-cycle/submit-transaction.md

0 commit comments

Comments
 (0)