Skip to content

Commit 97bc877

Browse files
EmpieichOhsutaiyu
andauthored
Apply suggestions from code review
Co-authored-by: hsutaiyu <51791408+hsutaiyu@users.noreply.github.com>
1 parent de91473 commit 97bc877

File tree

6 files changed

+56
-56
lines changed

6 files changed

+56
-56
lines changed
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
The LXLY bridge is an interoperability solution aimed at enabling cross-chain communication among Polygon chains. It will enable communication between two L2 chains or between an L2 chain and Ethereum as the L1.
1+
The LxLy bridge is an interoperability solution aimed at enabling cross-chain communication among Polygon chains. It facilitates interaction between two L2 chains or between an L2 chain and Ethereum as the L1.
22

3-
The LXLY bridge SC (or [PolygonZkEVMBridgeV2](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/v2/PolygonZkEVMBridgeV2.sol)) is an improved and a more robust version of the [zkEVM bridge](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVMBridge.sol) deployed in the Polygon zkEVM mainnet_beta version_.
3+
The LxLy bridge SC (or [PolygonZkEVMBridgeV2](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/v2/PolygonZkEVMBridgeV2.sol)) is an improved and a more robust version of the [zkEVM bridge](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVMBridge.sol) deployed in the Polygon zkEVM mainnet_beta version_.
44

55
Its modular design capacitates projects to deploy their own rollups and connect them to the Polygon ecosystem.
66

77
## Ideal attributes
88

9-
The LXLY bridge is deployed in the Polygon ecosystem so as to attain the following features and functionalities;
9+
The LxLy bridge is deployed in the Polygon ecosystem to enable the following features and functionalities:
1010

1111
- **Accessibility**: Projects can request creation of a rollup and connect it to the Polygon ecosystem.
1212
- **Unified liquidity**: All rollups can connect through the same bridge, enabling L2 to L2 bridges.
1313
- **Polygon CDK**: All the rollups can use the same stack.
1414
- **Rollup-project oriented**: Every project can have its own rollup.
15-
- **Cross-rollup communication**: All the rollups can communicate using the LxLy bridge.
15+
- **Cross-rollup communication**: All the rollups connect and communicate using the LxLy bridge, enabling seamless L2 to L2 bridging.
1616
- **Rollup upgradability**: All the deployed rollups should be upgradeable in accordance with its own governance mechanism.
1717

1818
These functionalities are accomplished by modifying a few key components in the architecture of the zkEVM bridge version-1.
@@ -21,69 +21,69 @@ These functionalities are accomplished by modifying a few key components in the
2121

2222
Here is a brief review of the zkEVM bridge's architecture.
2323

24-
Version-1 consists mainly of three (3) smart contracts;
24+
Version-1 consists mainly of three (3) smart contracts:
2525

26-
- the bridge contract ([PolygonZkEVMBridge.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVMBridge.sol)), which handles transfer of assets and messages between networks.
27-
- the Global Exit Root manager contract ([PolygonZkEVMGlobalExitRoot.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVMGlobalExitRoot.sol)), which facilitates synchronization of state-info between the L2 and the L1.
28-
- the Polygon zkEVM Consensus contract ([PolygonZkEVM.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVM.sol)), which handles the sequencing and verification of transactions in the form of batches.
26+
- The bridge contract ([PolygonZkEVMBridge.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVMBridge.sol)), which handles transfer of assets and messages between networks.
27+
- The global exit root manager contract ([PolygonZkEVMGlobalExitRoot.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVMGlobalExitRoot.sol)), which facilitates synchronization of state-info between the L2 and the L1.
28+
- The Polygon zkEVM consensus contract ([PolygonZkEVM.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/PolygonZkEVM.sol)), which handles the sequencing and verification of transactions in the form of batches.
2929

3030
### Global exit trees review
3131

32-
Critical to the design of the LXLY bridge are exit trees and the Global exit tree.
32+
Critical to the design of the LxLy bridge are exit trees and the global exit tree.
3333

