Skip to content

Commit 884d69c

Browse files
authored
Merge pull request 0xPolygon#654 from 0xPolygon/empieichO-docs-review
zkEVM docs update as per team review
2 parents d55ac1e + 454787f commit 884d69c

File tree

18 files changed

+122
-103
lines changed

18 files changed

+122
-103
lines changed

docs/cdk/agglayer/unified-bridge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The unified bridge is a single bridge contract on Ethereum, providing a safe, co
88

99
## Bridging mechanism
1010

11-
The bridging mechanism enables token transfers and message-passing between Ethereum (L1) and CDK chains via smart contracts. Detailed in the [zkEVM bridging documentation](../../zkEVM/architecture/high-level/smart-contracts/bridging.md), core components include the bridge and exit root Solidity smart contracts.
11+
The bridging mechanism enables token transfers and message-passing between Ethereum (L1) and CDK chains via smart contracts. Detailed in the [zkEVM bridging documentation](../../zkEVM/architecture/high-level/unified-LxLy/bridging.md), core components include the bridge and exit root Solidity smart contracts.
1212

1313
## Data structures
1414

docs/cdk/concepts/bridging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CDK-built chains come with a built-in bridge service and customizable UI out of
88

99
The LxLy bridge contracts carry out deposit and withdrawal of assets between L2 and L1.
1010

11-
Chains looking to run their own bridge infrastructure can choose to deploy a new instance of the [LxLy bridge](../../zkEVM/architecture/protocol/unified-LxLy/lxly-bridge.md) that allows users to move assets (both native and [ERC20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) tokens) from L1 to the L2 and vice versa.
11+
Chains looking to run their own bridge infrastructure can choose to deploy a new instance of the [LxLy bridge](../../zkEVM/architecture/high-level/unified-LxLy/lxly-bridge.md) that allows users to move assets (both native and [ERC20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) tokens) from L1 to the L2 and vice versa.
1212

1313
Deploying an individual instance of the LxLy means interoperability with other L2 chains via the [AggLayer](../agglayer/overview.md) is not possible. To enable cross-chain interoperability (i.e. L2-to-L2 cross-chain transactions), chains can opt-in to the AggLayer and use the [unified bridge](../agglayer/unified-bridge.md).
1414

@@ -31,5 +31,5 @@ This option is suited to chains that want a standard bridging experience and do
3131
## Further reading
3232

3333
- [Aggregated blockchains: A new thesis](https://polygon.technology/blog/aggregated-blockchains-a-new-thesis).
34-
- [LxLy bridge](../../zkEVM/architecture/protocol/unified-LxLy/lxly-bridge.md).
34+
- [LxLy bridge](../../zkEVM/architecture/high-level/unified-LxLy/lxly-bridge.md).
3535
- [Unified bridge Ooverview](../agglayer/unified-bridge.md).

docs/zkEVM/architecture/high-level/smart-contracts/exit-roots.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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) with a maximum depth of 32, where leaf nodes store bridging data.
22

33
The Merkle root of an exit tree is known as the exit tree root, and it is the fingerprint of all the information recorded in the exit tree's leaf nodes.
44

