Skip to content

Commit b3d71c5

Browse files
authored
feat: update sequencing section to include local sequencer and steps to connect sequencers with rollups (#510)
1 parent 0e3d52f commit b3d71c5

File tree

11 files changed

+225
-56
lines changed

11 files changed

+225
-56
lines changed

.vitepress/config.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,27 @@ function sidebarHome() {
247247
items: [
248248
{
249249
text: "Overview",
250-
link: "/tutorials/sequencing",
250+
link: "/tutorials/sequencing/overview",
251+
},
252+
{
253+
text: "Local",
254+
link: "/tutorials/sequencing/local",
251255
},
252256
{
253257
text: "Centralized",
254-
link: "/tutorials/centralized",
258+
link: "/tutorials/sequencing/centralized",
255259
},
256260
{
257261
text: "Based",
258-
link: "/tutorials/based",
262+
link: "/tutorials/sequencing/based",
259263
},
260264
{
261265
text: "Forced Inclusion",
262-
link: "/tutorials/forced",
266+
link: "/tutorials/sequencing/forced-inclusion",
263267
},
264268
{
265269
text: "Astria",
266-
link: "/tutorials/astria",
270+
link: "/tutorials/sequencing/astria",
267271
},
268272
],
269273
},

.vitepress/constants/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const constants = Object.freeze({
1111

1212
localDALatestTag: "v0.3.1",
1313
goSequencingLatestTag: "v0.4.1",
14+
centralizedSequencerLatestTag: "v0.4.0",
1415
igniteVersionTag: "v28.5.3",
1516
});
1617
export default constants;

tutorials/astria.md

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

tutorials/based.md

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

tutorials/centralized.md

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

tutorials/sequencing/astria.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Astria Sequencing
2+
3+
Coming soon ...
4+
5+
Track progress on the [GitHub](https://github.com/rollkit/astria-sequencer)

tutorials/sequencing/based.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Based Sequencing
2+
3+
Coming soon ...
4+
5+
Track progress on the [GitHub](https://github.com/rollkit/based-sequencer)

tutorials/sequencing/centralized.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Centralized Sequencer
2+
3+
<!-- markdownlint-disable MD033 -->
4+
<script setup>
5+
import constants from '../../.vitepress/constants/constants.js'
6+
</script>
7+
8+
A centralized sequencer is a sequencing middleware that receives rollup transactions and provides a local sequencing capabilities. Meaning, the transactions are ordered in the order they are received by the sequencer without any censorship. Further, the sequenced batches are made available in the DA network (such as Celestia). Under the hood, the centralized sequencer is a GRPC server that implements `go-sequencing` interface and the server is hosted by the same node that is running the aggregator for the Rollkit rollup.
9+
10+
![Rollkit with Centralized Sequencer](/public/img/sequencing.jpg)
11+
12+
## Prerequisites {#prerequisites}
13+
14+
This tutorial serves as a comprehensive guide for using the [centralized-sequencer](https://github.com/rollkit/centralized-sequencer) with your chain.
15+
16+
Before proceeding, ensure that you have completed the [quick start](/tutorials/quick-start) or [build a chain](/tutorials/wordle) tutorial, which covers installing the rollkit CLI, building your chain, and running your chain.
17+
18+
:::tip
19+
It is important to note that the centralized sequencer expects a DA layer to be running when it starts. This means that you need to launch your DA Layer before starting the centralized sequencer.
20+
:::
21+
22+
Additionally, you should have completed one of the [DA Layer tutorials](../da/overview) and have your DA layer ready to use with the centralized sequencer. This tutorial will use the [local-da layer](../da/local) as an example.
23+
24+
## Installation the Centralized Sequencer {#installation-centralized-sequencer}
25+
26+
```sh-vue
27+
git clone --depth 1 --branch {{constants.centralizedSequencerLatestTag}} https://github.com/rollkit/centralized-sequencer.git
28+
cd centralized-sequencer
29+
make build
30+
./build/centralized-sequencer -h
31+
```
32+
33+
```sh
34+
Usage:
35+
-host string
36+
centralized sequencer host (default "localhost")
37+
-port string
38+
centralized sequencer port (default "50051")
39+
-listen-all
40+
listen on all network interfaces (0.0.0.0) instead of just localhost
41+
-rollup-id string
42+
rollup id (default "rollupId")
43+
-batch-time duration
44+
time in seconds to wait before generating a new batch (default 2s)
45+
-da_address string
46+
DA address (default "http://localhost:26658")
47+
-da_auth_token string
48+
auth token for the DA
49+
-da_namespace string
50+
DA namespace where the sequencer submits transactions
51+
-db_path string
52+
path to the database
53+
```
54+
55+
As shown by the help command, a centralized sequencer is configured to serve a rollup (via `rollup_id`). The DA network to persist the sequenced batches are specified using `da_address`, `da_auth_token` and `da_namespace`.
56+
57+
58+
## Run the centralized sequencer {#run-the-centralized-sequencer}
59+
60+
:::tip
61+
As mentioned in the prerequisities, you should have your DA layer running. These steps assume the local-da is running on `http://localhost:7980`.
62+
:::
63+
64+
Start your centralized sequencer with the following command:
65+
66+
::: code-group
67+
68+
```sh [Quick Start]
69+
./build/centralized-sequencer -rollup-id my-rollup -da_address http://localhost:7980
70+
```
71+
72+
```sh [Build a Chain]
73+
./build/centralized-sequencer -rollup-id wordle -da_address http://localhost:7980
74+
```
75+
:::
76+
77+
78+
## Run your chain {#run-your-chain}
79+
80+
To connect your chain to the centralized sequencer, you need to pass the `--rollkit.sequencer_address` flag with the local sequencer address and the `--rollkit.sequencer_rollup_id` to ensure your rollup id matches what the sequencer is expecting.
81+
82+
Start your chain with the following command, ensuring to include the sequencer flag:
83+
84+
::: code-group
85+
86+
```sh [Quick Start]
87+
rollkit start \
88+
--rollkit.da_address http://localhost:7980 \
89+
--rollkit.sequencer_address localhost:50051 \
90+
--rollkit.sequencer_rollup_id my-rollup
91+
```
92+
93+
```sh [Wordle Chain]
94+
rollkit start \
95+
--rollkit.aggregator \
96+
--rollkit.da_address http://localhost:7980 \
97+
--rollkit.sequencer_address localhost:50051 \
98+
--rollkit.sequencer_rollup_id wordle
99+
```
100+
101+
:::
102+
103+
You should see the following log messages indicating that your chain is connected to the local sequencer:
104+
105+
```sh
106+
I[2024-11-15|15:22:33.636] sequencer already running module=main address=localhost:50051
107+
I[2024-11-15|15:22:33.636] make sure your rollupID matches your sequencer module=main rollupID=my-rollup
108+
```
109+
110+
Then after a few blocks you should see this message confirming that your sequencer is successfully submitting batches to the DA layer:
111+
112+
```sh
113+
I[2024-11-15|16:04:07.698] successfully submitted Rollkit headers to DA layer module=BlockManager gasPrice=-1 daHeight=1 headerCount=14
114+
```
115+
116+
## Summary {#summary}
117+
118+
By following these steps, you will have successfully set up and connected your chain to the centralized sequencer. You can now start submitting transactions to your chain.
File renamed without changes.

tutorials/sequencing/local.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Local Sequencer
2+
3+
<!-- markdownlint-disable MD033 -->
4+
<script setup>
5+
import constants from '../../.vitepress/constants/constants.js'
6+
</script>
7+
8+
## Introduction {#introduction}
9+
10+
This tutorial serves as a comprehensive guide for using the [local-sequencer](https://github.com/rollkit/go-sequencing) with your chain.
11+
12+
Before proceeding, ensure that you have completed the [quick start](/tutorials/quick-start) or [build a chain](/tutorials/wordle) tutorial, which covers installing the rollkit CLI, building your chain, and running your chain.
13+
14+
## Setting Up a Local Local Sequencer
15+
16+
To set up a local sequencer on your machine, run the following script to install and start the local sequencer:
17+
18+
::: code-group
19+
20+
```bash-vue [Quick Start]
21+
curl -sSL https://rollkit.dev/install-local-sequencer.sh | bash -s {{constants.goSequencingLatestTag}} my-rollup
22+
```
23+
24+
```bash-vue [Build a Chain]
25+
curl -sSL https://rollkit.dev/install-local-sequencer.sh | bash -s {{constants.goSequencingLatestTag}} wordle
26+
```
27+
28+
:::
29+
30+
This script will build and run the sequencer, which will then listen on port `50051` with the `rollup-id` of your chain.
31+
32+
## Configuring your chain to connect to the local sequencer
33+
34+
To connect your chain to the local sequencer, you need to pass the `--rollkit.sequencer_address` flag with the centralized sequencer address and the `--rollkit.sequencer_rollup_id` to ensure your rollup id matches what the sequencer is expecting.
35+
36+
## Run your chain
37+
38+
Start your chain with the following command, ensuring to include the sequencer flag:
39+
40+
::: code-group
41+
42+
```sh [Quick Start]
43+
rollkit start \
44+
--rollkit.sequencer_address localhost:50051 \
45+
--rollkit.sequencer_rollup_id my-rollup
46+
```
47+
48+
```sh [Wordle Chain]
49+
rollkit start \
50+
--rollkit.aggregator \
51+
--rollkit.sequencer_address localhost:50051 \
52+
--rollkit.sequencer_rollup_id wordle
53+
```
54+
55+
:::
56+
57+
You should see the following log messages indicating that your chain is connected to the local sequencer:
58+
59+
```sh
60+
I[2024-11-15|15:22:33.636] sequencer already running module=main address=localhost:50051
61+
I[2024-11-15|15:22:33.636] make sure your rollupID matches your sequencer module=main rollupID=my-rollup
62+
```
63+
64+
## Summary
65+
66+
By following these steps, you will have successfully set up and connected your chain to the local sequencer. You can now start submitting transactions to your chain.

tutorials/sequencing.md renamed to tutorials/sequencing/overview.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Sequencing
22

3+
The next step after choosing your DA layer is to choose your sequencing scheme.
4+
35
## Rollkit prior to Sequencing
46
Rollkit's aggregator node was responsible for selecting and ordering transactions for including in the rollup blocks. The Rollkit aggregator used to follow a FCFS strategy, where every transaction submitted gets included in the block in order without any censorship. Use of a different sequencing strategy or connecting to a sequencing network (e.g., Astria) was not possible. Rollkit [v0.14.0](https://github.com/rollkit/rollkit/releases/tag/v0.14.0) onwards makes it possible for rollkit to connect to a sequencing network and communicate via grpc.
57

6-
### Sequencing Interface
8+
## Sequencing Interface {#sequencing-interface}
79

810
[go-sequencing](https://github.com/rollkit/go-sequencing) defines a sequencing interface for communicating between any sequencing network and Rollkit. The key functions of the interface are defined as shown below.
911

@@ -20,12 +22,25 @@ It mainly consists of:
2022
* `GetNextBatch` returns the next batch of transactions along with a deterministic timestamp
2123
* `VerifyBatch` validates the sequenced batch
2224

23-
### Sequencing Implementations
25+
## Mock Sequencer {#mock-sequencer}
26+
27+
You might have noticed that we did not define a specific sequencer during the [quick start](../quick-start.md) or [build a chain](../wordle.md) tutorials. This is because we used a mock sequencer that is built into Rollkit.
28+
29+
If you revisit the logs from those tutorials, you will see one of the first lines being:
30+
31+
```shell
32+
I[2024-11-15|14:54:19.843] Starting mock sequencer module=main address=localhost:50051 rollupID=test-rollup-a736683c
33+
```
34+
35+
The mock sequencer is a simple in-memory sequencer that is great for testing and development. It is not suitable for production use.
36+
37+
## Sequencing Implementations {#sequencing-implementations}
2438

2539
An implementation of the sequencing interface mainly acts as a middleware that connects Rollkit rollup and the sequencing layer. It implements the sequencing interface functions described above. For example, [centralized-sequencer](https://github.com/rollkit/centralized-sequencer) is the refactored functionality from the Rollkit prior to `v0.14.0`. The centralized sequencer is the middleware run by the aggregator node of the Rollkit rollup. The aggregator node relays rollup transactions to centralized sequencer which then submits them to the DA network (such as Celestia). The header producer node then retrieves (via `GetNextBatch`) the batched transaction from the centralized sequencer to execute the transactions and produce the updated rollup state. Similarly, there are other sequencing middlewares which can be built for various sequencing strategies or even for connecting to different third-party sequencing networks.
2640

2741
The sequencing implementations that are currently work in progress:
28-
* [centralized-sequencer](https://github.com/rollkit/centralized-sequencer)
29-
* [based-sequencer](https://github.com/rollkit/based-sequencer)
30-
* [forced-inclusion-sequencer]()
31-
* [astria-sequencer](https://github.com/rollkit/astria-sequencer)
42+
* [local-sequencer](local)
43+
* [centralized-sequencer](centralized)
44+
* [based-sequencer](based)
45+
* [forced-inclusion-sequencer](forced-inclusion)
46+
* [astria-sequencer](astria)

0 commit comments

Comments
 (0)