3434
Each chain has a Merkle tree called an _exit tree_, to which a leaf containing data of each asset-transfer is appended. Since such a leaf records data of the asset exiting the chain, it is called an _Exit Leaf_.
3535

36-
Another Merkle tree whose leaves are roots of the various exit trees is formed, and it is called the _Global exit tree_.
36+
Another Merkle tree whose leaves are roots of the various exit trees is formed, and it is called the _global exit tree_.
3737

38-
The root of the Global exit tree is the single source of state-truth communicated between rollups.
38+
The root of the global exit tree is the single source of state-truth communicated between rollups.
3939

40-
It is the Global Exit Root manager contract's responsibility to update the Global exit tree root and acts as a custodian for the Global exit tree's history.
40+
It is the global exit root manager contract's responsibility to update the global exit tree root and acts as a custodian for the global exit tree's history.
4141

42-
A complete transfer of assets in version-1 involves three smart contracts; the PolygonZkEVM.sol, the PolygonZkEVMBridge.sol and the PolygonZkEVMGlobalExitRoot.sol.
42+
A complete transfer of assets in version-1 involves invoking three smart contracts; `PolygonZkEVM.sol`, `PolygonZkEVMBridge.sol` and `PolygonZkEVMGlobalExitRoot.sol`.
4343

4444
The below figure depicts a _bridge_ of assets and a _claim_ of assets;
4545

4646
![Figure 1: An asset transfer and three Smart Contracts](../../../../img/zkEVM/lxly-1-v1-asset-transfer.png)
4747

48-
Observe, in the above figure, that the Consensus contract (PolygonZkEVM.sol) is able to;
48+
Observe, in the above figure, that the consensus contract (`PolygonZkEVM.sol`) is able to:
4949

50-
- Retrieve the Global exit root from the mainnet, and make it available in L2, and
51-
- Update the exit tree root in the Global exit tree root manager.
50+
- Retrieve the global exit root from the mainnet, and make it available in L2
51+
- Update the exit tree root in the global exit tree root manager.
5252

53-
## LXLY bridge version-2 design
53+
## LxLy bridge version-2 design
5454

55-
Multiple zk-rollups such as zkEVMs, zk-Validiums or zk-VMs, can be created and connected through the same LXLY ridge.
55+
Multiple ZK rollups such as zkEVMs, zk-Validiums or zk-VMs, can be created and connected through the same LxLy bridge.
5656

57-
Thanks to the introduction of an additional smart contract called the [_Rollup manager_ SC](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/v2/PolygonRollupManager.sol).
57+
Thanks to the introduction of an additional smart contract called the [_rollup manager_](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/v2/PolygonRollupManager.sol).
5858

59-
Although the logic for _bridging_ or _claiming_ assets from one network to another remains the same, individual L2 Consensus SC no longer handle verification of their own network's sequenced batches.
59+
Although the logic for _bridging_ or _claiming_ assets from one network to another remains the same, individual L2 consensus contracts no longer handle verification of their own network's sequenced batches.
6060

61-
In the LXLY bridge context, the _Rollup manager_ SC verifies sequenced batches from various networks.
61+
In the context of the LxLy bridge, the _rollup manager_ contract verifies sequenced batches from various networks.
6262

63-
In addition to verification of sequenced batches, the _Rollup manager_ SC also creates consensus contracts for networks connecting via the LXLY bridge.
63+
In addition to verification of sequenced batches, the _rollup manager_ contract also creates consensus contracts for networks connecting via the LxLy bridge.
6464

6565
### What remains unchanged from version-1?
6666

67-
The strategy to separate the _bridge logic_ from the _Global exit root logic_ remains intact. This is key to achieving interoperability.
67+
The strategy to separate the _bridge logic_ from the _global exit root logic_ remains intact. This is key to achieving interoperability.
6868

69-
Consensus contracts of each connected network handle the sequencing of their own batches, but send the Batch Data to the _Rollup manager_ SC for verification.
69+
Consensus contracts of each connected network handle the sequencing of their own batches, but send the batch data to the _rollup manager_ contract for verification.
7070

