Skip to content

Commit ab6c30f

Browse files
open sequencing PR
1 parent 3a8325a commit ab6c30f

File tree

11 files changed

+56
-17
lines changed

11 files changed

+56
-17
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Custom Dictionary Words
29.5 KB
Loading
26.3 KB
Loading
39.7 KB
Loading
34.1 KB
Loading
47.1 KB
Loading
419 KB
Loading

docs/zkEVM/architecture/high-level/smart-contracts/main-contracts.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ This contract calls the `onSequenceBatches(...)` function on the `PolygonRollupM
6262

6363
This contract calls the `onSequenceBatches(...)` function on the `PolygonRollupManager.sol` contract to trigger the verification mechanism after successful sequencing through the `sequenceBatchesValidium(...)` call.
6464

65-
<!--
65+
<!-- custom validium contracts
6666
### `PolygonRollupBaseEtrogNoGap.sol`
67-
6867
### `PolygonValidiumStorageMigration.sol`-->
6968

7069
!!! tip

docs/zkEVM/architecture/high-level/smart-contracts/overview.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,68 @@ comments: true
66

77
## Polygon smart contract architecture
88

9-
The diagram below details the Polygon Solidity smart contract architecture.
9+
Chain stacks at the node level direct transaction data into the L2 and L1 realms via smart contract calls. The system stores state in binary tree structures containing verifiable local and global exit roots.
1010

11-
It shows the key contracts that manage rollup and validium stack behavior, and describes the relationships between them.
11+
The diagram below details the Polygon Solidity smart contract architecture.
1212

1313
![Polygon Solidity smart contract architecture](../../../../img/cdk/high-level-architecture/smart-contracts-full-view.png)
1414

15-
The stacks direct transaction data into the L2 and L1 realms via smart contract calls. The system stores state in binary tree structures containing verifiable local and global exit roots.
15+
There are four key contract types built into the system design:
16+
17+
- The [consensus contract set](#consensus-contracts).
18+
- The [rollup manager](#rollup-manager).
19+
- The [bridge contract](#bridge).
20+
- [Exit root management contracts](#global-exit-roots).
21+
22+
## Consensus contracts
23+
24+
In the Ethereum realm, the set of consensus contracts and the methods they expose fuel the sequencing and verification mechanisms triggered by stack components, such as the sequencer and aggregator, at the node level.
25+
26+
<center>
27+
![Polygon Solidity smart contract consensus contract set](../../../../img/cdk/high-level-architecture/consensus-contracts.png)
28+
</center>
29+
30+
These contracts define the type of chain, i.e. validium or non-validium, and there is usually a single contract per CDK chain that supplies custom functionality.
1631

17-
In the Ethereum realm, the set of consensus contracts and the methods they expose fuel the sequencing and verification mechanisms triggered by stack components such as the sequencer and aggregator. We also note the main rollup management contract which is responsible for creating, updating, and verifying rollups.
32+
## Rollup manager
1833

19-
In the L2 realm, the L2 bridge contract manages bridging and claiming activity between L1 and L2, and the exit root mechanisms that govern state at this layer.
34+
The [PolygonRollupManager.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonRollupManager.sol) contract is responsible for creating, updating, and verifying CDK rollup and validium chains.
2035

21-
Back in L1, the system state as a whole is stored on binary trees with data and/or exit roots written into their leaves. Updates at the leaf-level trigger exit root updates which are then available to the consensus contracts via the L1 bridge contract.
36+
<center>
37+
![Polygon Solidity smart contract rollup manager](../../../../img/cdk/high-level-architecture/rollup-manager.png){ width=80% }
38+
</center>
2239

23-
### Rollup contracts
40+
## Bridge
2441

25-
The main contracts for the zkEVM rollup stack are [PolygonRollupManager.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonRollupManager.sol) which is responsible for managing rollup and validium transaction batches.
42+
The L1/L2 unified bridge contract [PolygonZkEVMBridgeV2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMBridgeV2.sol) is responsible for bridging and claiming activity across L1 and L2 chains.
2643

27-
The L1 bridge contract [PolygonZkEVMBridgeV2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMBridgeV2.sol) is responsible for bridging and claiming activity across L1 and L2 chains.
44+
<center>
45+
![Polygon Solidity smart contract bridge](../../../../img/cdk/high-level-architecture/bridge.png){ width=80% }
46+
</center>
47+
48+
In the L1 realm, the bridge also manages the complex exit root mechanism governing system state. In the L2 realm, there is a lighter exit root mechanism that governs state at this layer.
49+
50+
## Global exit roots
51+
52+
System state as a whole is stored on binary trees with data and/or exit roots written into their leaves.
53+
54+
Local updates at the leaf-level trigger exit root updates at the top of the trees which are then available to the global exit root trees and the consensus contracts via the L1 bridge contract.
2855

2956
The [PolygonZkEVMGlobalExitRootV2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMGlobalExitRootV2.sol) contract manages the exit roots across multiple networks at the Ethereum L1 level.
3057

31-
### Valdium contracts
58+
<center>
59+
![Polygon Solidity smart contract exit root L1](../../../../img/cdk/high-level-architecture/l1-exit-root.png){ width=60% }
60+
</center>
61+
62+
The L2 exit root management contract, [PolygonZkEVMGlobalExitRootL2.sol](https://github.com/0xPolygon/cdk-validium-contracts/blob/main/contracts/PolygonZkEVMGlobalExitRootL2.sol) has a lighter exit root mechanism.
63+
64+
<center>
65+
![Polygon Solidity smart contract exit root L2](../../../../img/cdk/high-level-architecture/l2-exit-root.png){ width=60% }
66+
</center>
67+
68+
## Validium stacks
3269

33-
The CDK validium stacks use the [cdk-validium-contracts](https://github.com/0xPolygon/cdk-validium-contracts/tree/main) which has slightly adjusted behavior to take account of validium components, such as in the [PolygonZkEVMGlobalExitRootL2.sol](https://github.com/0xPolygon/cdk-validium-contracts/blob/main/contracts/PolygonZkEVMGlobalExitRootL2.sol) contract for example.
70+
CDK validium stacks use the [cdk-validium-contracts](https://github.com/0xPolygon/cdk-validium-contracts/tree/main) which has slightly adjusted behavior to take account of validium components and CDK custom requirements.
3471

3572
The CDK repo is a fork of the zkEVM main contracts repo and all contracts, therefore, extend from common interfaces.
3673

docs/zkEVM/architecture/high-level/smart-contracts/sequencing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Transactions flowing through the system reach the smart contract environment aft
77
- Sequence batches requests coming from the sequencer component.
88
- Verifying batches requests coming from the aggregator component.
99

10-
This section looks at the sequencing workflow.
10+
This section looks at the sequencing workflow. The diagram below shows the sequencing workflow for rollup (non-validium) stacks.
11+
12+
![Polygon Solidity smart contract architecture](../../../../img/cdk/high-level-architecture/sequencing-flow.png)
1113

1214
## `sequenceBatches(batches, maxSequenceTs, initSequenceBatch, l2Coinbase)`
1315

0 commit comments

Comments
 (0)