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
- Notice that the L2 bridge content has a function for updating the global exit root: `setGlobalExitRoot(...)`.
11
+
9
12
## Bridge and claim
10
13
11
14
The main functions of the bridge are:
@@ -17,13 +20,13 @@ The main functions of the bridge are:
17
20
18
21
### L1 to L2
19
22
20
-
To bridge assets from L1 to L2, the sender first transfers the token into the bridge by locking the asset on the origin L1 network.
23
+
To bridge assets from L1 to L2, the sender first transfers the token into the bridge by locking the asset on the origin network (L1).
21
24
22
25
The bridge smart contract mints an equivalent asset, called a wrapped token, on the destination network (L2).
23
26
24
27
Once minted, the recipient can claim the token on the destination network (L2).
25
28
26
-
The data below is transaction data represented by a leaf node and comes from an [example L1 to L2 transaction](https://etherscan.io/tx/0xddbff67ac10c27db39c8e49a36871eba319528286752188e1730fbfdcb184f1b) recorded on the L2 zkEVM chain after a successful `bridgeAsset` call.
29
+
The data below is transaction data (represented by a leaf node in an exit tree) and comes from an [example L1 to L2 transaction](https://etherscan.io/tx/0xddbff67ac10c27db39c8e49a36871eba319528286752188e1730fbfdcb184f1b) recorded on the L2 zkEVM chain after a successful `bridgeAsset` call.
27
30
28
31
| Index | Parameter name | Data type | Example value |
@@ -40,7 +43,7 @@ To send an asset from L2 to L1, the wrapped token is first burnt on the L2 netwo
40
43
41
44
The bridge smart contract then unlocks the original asset on the origin network (L1) ready for claiming.
42
45
43
-
The data below is transaction data represented by a leaf node and comes from an [example L2 to L1 claim transaction](https://etherscan.io/tx/0x70f7f550cded85e21e0893b6ea5aae3dd2b998021ce449770fa78a967bc44f79) which also posts the local and network exit roots and root proofs used for verification on L1.
46
+
The data below is transaction data (represented by a leaf node in an exit tree) and comes from an [example L2 to L1 claim transaction](https://etherscan.io/tx/0x70f7f550cded85e21e0893b6ea5aae3dd2b998021ce449770fa78a967bc44f79) which also posts the local and network exit roots and root proofs used for verification on L1.
44
47
45
48
| # | Parameter name | Data type | Example value |
The Polygon bridge smart contract uses exit tree roots to manage state. Leaves of the trees point to transaction data such as detailed above.
62
-
63
-
!!! tip
64
-
- For further details on the exit tree architecture, check out the [exit root documentation](exit-roots.md).
64
+
The Polygon bridge smart contract uses a set of [exit tree roots](exit-roots.md) to manage system state. Leaves of the trees point to transaction data such as detailed above.
65
65
66
66
On a call to the bridge, the bridge contract calls the `updateExitRoot(...)` function on the relevant exit root contract (L1 or L2) which adds an exit leaf to the relevant exit tree.
67
67
@@ -70,7 +70,7 @@ On a call to the bridge, the bridge contract calls the `updateExitRoot(...)` fun
70
70
71
71
Adding a new leaf to the tree triggers an update to the exit tree root which then propagates to an update on the global exit tree root.
72
72
73
-
Using Merkle tree exit roots in this way, referenced by the bridge contract and accessible to the `PolygonRollupManager` contract with getters, the bridge contract synchronizes data across L1 and L2, the sequencer component, and the state db.
73
+
Using Merkle tree exit roots in this way, referenced by the bridge contracts and accessible to the `PolygonRollupManager` contract with getters, the bridge contract triggers data synchronization across L1 and L2, including at the sequencer and state db level.
74
74
75
75
The use of two distinct global exit root manager contracts for L1 and L2, as well as separate logic for the bridge contract and each of these global exit root managers, allows for extensive network interoperability.
76
76
@@ -80,7 +80,7 @@ Meanwhile, all asset transfers can be validated by any L1 and L2 node due to the
80
80
81
81
### L1 to L2
82
82
83
-
1. If a call to the `bridgeAsset` or `bridgeMessage` passes validation, the bridge contract appends an exit leaf to the L1 exit tree and computes the new L1 exit tree root.
83
+
1. If a call to `bridgeAsset` or `bridgeMessage` on L1 passes validation, the bridge contract appends an exit leaf to the L1 exit tree and computes the new L1 exit tree root.
84
84
85
85
2. The global exit root manager appends the new L1 exit tree root to the global exit tree and computes the global exit root.
86
86
@@ -94,9 +94,9 @@ Meanwhile, all asset transfers can be validated by any L1 and L2 node due to the
94
94
95
95
### L2 to L1
96
96
97
-
1. If a `bridgeAsset` or `bridgeMessage`call on the L2 bridge contract validates, the bridge contract appends an exit leaf to the L2 exit tree and computes the new L2 exit tree root.
97
+
1. If a call to `bridgeAsset` or `bridgeMessage` on L2 passes validation, the bridge contract appends an exit leaf to the L2 exit tree and computes the new L2 exit tree root.
98
98
99
-
2. The L2 global exit root manager appends the new L2 exit tree toot to the global exit tree and computes the global exit root. At that point, the caller's bridge transaction is included in one of batches selected and sequenced by the sequencer.
99
+
2. The L2 global exit root manager appends the new L2 exit tree root to the global exit tree and computes the global exit root. At that point, the caller's bridge transaction is included in one of batches selected and sequenced by the sequencer.
100
100
101
101
3. The aggregator generates a zk-proof attesting to the computational integrity in the execution of sequenced batches which include the transaction.
102
102
@@ -110,7 +110,7 @@ Meanwhile, all asset transfers can be validated by any L1 and L2 node due to the
110
110
111
111
### L2 to L2
112
112
113
-
1. When a batch of transactions is processed, the bridge contracts appends the L2 exit tree with a new leaf containing the batch information. This updates the L2 exit tree root.
113
+
1. When a batch of transactions is processed, the bridge contract appends the L2 exit tree with a new leaf containing the batch information. This updates the L2 exit tree root.
114
114
115
115
2. The bridge contracts communicates the L2 exit tree root to the L2 global exit root manager. The L2 global exit root manager, however, does not update the global exit tree at this stage.
Copy file name to clipboardExpand all lines: docs/zkEVM/architecture/high-level/smart-contracts/exit-roots.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
An exit tree is a binary append-only sparse Merkle tree (SMT) whose leaf nodes store bridging data. The exit trees have a depth of 32.
1
+
An exit tree is a binary, append-only, sparse Merkle tree (SMT) whose leaf nodes store bridging data. The exit trees have a depth of 32.
2
2
3
3
Whenever a token or message is bridged, the bridge contract appends an exit leaf to the exit tree related to the specific network.
4
4
@@ -8,7 +8,7 @@ The global exit tree root of the L1 info tree is, therefore, the source of truth
8
8
9
9
## Rollup local exit trees
10
10
11
-
The L2 bridge contract manages a special Merkle tree called a local exit tree for each network that participates in bridging and claiming which is managed and updated by the [PolygonZkEVMGlobalExitRootL2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/etrog/contracts/PolygonZkEVMGlobalExitRootL2.sol) contract.
11
+
The L2 bridge contract manages a special Merkle tree called a local exit tree for each network that participates in bridging and claiming which is updated by the [PolygonZkEVMGlobalExitRootL2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/etrog/contracts/PolygonZkEVMGlobalExitRootL2.sol) contract.
12
12
13
13
<center>
14
14

@@ -17,17 +17,21 @@ The L2 bridge contract manages a special Merkle tree called a local exit tree fo
17
17
Data from `bridgeAsset()` and `bridgeMessage()` calls on the bridge is stored in leaf nodes on the local exit trees.
18
18
19
19
!!! important
20
-
The following exit tree structures are managed by the [PolygonRollupManager.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonRollupManager.sol), the L1 [PolygonZkEVMBridgeV2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMBridgeV2.sol) contract, and the[PolygonZkEVMGlobalExitRootV2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMGlobalExitRootV2.sol).
20
+
The following exit tree structures are managed by:
21
+
22
+
- The [PolygonRollupManager.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonRollupManager.sol).
23
+
- The L1 [PolygonZkEVMBridgeV2.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMBridgeV2.sol) contract.
The roots of the local exit trees feed into a single exit tree that manages state from all participating L2 rollups.
28
+
The roots of the L2 local exit trees feed into a single exit tree that manages state from all participating L2 rollups.
25
29
26
30
<center>
27
31

28
32
</center>
29
33
30
-
The L2 local exit root is accessible on the rollup manager by calling the `getRollupExitRoot()` method.
34
+
The L2 local exit root is accessible on the rollup manager by calling the [`getRollupExitRoot()`](https://github.com/0xPolygonHermez/zkevm-contracts/blob/b2a62e6af5738366e7494e8312184b1d6fdf287c/contracts/v2/PolygonRollupManager.sol#L1620) method.
31
35
32
36
## L1 local exit tree
33
37
@@ -51,7 +55,7 @@ The GER is the fingerprint of the information stored in all trees, and thus repr
51
55
52
56
## Exit leaves
53
57
54
-
Two constants define leaf types in the bridge contract.
58
+
Two constants define transaction leaf types in the bridge contract.
0 commit comments