71-
The _Rollup manager_ SC stores the information of the sequenced batches in the form of a so-called _Accumulated Input Hash_, as in the version-1 of the zkEVM bridge.
71+
The _rollup manager_ contract stores the information of the sequenced batches in the form of an _accumulated input hash_, as in the version-1 of the zkEVM bridge.
7272

73-
Once sequenced batches have been verified, the _Global exit tree_ gets updated, in an approach similar to the zkEVM bridge version-1.
73+
Once sequenced batches have been verified, the _global exit tree_ gets updated, in an approach similar to the zkEVM bridge version-1.
7474

7575
![Figure 2: New version of bridge](../../../../img/zkEVM/lxly-2-new-bridge-design.png)
7676

7777
### Rollup manager's role
7878

79-
The Rollup manager is in charge of the following lists of availability;
79+
The rollup manager is in charge of the following lists of availability:
8080

81-
- Rollup consensus mechanisms. The list may consist of Consensus contracts such as PolygonZkEVM.sol or zkValidium.sol.
82-
- Verifier contracts. For example, the PolygonZkEVM.sol uses the _Verifier.sol_ SC for verification of batches.
81+
- Rollup consensus mechanisms: The list may consist of consensus contracts such as `PolygonZkEVM.sol` or `zkValidium.sol`.
82+
- Verifier contracts: For example, the `PolygonZkEVM.sol` uses the `Verifier.sol` contract for verification of batches.
8383

84-
Governance SC oversees Consensus mechanisms and Verifiers that can be added to the respective lists.
84+
The governance contract oversees consensus mechanisms and verifiers that can be added to the respective lists.
8585

86-
The [Rollup manager SC](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/v2/PolygonRollupManager.sol) has the relevant function for adding a new rollup;
86+
The [rollup manager contract](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/v2ForkID5/contracts/v2/PolygonRollupManager.sol) has the relevant function for adding a new rollup:
8787

8888
```bash
8989
function addNewRollupType(
@@ -96,34 +96,34 @@ The [Rollup manager SC](https://github.com/0xPolygonHermez/zkevm-contracts/blob/
9696
) ...
9797
```
9898

99-
- In order for a rollup to be created and connected to the LXLY bridge,
99+
- To create and connect a rollup to the LxLy bridge,
100100

101-
- The developer selects the Consensus and Verifier for the required rollup amongst those available in the Rollup manager's lists,
101+
- The developer selects the consensus and verifier for the required rollup amongst those available in the rollup manager's lists,
102102
- Requests creation of a rollup with the selected specifications,
103-
- Governance SC invokes the Rollup manager's `addNewRollupType()` function,
104-
- Once, a rollup is created, the transfer of assets can be processed in the usual manner.
103+
- Governance contract invokes the rollup manager's `addNewRollupType()` function,
104+
- Once a rollup is created, the transfer of assets can be processed in the usual manner.
105105

106106
### Overall flow of events
107107

108-
The below diagram captures the following flow of events, most of which are handled by the Rollup manager SC;
108+
The following diagram captures the following flow of events, most of which are handled by the rollup manager contract:
109109

110-
- Updating Rollup manager's lists,
111-
- Creating rollups,
112-
- Sequencing of batches,
113-
- Aggregation or proving of batches,
114-
- Verification of batches,
115-
- Updating the Global exit root.
110+
- Updating rollup manager's lists.
111+
- Creating rollups.
112+
- Sequencing of batches.
113+
- Aggregation or proving of batches.
114+
- Verification of batches.
115+
- Updating the global exit root.
116116

117117
![Figure 3: Events flow related to RollupManager.sol](../../../../img/zkEVM/lxly-bridge-diagram.png)
118118

119119
## Conclusion
120120

121-
Although the LXLY bridge is still in development, it is a central component to Polygon's aggregaton layer which offers multi-chain interoperability.
121+
Although the LxLy bridge is still in development, it is a central component to the AggLayer which offers multi-chain interoperability.
122122

