Coder Social home page Coder Social logo

local-celestia-devnet's Introduction

Local Celestia Devnet

This repo provides a Docker image that allows developers to spin up a local Celestia devnet composed of:

  • 1 x celestia-app validator node
  • 1 x celestia-node bridge node

For information about the different node types, see here.

To run the Docker image from ghcr.io

docker run -t -i \
    -p 26650:26650 -p 26657:26657 -p 26658:26658 -p 26659:26659 -p 9090:9090 \
    ghcr.io/rollkit/local-celestia-devnet:latest

To build and run the Docker image

First, clone the repository:

git clone https://github.com/rollkit/local-celestia-devnet.git

Change into the directory:

cd local-celestia-devnet/

To build the Docker image:

docker build . -t celestia-local-devnet

To run the Docker container:

docker run -t -i \
    -p 26650:26650 -p 26657:26657 -p 26658:26658 -p 26659:26659 -p 9090:9090 \
    celestia-local-devnet

Test that the HTTP gateway server is up:

curl -X GET http://127.0.0.1:26659/head

Running a Detached Container

If you would like the run the container in the background, you can use the -d flag:

docker run -d -t -i \
    -p 26650:26650 -p 26657:26657 -p 26658:26658 -p 26659:26659 -p 9090:9090 \
    celestia-local-devnet

Stopping the Container

To stop the container when you are attached to the container, you can use Ctrl+C to stop the container.

To stop the container when you are detached from the container, you can use the docker ps command to find the container ID:

docker ps

Then, use the docker stop command to stop the container:

docker stop <container-id>

To remove the container, use the docker rm command to remove the container:

docker rm <container-id>

Exposed Ports

Port Protocol Address Description Node Type
26650 gRPC 127.0.0.1 gRPC Data Availability Service
26657 HTTP 127.0.0.1 RPC Consensus (e.g celestia-app)
26658 HTTP 127.0.0.1 RPC Data Availability (e.g celestia-node)
26659 HTTP 127.0.0.1 REST Data Availability (e.g celestia-node)
9090 HTTP 0.0.0.0 gRPC Consensus (e.g celestia-app)

Environment Variables

Variable Description Default
CELESTIA_NAMESPACE Namespace to use for DA Service Randomly generated

You may also find these docs helpful:

local-celestia-devnet's People

Contributors

bidon15 avatar dependabot[bot] avatar gupadhyaya avatar hcastano avatar jcstein avatar manav-aggarwal avatar msevey avatar natalipatel8 avatar rootulp avatar smuu avatar sysrex avatar tuxcanfly avatar tzdybal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

local-celestia-devnet's Issues

devnet block time is slow

Version of Git SHA

dd90c11

System OS

MacOS

Installed tools

No response

Others

No response

Steps to reproduce it

docker run ghcr.io/rollkit/local-celestia-devnet:latest

Expected result

block time should be ~2s.

Actual result

block time is ~10s.

Relevant log output

No response

Notes

It seems that celestia-app config changed over time which invalidated our sed/replace in config.toml, in particular timeout_propose and timeout_commit.

Smoke Test for docker image

Create a simple smoke test to test if the docker image builds correctly and if you can communicate correctly with the exposed ports via, for example, curl.

Build ARM-compatible version of this Image

On Mac (ARM)

docker run -p 26657:26657 -p 26659:26659 ghcr.io/celestiaorg/local-celestia-devnet:main

Result

Unable to find image 'ghcr.io/celestiaorg/local-celestia-devnet:main' locally
2main: Pulling from celestiaorg/local-celestia-devnet
3docker: no matching manifest for linux/arm64/v8 in the manifest list entries.
4See 'docker run --help'.

Link to snippet

docker: Error response from daemon: Head "https://ghcr.io/v2/rollkit/local-celestia-devnet/manifests/main": unauthorized.

# in
docker run --platform linux/amd64 -p 26657:26657 -p 26659:26659 ghcr.io/rollkit/local-celestia-devnet

# out
Unable to find image 'ghcr.io/rollkit/local-celestia-devnet:latest' locally
docker: Error response from daemon: Head "https://ghcr.io/v2/rollkit/local-celestia-devnet/manifests/latest": unauthorized.
See 'docker run --help'.
# in
docker run --platform linux/amd64 -p 26657:26657 -p 26659:26659 ghcr.io/rollkit/local-celestia-devnet:4fa5220

# out
Unable to find image 'ghcr.io/rollkit/local-celestia-devnet:4fa5220' locally
docker: Error response from daemon: Head "https://ghcr.io/v2/rollkit/local-celestia-devnet/manifests/4fa5220": unauthorized.
See 'docker run --help'.
# in
docker run --platform linux/amd64 -p 26657:26657 -p 26659:26659 ghcr.io/rollkit/local-celestia-devnet:main

# out
Unable to find image 'ghcr.io/rollkit/local-celestia-devnet:main' locally
docker: Error response from daemon: Head "https://ghcr.io/v2/rollkit/local-celestia-devnet/manifests/main": unauthorized.
See 'docker run --help'.

Consider deleting no-op sed commands

Context

sed -i'.bak' 's/index_all_keys = false/index_all_keys = true/g' ~/.celestia-app/config/config.toml
sed -i'.bak' 's/mode = "full"/mode = "validator"/g' ~/.celestia-app/config/config.toml

Problem

What are these two lines for? As far as I can tell, there is no instance of index_all_keys = false or mode = "full" in the default ~/.celestia-app/config/config.toml so I think these lines are no-ops.

Proposal

If they are no-ops, proposal to delete them.

bridge node panic on v0.11.0-rc11

Version of Git SHA

https://github.com/rollkit/local-celestia-devnet/releases/tag/v0.11.0-rc11

