Skip to content

Commit

Permalink
feat: sovereign integration (#88)
Browse files Browse the repository at this point in the history
## Overview

Sov SDK rollup is up and running with an EVM module. I'll add more docs
once I start testing it with our existing scripts. The demo still
primarily uses RollKit.

Fixes #76 

## Running Sov SDK rollup

Requires building the image locally. Once the image is battle tested
i'll push it to ghcr.

---------

Co-authored-by: Rootul P <[email protected]>
  • Loading branch information
ninabarbakadze and rootulp authored Feb 4, 2025
1 parent e50125e commit ab26692
Show file tree
Hide file tree
Showing 14 changed files with 355 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ check-dependencies:
.PHONY: check-dependencies

## start: Start all processes needed for the demo.
start:
@docker compose up --detach
start:
@docker compose -f docker-compose.rollkit.yml up --detach
.PHONY: start

## setup: Set up the IBC clients and channels.
Expand All @@ -100,8 +100,8 @@ relay:
## stop: Stop all processes and remove the tmp directory.
stop:
@echo "--> Stopping all processes"
@docker compose down
@docker compose rm
@docker compose -f docker-compose.rollkit.yml down
@docker compose -f docker-compose.rollkit.yml rm
@echo "--> Removing the tmp directory"
@rm -rf .tmp
.PHONY: stop
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,26 @@ For more information refer to the [architecture document](./ARCHITECTURE.md). No
make stop
```

### Run a demo with Sov SDK Rollup using Celestia DA

1. Clone the repo with dockerized Sov SDK rollup:

```shell
git clone https://github.com/ninabarbakadze/sovereign-sdk-wip
```

1. Build the image:

```shell
docker build -t sovrollup -f docker/sov-demo-rollup/Dockerfile .
```

1. Run the docker compose script to spin up a local dev environment and see that sovereign is producing blocks:

```shell
docker compose -f docker-compose.sov.yml up -d
```

## A Breakdown of an IBC Transfer

This section takes the diagram from above and breaks down each step during `make transfer` to help aid your understanding.
Expand Down
38 changes: 23 additions & 15 deletions docker-compose.yml → docker-compose.rollkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ services:
reth:
condition: service_started
networks:
- beacon-network
- rollkit-network

reth:
image: ghcr.io/paradigmxyz/reth # Use the official Reth image
image: ghcr.io/paradigmxyz/reth # Use the official Reth image
container_name: reth
ports:
- "30303:30303" # P2P port
- "8545:8545" # HTTP port
- "8551:8551" # Auth RPC port
- "30303:30303" # P2P port
- "8545:8545" # HTTP port
- "8551:8551" # Auth RPC port
volumes:
- ./testing/files:/testapp_files # Mount the directory for test app files
- ./.tmp:/.tmp # Mount a temporary directory for data
- ./testing/files:/testapp_files # Mount the directory for test app files
- ./.tmp:/.tmp # Mount a temporary directory for data
command: |
node
--chain /testapp_files/eth-genesis.json
Expand All @@ -38,7 +38,7 @@ services:
--datadir /.tmp/eth-home
--ipcpath /.tmp/eth-home/eth-engine.ipc
networks:
- beacon-network
- rollkit-network

celestia-network-validator:
image: ghcr.io/celestiaorg/celestia-app:v3.0.0-mocha
Expand All @@ -52,13 +52,17 @@ services:
- "26657:26657"
entrypoint: /testapp_files/entrypoint.sh
healthcheck:
test: ["CMD-SHELL", "/bin/sh -c 'BLOCK_HEIGHT=$(curl -sf http://localhost:26657/status | jq -r .result.sync_info.latest_block_height); if [ \"$$BLOCK_HEIGHT\" -gt 1 ]; then exit 0; else echo \"Block height too low: $$BLOCK_HEIGHT\"; exit 1; fi'"]
test:
[
"CMD-SHELL",
'/bin/sh -c ''BLOCK_HEIGHT=$(curl -sf http://localhost:26657/status | jq -r .result.sync_info.latest_block_height); if [ "$$BLOCK_HEIGHT" -gt 1 ]; then exit 0; else echo "Block height too low: $$BLOCK_HEIGHT"; exit 1; fi''',
]
interval: 1s
timeout: 5s
retries: 10
start_period: 5s
networks:
- beacon-network
- rollkit-network

celestia-network-bridge:
image: ghcr.io/celestiaorg/celestia-node:v0.20.1-mocha
Expand All @@ -78,13 +82,17 @@ services:
celestia-network-validator:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "AUTH_TOKEN=$(celestia bridge auth read --node.store=/home/celestia 2>/dev/null | tail -n 1); OUTPUT=$(curl -sf --max-time 0.5 -X POST -H \"Content-type: application/json\" -H \"Accept: application/json\" -H \"Authorization: Bearer $$AUTH_TOKEN\" -d '{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"header.SyncWait\",\"params\":[]}' http://0.0.0.0:26658); if [ $$? -eq 0 ]; then exit 0; else echo \"Catching up. $$OUTPUT\"; exit 1; fi "]
test:
[
"CMD-SHELL",
'AUTH_TOKEN=$(celestia bridge auth read --node.store=/home/celestia 2>/dev/null | tail -n 1); OUTPUT=$(curl -sf --max-time 0.5 -X POST -H "Content-type: application/json" -H "Accept: application/json" -H "Authorization: Bearer $$AUTH_TOKEN" -d ''{"id":1,"jsonrpc":"2.0","method":"header.SyncWait","params":[]}'' http://0.0.0.0:26658); if [ $$? -eq 0 ]; then exit 0; else echo "Catching up. $$OUTPUT"; exit 1; fi ',
]
interval: 1s
timeout: 5s
retries: 10
start_period: 5s
networks:
- beacon-network
- rollkit-network

simapp-validator:
image: ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/simapp:latest
Expand All @@ -97,7 +105,7 @@ services:
- "9190:9090"
- "5123:26657"
networks:
- beacon-network
- rollkit-network

celestia-prover:
image: ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/celestia-prover:latest
Expand All @@ -114,10 +122,10 @@ services:
beacond:
condition: service_started
networks:
- beacon-network
- rollkit-network

networks:
beacon-network:
rollkit-network:
driver: bridge
ipam:
config:
Expand Down
106 changes: 106 additions & 0 deletions docker-compose.sov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
services:
sovereign: # sov sdk is a zk rollup framework. This is a zk rollup image with an EVM module using celestia bridge
image: sovrollup:latest # this will be replaced with an image from ghcr
container_name: sovereign
volumes:
- ./testing/files/celestia_rollup_config.toml:/app/config/mock_rollup_config.toml
- ./testing/files/sovereign-genesis/celestia:/app/examples/test-data/genesis/celestia
depends_on:
celestia-network-validator:
condition: service_healthy
celestia-network-bridge:
condition: service_healthy
ports:
- "8545:8545"
networks:
- sov-network

celestia-network-validator:
image: ghcr.io/celestiaorg/celestia-app:v3.0.0-mocha
container_name: celestia-network-validator
volumes:
- ./.tmp/celestia-validator:/home/celestia
- ./testing/files/celestia-validator:/testapp_files
ports:
- "9090:9090"
- "26656:26656"
- "26657:26657"
entrypoint: /testapp_files/entrypoint.sh
healthcheck:
test:
[
"CMD-SHELL",
'/bin/sh -c ''BLOCK_HEIGHT=$(curl -sf http://localhost:26657/status | jq -r .result.sync_info.latest_block_height); if [ "$$BLOCK_HEIGHT" -gt 1 ]; then exit 0; else echo "Block height too low: $$BLOCK_HEIGHT"; exit 1; fi''',
]
interval: 1s
timeout: 5s
retries: 10
start_period: 5s
networks:
- sov-network

celestia-network-bridge:
image: ghcr.io/celestiaorg/celestia-node:v0.20.1-mocha
container_name: celestia-network-bridge
environment:
- P2P_NETWORK=private
- "CELESTIA_CUSTOM=private:BFCEC14C1A50F3549777ED9EF350A9D79BE826C7836CD4FBEFE9C9C4F61A111F"
volumes:
- ./testing/files/celestia-bridge:/testapp_files
- ./.tmp/celestia-bridge:/home/celestia
entrypoint: /testapp_files/entrypoint.sh
command: celestia bridge start --p2p.network private --core.ip celestia-network-validator --rpc.addr 0.0.0.0 --rpc.port 26658 --keyring.keyname bridge
ports:
- "26658:26658"
- "2121:2121"
depends_on:
celestia-network-validator:
condition: service_healthy
healthcheck:
test:
[
"CMD-SHELL",
'AUTH_TOKEN=$(celestia bridge auth read --node.store=/home/celestia 2>/dev/null | tail -n 1); OUTPUT=$(curl -sf --max-time 0.5 -X POST -H "Content-type: application/json" -H "Accept: application/json" -H "Authorization: Bearer $$AUTH_TOKEN" -d ''{"id":1,"jsonrpc":"2.0","method":"header.SyncWait","params":[]}'' http://0.0.0.0:26658); if [ $$? -eq 0 ]; then exit 0; else echo "Catching up. $$OUTPUT"; exit 1; fi ',
]
interval: 1s
timeout: 5s
retries: 10
start_period: 5s
networks:
- sov-network

simapp-validator:
image: ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/simapp:latest
container_name: simapp-validator
volumes:
- ./.tmp/simapp-validator:/home/celestia
- ./testing/files/simapp-validator:/testapp_files
entrypoint: /testapp_files/entrypoint.sh
ports:
- "9190:9090"
- "5123:26657"
networks:
- sov-network

celestia-prover:
image: ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/celestia-prover:latest
container_name: celestia-prover
environment:
# TENDERMINT_RPC_URL should be the SimApp which is acting as a substitute
# for Celestia (with IBC Eurekea enabled).
- TENDERMINT_RPC_URL=http://simapp-validator:26657
- RPC_URL=http://reth:8545
ports:
- "50051:50051"
depends_on:
sovereign:
condition: service_started
networks:
- sov-network

networks:
sov-network:
driver: bridge
ipam:
config:
- subnet: 172.16.0.0/24
58 changes: 58 additions & 0 deletions testing/files/celestia_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[da]
# The JWT used to authenticate with the celestia light client. Instructions for generating this token can be found in the README
celestia_rpc_auth_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJwdWJsaWMiLCJyZWFkIiwid3JpdGUiLCJhZG1pbiJdfQ.qxoN_a-k7aZZE77VSpfgyvI_0eNvJ_OgBsT35zxUQnQ"
# The address of the *trusted* Celestia light client to interact with
celestia_rpc_address = "http://celestia-network-bridge:26658"
# The largest response the rollup will accept from the Celestia node. Defaults to 100 MB
max_celestia_response_body_size = 104_857_600
# The maximum time to wait for a response to an RPC query against Celestia node. Defaults to 60 seconds.
celestia_rpc_timeout_seconds = 60

[storage]
# The path to the rollup's data directory. Paths that do not begin with `/` are interpreted as relative paths.
path = "demo_data"

# We define the rollup's genesis to occur at block number `genesis_height`. The rollup will ignore
# any blocks before this height, and any blobs at this height will not be processed
[runner]
genesis_height = 3
# Block time for celestia is configured in `docker/run-validator.sh` and we try to set this one to be lower,
# So status is updated more frequently.
da_polling_interval_ms = 200

[runner.rpc_config]
# the host and port to bind the rpc server for
bind_host = "0.0.0.0"
bind_port = 8545
[runner.axum_config]
bind_host = "0.0.0.0"
bind_port = 8546
# In case the rollup is running behind a proxy
# public_address = "http://rollup.sovereign.xyz"

[monitoring]
telegraf_address = "127.0.0.0:8094"
# Defines how many measurements a rollup node will accumulate before sending it to the Telegraf.
# It is expected from the rollup node to produce metrics all the time,
# so measurements are buffered by size and not sent by time.
# and below 67 KB, which is the maximal UDP packet size.
# It also means that if a single serialized metric is larger than this value, a UDP packet will be larger.
# The default value is 508.
# max_datagram_size = 508
# How many metrics are allowed to be in pending state, before new metrics will be dropped.
# This is a number of metrics, not serialized bytes.
# The total number of bytes to be held in memory might vary per metric + `max_datagram_size`
# max_pending_metrics = 100

[proof_manager]
aggregated_proof_block_jump = 10
prover_address = "sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7qhzze66"
max_number_of_transitions_in_db = 100
max_number_of_transitions_in_memory = 30

[sequencer]
max_allowed_blocks_behind = 5
# DA address of this sequencer. Should match address of connected bridge/full node.
# Taken from ../../docker/credentials/bridge-0.addr
da_address = "celestia1a68m2l85zn5xh0l07clk4rfvnezhywc53g8x7s"
[sequencer.preferred]
16 changes: 16 additions & 0 deletions testing/files/sovereign-genesis/celestia/accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"accounts": [
{
"credential_id": "0x6cee0b576d84956732a626d67ee955373b7498e57ea45e41b637b33825179b6c",
"address": "sov1dnhqk4mdsj2kwv4xymt8a624xuahfx8906j9usdkx7ensgjkzmy"
},
{
"credential_id": "0xa3201954f70ad62230dc3d840a5bf767702c04869e85ab3eee0b962857ba7598",
"address": "sov15vspj48hpttzyvxu8kzq5klhvaczcpyxn6z6k0hwpwtzsxf35ku"
},
{
"credential_id": "0xfea6ac5b8751120fb62fff67b54d2eac66aef307c7dde1d394dea1e09e43dd44",
"address": "sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7qhzze66"
}
]
}
13 changes: 13 additions & 0 deletions testing/files/sovereign-genesis/celestia/attester_incentives.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"minimum_attester_bond": [1000, 1000],
"minimum_challenger_bond": [1000, 1000],
"initial_attesters": [
[
"sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7qhzze66",
200000
]
],
"rollup_finality_period": 5,
"maximum_attested_height": 0,
"light_client_finalized_height": 0
}
27 changes: 27 additions & 0 deletions testing/files/sovereign-genesis/celestia/bank.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"gas_token_config": {
"token_name": "sov-token",
"address_and_balances": [
[
"sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7qhzze66",
10000000000000
],
[
"sov1x3jtvq0zwhj2ucsc4hqugskvralrulxvf53vwtkred93s85ar2a",
10000000000000
],
[
"sov15vspj48hpttzyvxu8kzq5klhvaczcpyxn6z6k0hwpwtzsxf35ku",
10000000000000
],
[
"sov1dnhqk4mdsj2kwv4xymt8a624xuahfx8906j9usdkx7ensgjkzmy",
10000000000000
]
],
"admins": [
"sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7qhzze66"
]
},
"tokens": []
}
13 changes: 13 additions & 0 deletions testing/files/sovereign-genesis/celestia/chain_state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"current_time": {
"secs": 0,
"nanos": 0
},
"operating_mode": "zk",
"inner_code_commitment": [0, 0, 0, 0, 0, 0, 0, 0],
"outer_code_commitment": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
],
"genesis_da_height": 3
}
Loading

0 comments on commit ab26692

Please sign in to comment.