123-
The LXLY bridge currently works with the Polygon zkEVM as the L2 and the Ethereum network as L1.
123+
The LxLy bridge currently works with the Polygon zkEVM as the L2 and the Ethereum network as L1.
124124

125125
The next step is to enable developers wishing to create a zk-rollup to choose between a zkEVM and a zkValidium rollup.
126126

127127
The idea of handling verification of several networks in a single contract, is a pre-cursor to the ultimate and envisaged _interop layer_ for the Polygon ecosystem.
128128

129-
The code for the LXLY bridge version-2 can be found [here](https://github.com/0xPolygonHermez/zkevm-contracts/tree/feature/v2ForkID5/contracts/v2).
129+
The code for the LxLy bridge version-2 can be found [here](https://github.com/0xPolygonHermez/zkevm-contracts/tree/feature/v2ForkID5/contracts/v2).

docs/zkEVM/architecture/protocol/unified-LxLy/ulxly-exit-trees-node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Every rollup has a set of distinct identifiers that are essential for its functi
3131

3232
When creating and verifying proofs, an index called $\texttt{globalIndex}$ is used to uniquely locate a leaf in the new global exit tree.
3333

34-
A $\texttt{globalIndex}$​​​ is a 256-bit string composed of; unused bits, mainnet flag, rollup index bits and local root index bits.
34+
A $\texttt{globalIndex}$​​​ is a 256-bit string composed of unused bits, mainnet flag, rollup index bits, and local root index bits.
3535

3636
$$
3737
\texttt{globalIndex} = \texttt{(unused bits)_} \texttt{(mainnet flag)_} \texttt{(rollupIndex)_} \texttt{(local root index)}

docs/zkEVM/architecture/zkprover/hashing-state-machines/keccakf-sm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ $$
8787
\mathtt{P = 1 \mid\mid 0^{1088+j} \mid\mid 1}.
8888
$$
8989

90-
!!!Note
90+
!!! note
9191

9292
It should be noted that our construction does not follow the FIPS-202 based standard (a.k.a SHA-3).
9393

docs/zkEVM/architecture/zkprover/hashing-state-machines/paddingkk-bit-sm.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ A block of 136 rows of bytes in the Padding-KK SM corresponds to $\mathtt{1993}$
1414

1515
![Figure 1: Padding-KK block vs. Padding-KK-Bit's 3 subdivisions](../../../../img/zkEVM/01kkb-chunk-divs-136-bytes.png)
1616

17-
**First subdivision:** Consists of $\mathtt{9*136 = 1224}$ rows, where each of the $\mathtt{136}$ byte-rows has been expanded into $\mathtt{9}$ rows (i.e., $\mathtt{8}$ rows for the $\mathtt{8}$ bits plus $\mathtt{1}$ row for the byte that represents the $\mathtt{8}$ bits). The decomposition of the bytes into the 8 bits (with an extra row, just for the byte), is done for easy implementation in PIL. This subdivision of $\mathtt{1224}$ rows represents the bitrate of the KECCAK-F permutation. Therefore, a strategy to ensure that the bits are accurately and correctly provided, as input to the KECCAK-F SM, needs to be derived.
17+
First subdivision: Consists of $\mathtt{9*136 = 1224}$ rows, where each of the $\mathtt{136}$ byte-rows has been expanded into $\mathtt{9}$ rows (i.e., $\mathtt{8}$ rows for the $\mathtt{8}$ bits plus $\mathtt{1}$ row for the byte that represents the $\mathtt{8}$ bits). The decomposition of the bytes into the 8 bits (with an extra row, just for the byte), is done for easy implementation in PIL. This subdivision of $\mathtt{1224}$ rows represents the bitrate of the KECCAK-F permutation. Therefore, a strategy to ensure that the bits are accurately and correctly provided, as input to the KECCAK-F SM, needs to be derived.
1818

19-
**Second subdivision:** Consists of the $\mathtt{512}$ rows, and represents the capacity input-bits in the $\mathtt{1600}$-bit state of the KECCAK-F SM. Within the KECCAK-F state machine, unlike the bits in the first subdivision of $\mathtt{1224}$ rows, the capacity bits are not affected by any exterior bits.
19+
Second subdivision: Consists of the $\mathtt{512}$ rows, and represents the capacity input-bits in the $\mathtt{1600}$-bit state of the KECCAK-F SM. Within the KECCAK-F state machine, unlike the bits in the first subdivision of $\mathtt{1224}$ rows, the capacity bits are not affected by any exterior bits.
2020

21-
**Third subdivision:** Consists of $\mathtt{256 + 1}$ rows represents the 256 bits of the intermediate hash value produced by the KECCAK-F permutation. At the end of hashing each 1088 bits (136-byte) string, this intermediate hash value actually coincides with the final hash of the KECCAK-256 hash function. Each hash value, the final digest, is packed into eight 32-bit registers at the final row of this subdivision.
21+
Third subdivision: Consists of $\mathtt{256 + 1}$ rows represents the 256 bits of the intermediate hash value produced by the KECCAK-F permutation. At the end of hashing each 1088 bits (136-byte) string, this intermediate hash value actually coincides with the final hash of the KECCAK-256 hash function. Each hash value, the final digest, is packed into eight 32-bit registers at the final row of this subdivision.
2222

2323
### Bytes to bits correspondence
2424

docs/zkEVM/architecture/zkprover/hashing-state-machines/poseidon-sm.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ Here, the input vector (_in0_, _in1_, ... , _in7_, _hashType_, _cap1_, _cap2_, _
132132

133133
The Polygon zkEVM Repository is available here: [Polygon zkEVM on GitHub](https://github.com/0xPolygonHermez)
134134

135-
_Poseidon SM executor_: [sm_poseidong.js](https://github.com/0xPolygonHermez/zkevm-proverjs/blob/main/src/sm/sm_poseidong.js)
135+
Poseidon SM executor: [sm_poseidong.js](https://github.com/0xPolygonHermez/zkevm-proverjs/blob/main/src/sm/sm_poseidong.js)
136136

137-
_Poseidon SM PIL_: [poseidong.pil](https://github.com/0xPolygonHermez/zkevm-proverjs/blob/main/pil/poseidong.pil)
137+
Poseidon SM PIL: [poseidong.pil](https://github.com/0xPolygonHermez/zkevm-proverjs/blob/main/pil/poseidong.pil)
138138

139-
_Test vectors_: [poseidong_test.js](https://github.com/0xPolygonHermez/zkevm-testvectors/tree/main/test/poseidon)
139+
Test vectors: [poseidong_test.js](https://github.com/0xPolygonHermez/zkevm-testvectors/tree/main/test/poseidon)

docs/zkEVM/architecture/zkprover/main-state-machine/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ It is a piece of software, composed of a set of instructions, which implements a
1616

1717
All EVM opcodes are interpreted in the ROM, as well as interpretation of batches and the execution logic of transactions. The ROM is therefore the interpreter of all opcodes to the Polygon zkEVM, allowing the main SM to execute Polygon zkEVM's L2 state transitions with _computational integrity_.
1818

19-
!!!info
19+
!!! info
2020
In order to avoid any misunderstandings in the future, it is helpful to distinguish between the set of ROM instructions and EVM opcodes:
2121

22-
**ROM Instructions**: Set of instructions created and developed by Polygon to target a ”special” zero-knowledge virtual machine (main SM) that can execute computations with probable _computational integrity_.
22+
ROM Instructions: Set of instructions created and developed by Polygon to target a ”special” zero-knowledge virtual machine (main SM) that can execute computations with probable _computational integrity_.
2323

24-
**EVM opcodes**: Set of instructions designed to target the EVM, used to define smart contract’s computations.
24+
EVM opcodes: Set of instructions designed to target the EVM, used to define smart contract’s computations.
2525

2626
Although zkASM instructions and EVM opcodes are different types of instructions, the Polygon zkEVM's ROM contains a piece of code written in zkASM instructions to implement each EVM opcode.
2727

0 commit comments

Comments
 (0)