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/agglayer/unified-bridge.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
## Introduction to the Unified Bridge
2
2
3
-
The Unified Bridge (Prev. LxLy bridge) is an interoperability layer aimed at enabling cross-chain communication among AggLayer connected chains. It enables the interaction between different networks such as L2 to L2, L1 to L2, and L2 to L1.
3
+
The Unified Bridge (prev. LxLy bridge) is an interoperability layer aimed at enabling cross-chain communication among AggLayer connected chains. It enables the interaction between different networks such as L2 to L2, L1 to L2, and L2 to L1.
4
4
5
5
### Why do we need a Unified Bridge?
6
6
7
7
The Unified Bridge is needed to enable cross-chain communication among different networks to solve the problem of fragmentation as well as to initiate one-step cross-chain transactions for seamless UX.
8
8
9
-
For **the AggLayer**, it is a critical component to facilitate unified experience among AggLayer-connected chains. In the process of cross-chain communication, the Unified Bridge is the interface for developers and users to initiate cross-chain transactions, which the AggLayer will then monitor and validate the validity of via a Pessimistic Proof. Once validated, the cross-chain message will be accepted and ready to be claimed on the destination chain.
9
+
For the **AggLayer**, it is a critical component to facilitate unified experience among AggLayer-connected chains. In the process of cross-chain communication, the Unified Bridge is the interface for developers and users to initiate cross-chain transactions, which the AggLayer will then monitor and validate the validity of via a Pessimistic Proof. Once validated, the cross-chain message will be accepted and ready to be claimed on the destination chain.
10
10
11
11
## Unified Bridge: Data Structure
12
12
@@ -17,7 +17,7 @@ The AggLayer maintains a merkle tree to record all cross-chain transactions and
17
17
18
18
### Local Exit Root & Local Index
19
19
20
-
All cross-chain transactions using the Unified Bridge are recorded in a Sparse Merkle Tree called the Local Exit Tree. Each AggLayer-connected chain maintains its own local exit tree. This is maintained in [`PolygonZKEVMBridgeV2.sol`](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMBridgeV2.sol) on each AggLayer-connected L2 and L1.
20
+
All cross-chain transactions using the Unified Bridge are recorded in a Sparse Merkle Tree called the Local Exit Tree. Each AggLayer-connected chain maintains its own local exit tree. This is maintained in the [`PolygonZKEVMBridgeV2.sol`](https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonZkEVMBridgeV2.sol) contract on each AggLayer-connected L2 and L1.
21
21
22
22
-`Local Exit Root(LET)`: The root of the tree is called the local exit root. It is a binary tree with a height of 32. The root is updated every time a new cross-chain transaction is initiated.
23
23
@@ -148,7 +148,7 @@ function bridgeAsset(
148
148
)
149
149
```
150
150
151
-
The code goes through a few steps to complete the bridging process:
151
+
These steps complete the bridging process:
152
152
1. Check the `destinationNetwork` is not set as the source network's ID.
153
153
2. Prepare tokens to be bridged.
154
154
@@ -204,7 +204,7 @@ function claimAsset(
204
204
)
205
205
```
206
206
207
-
Before the `claimAsset` function is initiated, all of these inputs must be prepared:
207
+
Before the `claimAsset` function is initiated, these inputs must be satisfied:
208
208
209
209
- Both `smtProofLocalExitRoot` and `smtProofRollupExitRoot` can be fetched via the **Proof Generation API**, the `depositCount` param for the Proof API is located at the fetch result of **Transaction API**, is your bridge transaction's `counter` field in the response.
210
210
- `GlobalIndex` can be constructed as described in**Global Exit Root, L1 Info Tree, Global Index**
@@ -270,7 +270,7 @@ function bridgeMessageWETH(
270
270
)
271
271
```
272
272
273
-
The code will go through a few steps tocomplete the bridging process:
273
+
These steps complete the bridging process:
274
274
275
275
1. Check value condition:
276
276
- [For `BridgeMessage`], if the custom gas token exist in the source chain, then this functionis only callable without value. A value should only be transferable via this functionif the native gas token is `ETH`
@@ -378,7 +378,7 @@ function bridgeAndCall(
378
378
) external payable
379
379
```
380
380
381
-
the code will go through a few steps tocomplete the bridging process:
381
+
These steps complete the bridging process:
382
382
383
383
1. Preparing Bridging Tokens:
384
384
- When the source chain's gas token is not `ETH`, then send `WETH` from sender address to the bridge extension contract
@@ -404,7 +404,7 @@ function onMessageReceived(
404
404
) external payable
405
405
```
406
406
407
-
Note: this function is called when calling `claimMessage` on the destination chain; it's only callable by the Bridge Contract.
407
+
Note: This function is called when calling `claimMessage` on the destination chain; it's only callable by the Bridge Contract.
408
408
409
409
1. Access control, making sure its Bridge Contract Calling, and the message origin on the source chain is also bridge contract.
410
410
@@ -436,11 +436,11 @@ constructor(
436
436
) payable
437
437
```
438
438
439
-
The assets transferred from the source chain via `bridgeAsset` should have already transferred to this new jumpPoint Smart contract on the destination chain.
439
+
The assets transferred from the source chain via `bridgeAsset` should have already transferred to this new jumpPoint smart contract on the destination chain.
440
440
441
-
1. Once instantiated, check that the asset that was transferred to `this`, whether it is a `ETH` token, `WETH` token, Custom Gas Token, or ERC-20 token.
442
-
2. Depending on the token type, transfer the token accordingly to the final `callAddress`, and thendo the smart contract call with `callData`
443
-
3. If the execution fails on the `callAddress` contract, tokens are transferred to `fallbackAddress`.
441
+
1. Once instantiated, check that the asset that was transferred to the jumpPoint smart contract, whether it is a `ETH` token, `WETH` token, Custom Gas Token, or ERC-20 token.
442
+
2. Depending on the token type, transfer the token accordingly to the final `callAddress`, and thenperform the smart contract call with `callData`
443
+
3. If the execution fails on the `callAddress` contract, tokens are transferred to `fallbackAddress`
444
444
445
445
## Security of the Unified Bridge
446
446
- **Secured by Ethereum**: Settlement on Ethereum
@@ -466,6 +466,8 @@ The assets transferred from the source chain via `bridgeAsset` should have alrea
466
466
467
467
The bridge contract can only mint, burn, or transfer assets through user-initiated bridge transactions. There is no administrative control over assets locked in the bridge contract. Only users with a balance of the specific tokens have access to their respective assets.
468
468
469
+
The supply of tokens shown on an individual chain’s contracts may be much higher than what has actually been deposited; this is an implementation detail to provide a sufficient virtual balance to handle any bridging activity. These figures do not reflect the circulating supply. The actual movement of tokens is strictly controlled by cryptographic proofs, mathematical constraints, and the immutable total supply of that particular token.
470
+
469
471
To learn more about the actions for different types of tokens (gas token, ETH, ERC-20 tokens, etc), refer to the above [specs](#assets-bridging)
0 commit comments