Skip to content

Commit 3a7f2e6

Browse files
authored
Merge pull request 0xPolygon#321 from 0xPolygon/unified-lxly-bridge
CDK: add unified bridge STB, glossary
2 parents 191a93d + 8b28bcc commit 3a7f2e6

File tree

9 files changed

+177
-22
lines changed

9 files changed

+177
-22
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
The LxLy bridge is the native bridging infrastructure for all CDK chains. The way it works is each individual CDK chain deploys an instance of the LxLy bridge that connects to an L1 (Ethereum by default) by deploying contracts that carry out deposit and withdrawal of assets, along with escrow management. These contracts are managed by node operators corresponding to the respective CDK chains.
2+
3+
This changes as the AggLayer v1 goes online, and introduces an upgrade to the existing LxLy architecture in the form of a _unified instance_ of the LxLy bridge that multiple chains can connect to.
4+
5+
## What's "unified" bridge?
6+
7+
Polygon AggLayer envisions a scalability solution that leverages shared state and unified liquidity across multiple ZK-powered chains within the Polygon ecosystem, all powered by the CDK infrastructure.
8+
9+
!!! tip "What's AggLayer?"
10+
11+
Want to learn more about what AggLayer is and what it looks to achieve? Check out [the AggLayer documentation in the Learn space](../../learn/agglayer.md).
12+
13+
All of this cool infrastructure needs a unified channel for easy transmission of assets and messages between the multiple chains connected via the AggLayer. And this is where the unified bridge comes into play. It allows all chains to take advantage of the AggLayer's unified liquidity, lower transaction costs, and more.
14+
15+
!!! tip "Lxly vs unified bridging TL;DR"
16+
17+
- **LxLy bridge:** A ZK bridge that supports asset and message transfers between a zkEVM system and the L1, typically Ethereum.
18+
- **Unified bridge:** A specific instance of an LxLy bridge that allows several chains to connect to it. This instance is specific to the AggLayer v1.
19+
20+
The new unified model of the LxLy bridge introduced as a part of the AggLayer v1 infrastructure has one significant difference from the existing LxLy bridge: any asset bridged onto a CDK chain using the unified bridge is held by the the **Unified Escrow** (also referred to as the **Master Escrow**) contract instead of a dedicated bridge contract.
21+
22+
!!! info
23+
24+
The master escrow contract is managed and governed by the Polygon zkEVM team.
25+
26+
Due to the shared nature of the bridge, chain operators will not have admin access to the funds locked in the master escrow contract, including the funds that belong to their own network.
27+
28+
The ability to manage bridge reserves is crucial to implement restaking for yield generation and other similar use cases. How does the unified bridge address this?
29+
30+
## Introducing "Stake the Bridge"
31+
32+
Stake the Bridge, or **STB**, is a feature that lets CDK chain operators maintain control over the assets that are deposited to their respective networks.
33+
34+
### Design and implementation
35+
36+
On L1, CDK chains enable STB for an asset by deploying STB contracts on L1 to create an alternative [`L1Escrow`](https://github.com/pyk/zkevm-stb/blob/main/src/L1Escrow.sol) account that holds the asset, and allows the CDK chain operator to manage this token reserve.
37+
38+
On L2 (the CDK chain), there are three components needed to make this work:
39+
40+
- [`L2Token`](https://github.com/pyk/zkevm-stb/blob/main/src/L2Token.sol), which is a natively deployed ERC20 contract.
41+
- [`L2Escrow`](https://github.com/pyk/zkevm-stb/blob/main/src/L2Escrow.sol), a contract that manages the L2Token's supply.
42+
- [`L2TokenConverter`](https://github.com/pyk/zkevm-stb/blob/main/src/L2TokenConverter.sol), the contract that enables converting bridge-wrapped tokens to natively-minted tokens on L2.
43+
44+
!!! info
45+
46+
Each token needs to have its own set of STB contracts that perform the functions described above.
47+
48+
Let's briefly go over the specific actions and characteristics of each STB contract on L1 and L2.
49+
50+
#### `L1Escrow`
51+
52+
- Defines investment strategies.
53+
- Sending token issuance messages to `L2Escrow`.
54+
- Fulfilling redemption messages from `L2Escrow`.
55+
56+
#### `L2Escrow`
57+
58+
- Receives minting instructions from `L1Escrow` via the unified bridge upon token deposit, and prompts `L2Token` contract to mint assets to a given address on L2.
59+
- Burns the native asset on L2 and sends minting instructions to `L1Escrow` to release assets on L1.
60+
61+
#### `L2Token`
62+
63+
- Natively mints L2 tokens and sends them to a designated address.
64+
- Interfaces with the `L2TokenConverter` contract.
65+
66+
#### `L2TokenConverter`
67+
68+
- Supports 1:1 conversion between the STB minted native tokens, and the bridged tokens minted by depositing tokens to LxLy bridge directly on L1.
69+
- Doesn't have a default cap on the token volume that can be converted, can be added by chain operators as necessary.
70+
- An asset can have multiple token converters that can have different properties.
71+
72+
## Roles and responsibilities
73+
74+
There are three roles, each of which performs specific actions to manage the STB system:
75+
76+
- Admin: Can upgrade and pause the system.
77+
- Escrow manager: Can withdraw token backing from the respective escrow contract to invest using the `managerWithdraw()` function.
78+
- Risk manager: Can invoke `setIssuanceCap()` multiple times to increase or reduce the issuance cap.
79+
80+
## STB transaction flow vs. existing LxLy flow
81+
82+
With the STB contracts set up on L1 and L2 for a particular CDK chain, the bridging UX for a user doesn't differ from what it would be if they were carrying it out using the existing LxLy bridge. Let's consider an example using the following tokens:
83+
84+
- USDC - L1
85+
- USDC.e - L2
86+
- LxLy USDC
87+
88+
![](../../img/cdk/stb-1.png)
89+
90+
The diagram above illustrates the following flow:
91+
92+
1. A user initiates a USDC deposit from L1 to L2.
93+
2. Instead of being deposited directly to the unified bridge, the USDC is deposited into the STB `L1Escrow` contract.
94+
3. The STB `L1Escrow` locks the USDC and passes a message to the unified messenger containing the user’s address and amount of USDC being bridged.
95+
4. The `Messenger` contract validates the message and then sends it to the STB `L2Escrow`.
96+
5. The STB `L2Escrow` receives the message and mints USDC.e from the `L2Token` contract.
97+
6. The USDC.e is sent to the user's address on L2.
98+
99+
### Native token conversion
100+
101+
With the introduction of STB, there are now two ways to deposit tokens to an L2 CDK chain, and two distinct resultant tokens:
102+
103+
- The STB flow involves locking tokens in the L1Escrow contract, which is followed by the minting of USDC.e on L2.
104+
- On the other hand, if the tokens are deposited directly into the LxLy bridge contract, it results in the minting of LxLy USDC on L2.
105+
106+
The `L2TokenConverter` facilitates conversion between USDC.e and LxLy USDC. The way it works is by locking (`Deposit` function) either of the tokens in the converter contract, and then sending (`Withdraw` function) the equivalent amount of the other token to the user's wallet.
107+
108+
## Using the STB contracts
109+
110+
The STB contracts grant chain operators control over the token backing in the escrow contracts for all the chains that connect to the Polygon ecosystem via the AggLayer.
111+
112+
!!! warning
113+
114+
Polygon Labs **does not** manage or facilitate the investing of the funds locked in the escrow contracts. The management of funds to implement any investment strategies and risk profiles is completely at the discretion of the chain operators and owners.
115+
116+
Bridging tokens to L2 CDK chains using the STB contracts is ideal for the following use cases:
117+
118+
- Coins that need to implement staking and yield generation mechanisms.
119+
- Coins that need to implement custom L2 functionality.
120+
- Coins that possess native issuance capabilities.
121+
122+
Want to start testing with STB? The contracts are still being audited, but are ready to use on testnets, and can be found here: https://github.com/pyk/zkevm-stb.

docs/cdk/concepts/dac.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/cdk/concepts/rollup.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/cdk/concepts/validium.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/cdk/glossary/index.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
This glossary provides definitions for technical terminology and concepts that commonly occur throughout the CDK docs space.
2+
3+
### AggLayer v1 (AL1)
4+
The AggLayer is the interoperability layer at the heart of Polygon 2.0. All CDK chains connect to the AggLayer to enable features such as seamless and efficient cross-chain communication, unified liquidity, and more. AggLayer v1 (AL1), is the first version of many planned iterations that relies on ZK checks to ensure operational soundness, and a unified bridge infrastructure.
5+
Read more on the AggLayer [here](../../learn/agglayer.md).
6+
7+
### Chain operator
8+
The IP, or individual(s), who own a chain and are responsible for chain operation and maintenance. This includes tasks such as transaction validation, block production, and ensuring the security and integrity of the chain, etc., any combination of which a chain operator may perform personally in varying degrees.
9+
10+
### Data availability
11+
Data availability in the context of modular rollups refers to the idea that transaction callback data needs to be available to L1 network actors where transactions are settled and finalized, so it can be used to verify transaction execution if necessary.
12+
13+
### Data Availability Committee (DAC)
14+
Polygon CDK validiums connect to a DAC to guarantee data availability. The DAC nodes fetch tx data from the sequencer, validate it independently, and then sign it guaranteeing its validity before storing it in the local database. The data remains available to be fetched by other networks actors across all DAC nodes.
15+
16+
### LxLy bridge
17+
The native bridge infrastructure of CDK chains that allows transfer of assets and messages between L2 and L1 (typically Ethereum).
18+
19+
### LxLy messenger
20+
A contract on the LxLy bridge utilizes its message passing capabilities to pass arbitrary messages between L1 and L2. This is not a separate component, and is part of the LxLy bridge's architecture.
21+
22+
### POL (Token)
23+
The POL token powers the Polygon 2.0 ecosystem through a native re-staking protocol that allows token holders to validate multiple chains, and perform multiple roles on each of those chains (sequencing, ZK proof generation, participation in data availability committees, etc.)
24+
25+
### Rollups
26+
Rollups refer to blockchain scaling solutions (in the context of Ethereum) that carry out transaction execution on L2, and then post updated state data to a contract on L1. There are different types rollups, two of the most popular being optimistic, and zero-knowledge (ZK) rollups. Follow the links below to learn more:
27+
28+
- [Optimistic rollups](https://ethereum.org/en/developers/docs/scaling/optimistic-rollups/)
29+
- [ZK rollups](https://ethereum.org/en/developers/docs/scaling/zk-rollups/)
30+
31+
### Stake the Bridge (STB)
32+
A feature of the [unified bridge](#unified-bridge) that lets CDK chain operators maintain control over the assets that are deposited to their respective networks, enabling them to implement staking mechanisms, investment strategies, and other custom features on L2.
33+
34+
### Unified bridge
35+
A specific instance of an LxLy bridge that allows several chains to connect to it. This instance is specific to the [AggLayer v1](#agglayer-v1-al1).
36+
37+
### Unified escrow (Master Escrow)
38+
The unified bridge's escrow contract that holds all the tokens that bridged (locked on L1), and natively minted on L2.
39+
40+
### Validiums
41+
Validiums are a special kind of ZK rollup protocol that handles data availability off-chain instead of posting callback data to base layer Ethereum. CDK chains support deploying and running validium using a Data Availability Committee (DAC) as the DA solution.
42+
Learn more about validiums [here](https://ethereum.org/en/developers/docs/scaling/validium/).

docs/cdk/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,12 @@ hide:
5151
<p class="feature-paragraph">Discover the key differences between the rollup and validium infrastructure options.</p>
5252
</a>
5353
</div>
54+
<div class="grid-item">
55+
<a href="./glossary">
56+
<div class="product-list-item-header">
57+
<div class="feature-card-heading">Glossary</div>
58+
</div>
59+
<p class="feature-paragraph">Learn about commonly used terminology and concepts relevant to the CDK tech stack.</p>
60+
</a>
61+
</div>
5462
</div>

docs/cdk/spec/validium-vs-rollup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Polygon CDK running in validium mode inherits the core functionalities of a zkEVM rollup node and adds a [data availability layer](../concepts/dac.md).
1+
Polygon CDK running in validium mode inherits the core functionalities of a zkEVM rollup node and adds a [data availability layer](../glossary/index.md#data-availability-committee-dac).
22

33
## Key differences
44

55
| | Rollup | Validium |
66
| ------------------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------- |
77
| **Node type** | [zkEVM node](https://github.com/0xPolygonHermez/zkevm-node) | [Validium node](https://github.com/0xPolygon/cdk-validium-node): zkEVM node with validium extensions |
8-
| **Data availability** | On-chain via L1 | Off-chain via a local option, or a [DAC](../concepts/dac.md) + [DA node](https://github.com/0xPolygon/cdk-data-availability) |
8+
| **Data availability** | On-chain via L1 | Off-chain via a local option, or a [DAC](../glossary/index.md#data-availability-committee-dac) + [DA node](https://github.com/0xPolygon/cdk-data-availability) |
99
| **Components** | zkEVM components\* | zkEVM components\* + PostgreSQL database + on-chain committees |
1010
| **Contracts** | [zkEVM smart contracts](https://github.com/0xPolygonHermez/zkevm-contracts) <ul><li>`PolygonZkEVM` (main rollup contract)</li> <li> `PolygonZkEVMBridge`</li> <li>`PolygonZkEVMGlobalExitRoot`</li></ul> | [Validium-specific DAC contract](https://github.com/0xPolygon/cdk-validium-contracts) <ul><li>`CDKDataCommittee.sol`</li><li> `CDKValidium.sol` </li></ul> |
1111
| **Infrastructure** | Standard infrastructure | Dedicated infrastructure for data availability layer and DACs |

docs/img/cdk/stb-1.png

80 KB
Loading

mkdocs.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,11 @@ nav:
8989
- Architecture:
9090
- CDK rollup: cdk/architecture/cdk-zkevm.md
9191
- CDK validium: cdk/architecture/cdk-validium.md
92+
- Unified bridge - STB: cdk/architecture/staking-the-bridge.md
9293
- Specification:
9394
- Validium vs rollup: cdk/spec/validium-vs-rollup.md
94-
- Concepts:
95-
- Rollup: cdk/concepts/rollup.md
96-
- Validium: cdk/concepts/validium.md
97-
- Data availability: cdk/concepts/dac.md
95+
- Glossary:
96+
- Glossary: cdk/glossary/index.md
9897
- Additional resources:
9998
- Third-party guides: cdk/resources/third-party-guides.md
10099
- CDK repos: cdk/resources/cdk-repo-reference.md

0 commit comments

Comments
 (0)