@@ -71,7 +71,7 @@ uint8 private constant _LEAF_TYPE_ASSET = 0;
7171
uint8 private constant _LEAF_TYPE_MESSAGE = 1;
7272
```
7373

74-
Data in a leaf contains a Keccak256 hash of the metadata (ABI encoded metadata if any) and the following parameters (matched by publicly available transaction data as seen in the [bridge L1 to L2](bridging.md#l1-to-l2) documentation):
74+
Data in a leaf contains a Keccak256 hash of the metadata (ABI encoded metadata if any) and the following parameters (matched by publicly available transaction data as seen in the [bridge L1 to L2](../unified-LxLy/bridging.md#l1-to-l2) documentation):
7575

7676
```solidity
7777
_addLeaf(

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ The diagram below shows the sequencing workflow for rollup (non-validium) stacks
1313

1414
![Polygon Solidity smart contract architecture](../../../../img/cdk/high-level-architecture/sequencing-flow.png)
1515

16-
## `sequenceBatches(batches, maxSequenceTs, initSequenceBatch, l2Coinbase)`
16+
## `sequenceBatches()`
1717

18-
This function is called on the `PolygonZkEVMEtrog.sol` contract.
18+
The `sequenceBatches()` function is called on the `PolygonZkEVMEtrog.sol` contract:
19+
20+
```
21+
sequenceBatches(batches, maxSequenceTs, initSequenceBatch, l2Coinbase)
22+
```
1923

2024
The rollup sequencer component calls the [`sequenceBatches`](https://github.com/0xPolygonHermez/zkevm-contracts/blob/1ad7089d04910c319a257ff4f3674ffd6fc6e64e/contracts/v2/lib/PolygonRollupBaseEtrog.sol#L425) function on the [`PolygonZkEVMEtrog.sol`](https://github.com/0xPolygonHermez/zkevm-contracts/blob/1ad7089d04910c319a257ff4f3674ffd6fc6e64e/contracts/v2/consensus/zkEVM/PolygonZkEVMEtrog.sol) contract which inherits the function from [PolygonRollupBaseEtrog.sol](https://github.com/0xPolygonHermez/zkevm-contracts/blob/1ad7089d04910c319a257ff4f3674ffd6fc6e64e/contracts/v2/lib/PolygonRollupBaseEtrog.sol).
2125

@@ -45,9 +49,13 @@ Stepwise, the function does the following:
4549
1. Calls the `PolygonRollupManager.onSequenceBatches(...)` function which waits for an `OnSequenceBatches(...)` event callback.
4650
1. Emits `SequenceBatches(...)` event.
4751

48-
## `onSequenceBatches(newSequencedBatches, newAccInputHash)`
52+
## `onSequenceBatches()`
4953

50-
This function is called on the `PolygonRollupManager.sol` contract.
54+
The `onSequenceBatches()` function is called on the `PolygonRollupManager.sol` contract:
55+
56+
```
57+
onSequenceBatches(newSequencedBatches, newAccInputHash)
58+
```
5159

5260
It takes the sequenced batches and the accumulated hash from the calling contract, adds the batches to the correct stack, and updates the batch count.
5361

@@ -59,13 +67,18 @@ Stepwise, the function does the following:
5967
1. Attempts to consolidate pending state for the rollup by updating `lastVerifiedBatch`, `batchNumToStateRoot[]`, and `lastLocalExitRoot` state variables, and also by updating `globalExitRootManager.updateExitRoot(L2sLocalExitRoot)`, after which it emits a `ConsolidatePendingState(...)` event.
6068
1. Emits an `OnSequenceBatches(...)` event back to the original `sequenceBatches(...)` call.
6169

62-
## `sequenceBatchesValidium(batches, l2Coinbase, dataAvailabilityMessage)`
70+
## `sequenceBatchesValidium()`
71+
72+
The `sequenceBatchesValidium()` function is called on the `PolygonValidiumEtrog.sol` contract:
73+
74+
```
75+
sequenceBatchesValidium(batches, l2Coinbase, dataAvailabilityMessage)
76+
```
6377

6478
!!! info
6579
- This function is not included in the sequence diagram above.
6680
- The differences, however, are minimal.
6781

68-
This function is called on the `PolygonValidiumEtrog.sol` contract.
6982

7083
The sequencing logic is nearly the same as for the rollup `sequenceBatches(...)` function except the function takes a `ValidiumBatchData[]` array instead of `BatchData[]`. This means that, instead of passing the actual transaction data, the struct passes the hashes of the transactions.
7184

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ The sequence diagram below shows the verification workflow for rollup stacks and
1313

1414
![Polygon Solidity consensus verification flow](../../../../img/cdk/high-level-architecture/verification-flow.png)
1515

16-
## `verifyBatchesTrustedAggregator(rollupID, pendingStateNum, initNumBatch, finalNewBatch, newLocalExitRoot, newStateRoot, beneficiary, proof)`
16+
## `verifyBatchesTrustedAggregator()`
1717

18-
This function is called on the `PolygonRollupManager` contract.
18+
The `verifyBatchesTrustedAggregator()` function is called on the `PolygonRollupManager` contract:
19+
20+
```
21+
verifyBatchesTrustedAggregator(rollupID, pendingStateNum, initNumBatch,
22+
finalNewBatch, newLocalExitRoot, newStateRoot, beneficiary, proof)
23+
```
1924

2025
The zkEVM node aggregator, or the AggLayer, calls the [`verifyBatchesTrustedAggregator`](https://github.com/0xPolygonHermez/zkevm-contracts/blob/b2a62e6af5738366e7494e8312184b1d6fdf287c/contracts/v2/PolygonRollupManager.sol#L921) function on the [`PolygonRollupManager.sol`](https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/etrog/contracts/v2/PolygonRollupManager.sol) contract.
2126

docs/zkEVM/architecture/high-level/smart-contracts/bridging.md renamed to docs/zkEVM/architecture/high-level/unified-LxLy/bridging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The data below is transaction data (represented by a leaf node in an exit tree)
9393

9494
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.
9595

96-
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.
96+
2. The bridge contract transmits 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.
9797

9898
3. For proving and verification, the zk-proof-generating circuit obtains the L2 exit tree root from the L2 global exit root manager.
9999

docs/zkEVM/architecture/protocol/unified-LxLy/lxly-bridge.md renamed to docs/zkEVM/architecture/high-level/unified-LxLy/lxly-bridge.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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.
1+
The LxLy bridge is an interoperability solution aimed at enabling cross-chain communication among networks. It facilitates interaction between two L2 chains or between an L2 chain and Ethereum as the L1.
22

33
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

@@ -86,14 +86,20 @@ The governance contract oversees consensus mechanisms and verifiers that can be
8686
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
89-
function addNewRollupType(
90-
address consensusImplementation,
91-
IVerifierRollup verifier,
92-
uint64 forkID,
93-
bytes32 genesis,
94-
uint8 rollupCompatibilityID,
95-
string memory description
96-
) ...
89+
function createNewRollup(
90+
uint32 rollupTypeID,
91+
uint64 chainID,
92+
address admin,
93+
address sequencer,
94+
address gasTokenAddress,
95+
uint32 gasTokenNetwork,
96+
string memory sequencerURL,
97+
string memory networkName
98+
) external onlyRole(_CREATE_ROLLUP_ROLE) {
99+
// Check that rollup type exists
100+
if (rollupTypeID == 0 || rollupTypeID > rollupTypeCount) {
101+
revert RollupTypeDoesNotExist();
102+
}
97103
```
98104
99105
- To create and connect a rollup to the LxLy bridge,

docs/zkEVM/architecture/protocol/unified-LxLy/ulxly-exit-trees-node.md renamed to docs/zkEVM/architecture/high-level/unified-LxLy/ulxly-exit-trees-node.md

File renamed without changes.

docs/zkEVM/architecture/protocol/unified-LxLy/ulxly-interchain-exchanges.md renamed to docs/zkEVM/architecture/high-level/unified-LxLy/ulxly-interchain-exchanges.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Recall also that in the bridge contract, the mapping $\texttt{tokenInfoToWrapped
6262

6363
The problem is that if we change the $\texttt{creationBytecode}$ of the ERC-20 token contract, this will change all the addresses of the contract instances and breaks the data of the mapping.
6464

65-
The $\texttt{creationBytecode}$ will change with high probability if we compile the factory (in our case the bridge) with another version of the Solidity compiler. In this case, we had to options:
65+
The $\texttt{creationBytecode}$ will change with high probability if we compile the factory (in our case the bridge) with another version of the Solidity compiler. In this case, we had two options:
6666

6767
(a) Freeze the Solidity compiler version for the development of the whole bridge contract.
6868

docs/zkEVM/architecture/protocol/unified-LxLy/ulxly-rollupmanager.md renamed to docs/zkEVM/architecture/high-level/unified-LxLy/ulxly-rollupmanager.md

File renamed without changes.

0 commit comments

Comments
 (0)