Skip to content

Commit

Permalink
add sequencing section (#497)
Browse files Browse the repository at this point in the history
* add sequencing section

* add a diagram

* v0.14.0

* update ignite tutorial with sequencer

* minor fixes

* minor

* meh

* fix

* Delete ~/.celestia-light-mocha-4/config/app.toml

* Delete ~/.celestia-light-mocha-4/config/client.toml

* Delete ~/.celestia-light-mocha-4/config/config.toml
  • Loading branch information
gupadhyaya authored Nov 8, 2024
1 parent 99fb831 commit 908e95d
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,32 @@ function sidebarHome() {
},
],
},
{
text: "Sequencing",
collapsed: true,
items: [
{
text: "Overview",
link: "/tutorials/sequencing",
},
{
text: "Centralized",
link: "/tutorials/centralized",
},
{
text: "Based",
link: "/tutorials/based",
},
{
text: "Forced Inclusion",
link: "/tutorials/forced",
},
{
text: "Astria",
link: "/tutorials/astria",
},
],
},
{
text: "Execution",
collapsed: true,
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const constants = Object.freeze({
rollkitIgniteAppVersion: "rollkit/v0.2.1",

localDALatestTag: "v0.3.1",

goSequencingLatestTag: "v0.4.0",
igniteVersionTag: "v28.5.3",
});
export default constants;
10 changes: 10 additions & 0 deletions guides/ignite-rollkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ cd $HOME && curl -sSL https://rollkit.dev/install-local-da.sh | sh -s {{constant

This script builds and runs a DA node, which will listen on port `7980`.

## Run a local Sequencer node {#run-local-sequencer-node}

First, set up a local sequencer node:

```bash-vue
cd $HOME && curl -sSL https://rollkit.dev/install-local-sequencer.sh | sh -s {{constants.goSequencingLatestTag}} gm
```

This script builds and runs a local sequencer node, which will listen on port `50051`.

## Install Ignite App Rollkit {#install-ignite-app-rollkit}

In a new terminal window, you'll now install and run the Ignite App Rollkit.
Expand Down
Binary file added public/img/sequencing.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions public/install-local-sequencer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

echo "Downloading local sequencer source code..."
git clone https://github.com/rollkit/go-sequencing.git
cd go-sequencing || { echo "Failed to find the downloaded repository"; exit 1; }
git fetch --all --tags
git checkout $1
echo "Building and installing Local Sequencer..."
make build
echo "Starting Local Sequencer..."
./build/local-sequencer -rollup-id $2
3 changes: 3 additions & 0 deletions tutorials/astria.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Astria Sequencing

Coming soon ...
3 changes: 3 additions & 0 deletions tutorials/based.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Based Sequencing

Coming soon ...
39 changes: 39 additions & 0 deletions tutorials/centralized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Centralized Sequencer

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.

![Rollkit with Centralized Sequencer](/public/img/sequencing.jpg)

### Installation and Use

```sh
git clone https://github.com/rollkit/centralized-sequencer.git
cd centralized-sequencer
make build
./build/centralized-sequencer -h
```


```sh
Usage:
-host string
centralized sequencer host (default "localhost")
-port string
centralized sequencer port (default "50051")
-listen-all
listen on all network interfaces (0.0.0.0) instead of just localhost
-rollup-id string
rollup id (default "rollupId")
-batch-time duration
time in seconds to wait before generating a new batch (default 2s)
-da_address string
DA address (default "http://localhost:26658")
-da_auth_token string
auth token for the DA
-da_namespace string
DA namespace where the sequencer submits transactions
-db_path string
path to the database
```

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`.
3 changes: 3 additions & 0 deletions tutorials/forced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Forced Inclusion

Coming soon ...
31 changes: 31 additions & 0 deletions tutorials/sequencing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Sequencing

## Rollkit prior to Sequencing
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.

### Sequencing Interface

[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.

```go
SubmitRollupTransaction(rollupId, data) returns (error)

GetNextBatch(rollupId, lastBatchHash, maxBytes) returns (batch, timestamp)

VerifyBatch(rollupId, batchHash) returns (status)
```

It mainly consists of:
* `SubmitRollupTransaction` relays the rollup transactions from Rollkit rollup to the sequencing network
* `GetNextBatch` returns the next batch of transactions along with a deterministic timestamp
* `VerifyBatch` validates the sequenced batch

### Sequencing Implementations

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.

The sequencing implementations that are currently work in progress:
* [centralized-sequencer](https://github.com/rollkit/centralized-sequencer)
* [based-sequencer](https://github.com/rollkit/based-sequencer)
* [forced-inclusion-sequencer]()
* [astria-sequencer](https://github.com/rollkit/astria-sequencer)

0 comments on commit 908e95d

Please sign in to comment.