System OS

macOS

Installed tools

No response

Others

No response

Steps to reproduce it

Run local-celestia-devnet:

docker run --platform linux/amd64 -p 26657:26657 -p 26658:26658 -p 26659:26659 ghcr.io/rollkit/local-celestia-devnet:v0.11.0-rc11

Clone Polaris:

git clone https://github.com/gupadhyaya/polaris.git
cd polaris
git checkout polaris

Set auth token:

iโ€™m using this as auth token, on rc11 devnet, but still getting same errors. ive manually set auth token and gotten same result

export AUTH_TOKEN=$(docker exec $(docker ps -q)  celestia bridge --node.store /bridge  auth admin)

Or change polaris/cosmos/init.sh AUTH_TOKEN to AUTH_TOKEN=$(docker exec $(docker ps -q) celestia bridge --node.store /bridge auth admin)

Or set it manually so that AUTH_TOKEN="stringauthtoken"

Run polaris

mage start

Expected result

posts to DA without an issue

Actual result

https://gist.github.com/jcstein/722600b3c210f642dc1fe4635f837983 - devnet errors
https://app.warp.dev/block/11BIRPSaovIA0NkK7a6yqp - polaris errors

Relevant log output

No response

Notes

Full logs here

Edit to reflect changes in docker on celestia-node #1913

Error building this when testing celestia-node v0.8.0-rc1, needs to be updated to reflect celestiaorg/celestia-node#1913

docker build . -t celestia-local-devnet

[+] Building 0.5s (8/11)
 => [internal] load build definition from Dockerfile                    0.0s
 => => transferring dockerfile: 32B                                     0.0s
 => [internal] load .dockerignore                                       0.0s
 => => transferring context: 2B                                         0.0s
 => [internal] load metadata for ghcr.io/celestiaorg/celestia-app:v0.1  0.4s
 => [internal] load metadata for ghcr.io/celestiaorg/celestia-node:v0.  0.4s
 => CACHED [celestia-node 1/1] FROM ghcr.io/celestiaorg/celestia-node:  0.0s
 => [stage-1 1/5] FROM ghcr.io/celestiaorg/celestia-app:v0.12.1@sha256  0.0s
 => CANCELED [internal] load build context                              0.0s
 => => transferring context:                                            0.0s
 => ERROR [stage-1 2/5] COPY --from=celestia-node /celestia /           0.0s
------
 > [stage-1 2/5] COPY --from=celestia-node /celestia /:
------
ERROR: failed to solve: failed to compute cache key: "/celestia" not found: not found

Add ability to add nodes to the default config

There are many use cases for wanting the ability to connect and disconnect a new node to a running network. We should add the ability to add a node to a running local devnet. Currently this fails.

[Feature Request]: support celestia-da

Implementation ideas

For projects integrating with local celestia devnet, it would be great to have celestia-da embedded into the docker image, so that integrations don't have to run another process for the gRPC DA service.

Ctrl+c doesn't exit devnet

Context

I just a local devnet with the steps at https://github.com/rollkit/local-celestia-devnet#to-build-and-run-the-docker-image

Problem

I'm attempting to stop the devnet with Ctrl + C but that's not stopping the devnet. Notice the ^C in the terminal output:

^C7:57PM INF Timed out dur=10993.078792 height=14 module=consensus round=0 step=1
7:57PM INF received proposal module=consensus proposal={"Type":32,"block_id":{"hash":"E3F0A48B96D9A48236EEECD0CA5D7B312F47620787844A13185BA1F51926E4A3","parts":{"hash":"653454D2A26B2FDF64CFEA23EC46B49F25F6F225545DB7ECA96B8756C402D587","total":1}},"height":14,"pol_round":-1,"round":0,"signature":"HvyIDuTbr/dftdMAaPkorWU/G+t+f4DVA1XErc1+0WuYXqCIrx1E6KaY7t/UWAFiMkMmW/SufCjdQxTc6rinAA==","timestamp":"2023-09-19T19:57:35.175358293Z"}
7:57PM INF received complete proposal block hash=E3F0A48B96D9A48236EEECD0CA5D7B312F47620787844A13185BA1F51926E4A3 height=14 module=consensus

To resolve I had to open Docker Dashboard and stop the container with

Screenshot 2023-09-19 at 3 57 24 PM

Question

Is this expected behavior? Is it possible for the devnet to stop if I Ctrl+C in terminal?

Fix waiting for genesis hash

Currently waiting for genesis-hash consist of two steps:

  • sleep 10
  • wait-for-it.sh command.

There are tree problems with this:

  • sleep 10
  • wait-for-it.sh command is not doing what we expect it to do
  • hash is stored in file, for no good reason - using variable is way simpler

Use of wait-for-it.sh was extracted from go-cnc integration test docker setup, where it usually worked for some reason, but sometimes failed, especially when docker host OS was MacOS.

The problem is that wait-for-it.sh waits for TCP port to be open and executes command as soon as possible. If genesis block is not available following command stores null to genesis.hash file:
https://github.com/celestiaorg/local-celestia-devnet/blob/f49a10f9be8af25fe0d589673b3280da337a340b/entrypoint.sh#L38

Next curl command (used only for debugging) actually returns error because 0xnull is passed as argument:
https://github.com/celestiaorg/local-celestia-devnet/blob/f49a10f9be8af25fe0d589673b3280da337a340b/entrypoint.sh#L40

Improve Readme

Write a more descriptive Readme that says:

  • What the architecture is that we are spinning up
  • What the purpose of this testnet is / What you can test with it
  • Who are the users for this testnet
  • What is not the purpose of this testnet, and what kind of alternatives are there

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.