diff --git a/.vitepress/config.ts b/.vitepress/config.ts index d8294bdda..d318f9730 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -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, diff --git a/.vitepress/constants/constants.js b/.vitepress/constants/constants.js index 63fb6bd82..dfefe9368 100644 --- a/.vitepress/constants/constants.js +++ b/.vitepress/constants/constants.js @@ -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; diff --git a/guides/ignite-rollkit.md b/guides/ignite-rollkit.md index edda71235..900196782 100644 --- a/guides/ignite-rollkit.md +++ b/guides/ignite-rollkit.md @@ -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. diff --git a/public/img/sequencing.jpg b/public/img/sequencing.jpg new file mode 100644 index 000000000..32f759730 Binary files /dev/null and b/public/img/sequencing.jpg differ diff --git a/public/install-local-sequencer.sh b/public/install-local-sequencer.sh new file mode 100644 index 000000000..b3b91f9ca --- /dev/null +++ b/public/install-local-sequencer.sh @@ -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 diff --git a/tutorials/astria.md b/tutorials/astria.md new file mode 100644 index 000000000..37d894216 --- /dev/null +++ b/tutorials/astria.md @@ -0,0 +1,3 @@ +# Astria Sequencing + +Coming soon ... \ No newline at end of file diff --git a/tutorials/based.md b/tutorials/based.md new file mode 100644 index 000000000..93e3c250f --- /dev/null +++ b/tutorials/based.md @@ -0,0 +1,3 @@ +# Based Sequencing + +Coming soon ... \ No newline at end of file diff --git a/tutorials/centralized.md b/tutorials/centralized.md new file mode 100644 index 000000000..eeb3909d6 --- /dev/null +++ b/tutorials/centralized.md @@ -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`. \ No newline at end of file diff --git a/tutorials/forced.md b/tutorials/forced.md new file mode 100644 index 000000000..4c1f0d6c3 --- /dev/null +++ b/tutorials/forced.md @@ -0,0 +1,3 @@ +# Forced Inclusion + +Coming soon ... \ No newline at end of file diff --git a/tutorials/sequencing.md b/tutorials/sequencing.md new file mode 100644 index 000000000..20e96650d --- /dev/null +++ b/tutorials/sequencing.md @@ -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)