Skip to content

Commit 87c3d75

Browse files
fix conflicts
2 parents 1d24cf4 + b77595f commit 87c3d75

File tree

76 files changed

+1032
-634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1032
-634
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ docker compose up
7171

7272
## The team
7373

74-
- Anthony Matlala (@EmpieichO)
75-
- Katharine Murphy (@kmurphypolygon)
76-
- Hans (@hsutaiyu)
74+
- Anthony Matlala [(@EmpieichO)](https://github.com/EmpieichO)
75+
- Hans Bodani [(@hsutaiyu)](https://github.com/hsutaiyu)
76+
- Katharine Murphy [(@kmurphypolygon)](https://github.com/kmurphypolygon)
77+

docs/cdk/concepts/blocks.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
11
# Batches, blocks, and transactions
22

3-
The following definition are key to understanding how transactions are handled on L2s built with the CDK:
3+
The following definitions are key to understanding how transactions are handled on L2s built with the CDK:
44

55
- Transaction: A signed instruction to perform an action on the blockchain.
66
- Block: A group of transactions and a hash of the previous block in the chain.
77
- Batch: A group of many transactions from multiple blocks.
88

9-
See the figure below to best understand how these concepts relate to each other. We follow a real transaction from the Polygon zkEVM to track how it first gets included in a block on the L2, then a batch, and finally, a sequence sent to Ethereum.
9+
Transactions are included in blocks, and these blocks fill batches, which are then sequenced. See the figure below to best understand how these elements relate to each other.
1010

1111
![Batches, blocks, transactions](../../img/cdk/sequence-batch-block-transaction.png)
1212

1313
## Transaction
1414

15-
A transaction is a cryptographically signed instruction from an account to update the state of the blockchain. Users can leverage familiar tools and libraries, like MetaMask and Ethers.js, typically used for interacting with Ethereum, to send these transactions to CDK-built L2 chains.
15+
A transaction is a cryptographically signed instruction from an account to update the state of the blockchain.
1616

17-
Transactions are included in blocks, and these blocks fill batches. Consider a Polygon zkEVM transaction as an example, [`0xdd`](https://zkevm.polygonscan.com/tx/0xdd3f79c24886310ddf868ad1d36aadc6a3b6495048f68aad765c658c42426ef8), which performs a `Simple Swap` function call, and is included in block number [`12952601`](https://zkevm.polygonscan.com/block/12952601) on the L2.
17+
Let's take a look at a real transaction in the Polygon zkEVM (which is in a way a CDK rollup), and inspect how the transaction is recorded in the [explorer](https://zkevm.polygonscan.com/) as part of a block, then a batch, and ultimately in a sequence.
18+
19+
Consider the Polygon zkEVM transaction with the transaction hash, [`0xdd ... 6ef8`](https://zkevm.polygonscan.com/tx/0xdd3f79c24886310ddf868ad1d36aadc6a3b6495048f68aad765c658c42426ef8), which performs a `Simple Swap` function call, and is included in block number [`12952601`](https://zkevm.polygonscan.com/block/12952601) on the L2.
1820

1921
![Transaction with block number](../../img/cdk/transaction-block.png)
2022

2123
## Block
2224

23-
To link blocks together, blocks contain multiple transactions as well as the hash of the previous block in the chain. Following the transaction example from above, the `0xdd` transaction is included in block [`12952601`](https://zkevm.polygonscan.com/block/12952601), which contains [2 transactions in total](https://zkevm.polygonscan.com/txs?block=12952601).
25+
Each block must include the hash of the previous block, along with multiple transactions, to establish a link to the block before it.
26+
27+
Continuing with the above transaction, identified by the hash `0xdd ... 6ef8` and contained in block [`12952601`](https://zkevm.polygonscan.com/block/12952601), we observe that this block contains [2 transactions in total](https://zkevm.polygonscan.com/txs?block=12952601).
2428

25-
We can see this `0xdd` transaction is included in both a block and a batch, specifically, it is included in the block `12952601` and the batch `2041736`:
29+
Also, as depicted in the figure below, block `12952601` is in turn contained in batch `2041736`.
2630

2731
![Block and batch](../../img/cdk/block-batch.png)
2832

2933
## Batch
3034

31-
Batches contain multiple transactions from multiple blocks. The two transactions from our example block `12952601` are included in batch [`2041736`](https://zkevm.polygonscan.com/batch/2041736), which contains [10 total transactions](https://zkevm.polygonscan.com/txs?batch=2041736).
35+
Batches contain multiple transactions from multiple blocks.
3236

33-
This means the batch `2041736` includes the two transactions from block `12952601` as well as eight transactions from other blocks.
37+
The two transactions from our example block `12952601` are included in batch [`2041736`](https://zkevm.polygonscan.com/batch/2041736), which contains [10 transactions](https://zkevm.polygonscan.com/txs?batch=2041736) in total.
3438

35-
The presence of the `Sequence Tx Hash` field, associated with this batch, indicates that this batch has been sent to Ethereum along with other batches in a single transaction.
39+
This means batch `2041736` includes the two transactions from block `12952601` as well as eight transactions from other blocks.
40+
41+
As observed in the figure below, the presence of the `Sequence Tx Hash` field associated indicates that the batch has been sent to Ethereum along with other batches in a single transaction.
3642

3743
![Batch of transactions](../../img/cdk/batch-overview.png)
3844

39-
By inspecting the transactions in the batch, we can see:
45+
Further inspection of the transactions in the batch, as depicted in the figure below, reveals that:
4046

41-
- Our original transaction example is included in this batch.
42-
- The batch contains many transactions from different blocks.
47+
- Our transaction example, with hash `0xdd ... 6ef8`, is included in this batch.
48+
- The batch contains several transactions from different blocks.
4349

4450
![Transaction found inside batch](../../img/cdk/transaction-in-batch.png)
4551

46-
If the L2 is a [rollup](./layer2s.md) (meaning it uses Ethereum for it’s [data availability](../glossary/index.md#data-availability), it sends an array of batches to Ethereum, by providing the array as an argument to the `sequenceBatches` function of a smart contract on Ethereum.
52+
Since Polygon zkEVM is a [rollup](./layer2s.md) (that is, it uses Ethereum for [data availability](../glossary/index.md#data-availability)), it sends an array of batches to Ethereum, by providing the array as an argument to the `sequenceBatches()` function of a smart contract on Ethereum.
4753

4854
![Sequence Transaction](../../img/cdk/sequence-transaction.png)
4955

50-
By inspecting the `Sequence Tx Hash` transaction, we can see that the `sequenceBatches` function is called with the array of batches as an argument. One of these batches is the batch we have been following, `2041736`, which contains our original transaction example:
56+
We can inspect the `Sequence Tx Hash` transaction to ascertain if batch `2041736`, containing our original transaction example, was indeed part of the argument to the `sequenceBatches()` function.
57+
58+
In this case, batch `2041736` happens to be the last batch to be sequenced, as depicted in the figure below.
5159

5260
![Last batch sequenced](../../img/cdk/last-batch-sequenced.png)
5361

5462
## Further reading
5563

56-
- [Blocks in the zkEVM Etrog upgrade](../../zkEVM/architecture/protocol/etrog-upgrade.md/?h=blocks#etrog-blocks).
64+
- [Blocks in the zkEVM Etrog upgrade](../../zkEVM/architecture/protocol/etrog-upgrade.md/?h=blocks#etrog-blocks).

docs/cdk/concepts/bridging.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ 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/unified-LxLy/index.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

13-
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).
13+
Deploying an individual instance of the LxLy means interoperability with other L2 chains via the [AggLayer](../../innovation-design/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](../../innovation-design/agglayer/unified-bridge.md).
1414

1515
This option is suited to chains that may want to customize how the bridge is managed and operated, or maintain control of the bridge's funds; as the [upgradeability](./admin-upgradeability.md) of the bridge contracts are managed by the chain operator.
1616

1717
![LxLy bridge](../../img/cdk/lxly.png)
1818

1919
## Unified bridge
2020

21-
A single, shared instance of the LxLy bridge, called the [unified bridge](../agglayer/unified-bridge.md) is available to use for all CDK chains that opt-in to the AggLayer.
21+
A single, shared instance of the LxLy bridge, called the [unified bridge](../../innovation-design/agglayer/unified-bridge.md) is available to use for all CDK chains that opt-in to the AggLayer.
2222

2323
It is a shared smart contract deployed on Ethereum, responsible for enabling interoperability between chains in the form of cross-chain transactions and L2-to-L2 transfers.
2424

@@ -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).
35-
- [Unified bridge Ooverview](../agglayer/unified-bridge.md).
34+
- [LxLy bridge](../../zkEVM/architecture/unified-LxLy/index.md).
35+
- [Unified bridge overview](../../innovation-design/agglayer/unified-bridge.md).
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
To use chains other than the [defaults](releases.md#current-chainfork-support-status), supply a set of custom configuration files.
2+
3+
1. Ensure the chain name starts with the word `dynamic` e.g. `dynamic-mynetwork`.
4+
5+
2. Create the following files for dynamic configs. The examples for Cardona are in `zk/examples/dynamic-configs` and can be edited as required:
6+
7+
- `dynamic-{network}-allocs.json` - the allocs file.
8+
- `dynamic-{network}-chainspec.json` - the chainspec file.
9+
- `dynamic-{network}-conf.json` - an additional configuration file.
10+
- `dynamic-{network}.yaml` - the run config file for erigon.
11+
12+
You can use any of the example yaml files at the root of the repo as a base and edit as required, but ensure the `chain` field is in the format `dynamic-mynetwork` and matches the names of the config files above.
13+
14+
3. Put the erigon config file, along with the other files, in the directory of your choice. For example `dynamic-mynetwork`.
15+
16+
!!! tip
17+
- If you have allocs in the Polygon format from the original network launch, save this file to the root of the `cdk-erigon` code base and run `go run cmd/hack/allocs/main.go [your-file-name]` to convert it to the format needed by erigon.
18+
- This creates the `dynamic-{network}-allocs.json` file.
19+
20+
!!! tip
21+
Find the following contract addresses for the `dynamic-{network}.yaml` in the output files created at network launch:
22+
23+
- `zkevm.address-sequencer` => `create_rollup_output.json` => `sequencer`
24+
- `zkevm.address-zkevm` => `create_rollup_output.json` => `rollupAddress`
25+
- `zkevm.address-admin` => `deploy_output.json` => `admin`
26+
- `zkevm.address-rollup` => `deploy_output.json` => `polygonRollupManagerAddress`
27+
- `zkevm.address-ger-manager` => `deploy_output.json` => `polygonZkEVMGlobalExitRootAddress`
28+
29+
4. Mount the directory containing the config files on a Docker container. For example `/dynamic-mynetwork`.
30+
31+
5. To use the new config when starting erigon, use the `--config` flag with the path to the config file e.g. `--config="/dynamic-mynetwork/dynamic-mynetwork.yaml"`.

0 commit comments

Comments
 (0)