Skip to content

Commit

Permalink
Merge pull request #20 from orbitron-labs/gmd-cel
Browse files Browse the repository at this point in the history
Gmd cel
  • Loading branch information
chappie1998 authored Apr 4, 2024
2 parents 71e8de3 + e9c2bd0 commit 85d32d1
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 16 deletions.
14 changes: 12 additions & 2 deletions local.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ about = "Run Rollkit avail nodes"
binary = "orb-rollkit-avail"
download = "scripts/run/rollkit_avail.sh"

[components.run.rollkit.gmd]
[components.run.rollkit.gmd-avail]
about = "Run Rollkit gmd node"
binary = "orb-rollkit-gmd"
download = "scripts/run/rollkit_gmd.sh"

[components.run.rollkit.celestia]
about = "Run Rollkit celestia node"
binary = "orb-rollkit-avail"
download = "scripts/run/rollkit_celestia.sh"

[components.run.rollkit.gmd-celestia]
about = "Run Rollkit gmd nodes"
binary = "orb-rollkit-gmd"
download = "scripts/run/rollkit_gmd.sh"
download = "scripts/run/rollkit_gmd_celestia.sh"
21 changes: 10 additions & 11 deletions scripts/run/celestia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ NODE_STORE=".orb/celestia"
# check if the binary is already installed
if [ -f "$INTERNAL_DIR/celestia" ]; then
echo "🚀 Celestia is already installed"
if [ ! -f "$HOME/$NODE_STORE/config.yml" ]; then
if [ ! -f "$HOME/.celestia-light/config.yml" ]; then
# This should be handled in the InitializeConfig code
mkdir -p $HOME/$NODE_DIR
celestia light init --node.store $HOME/$NODE_STORE
# mkdir -p $HOME/$NODE_DIR
celestia light init
fi
celestia light start --node.store $HOME/$NODE_STORE
celestia light start
exit 0
fi

Expand All @@ -28,19 +28,18 @@ fi
# Download avail binary
FILE="celestia-$OS-$ARCH.tar.xz"
echo "💈 Downloading Celestia..."
TGZ_URL="https://github.com/orbitron-labs/orb/releases/download/avail-v1.7.9/$FILE"
TGZ_URL="https://github.com/orbitron-labs/orb/releases/download/celestia-v0.12.3/$FILE"
curl -sLO "$TGZ_URL" --progress-bar

tar -xf $FILE
chmod +x avail-light
sudo mv avail-light "$INTERNAL_DIR"/avail-light
chmod +x celestia
sudo mv celestia "$INTERNAL_DIR"/celestia
rm $FILE

if [ ! -f "$HOME/$NODE_STORE/config.yml" ]; then
if [ ! -f "$HOME/.celestia-light/config.yml" ]; then
# This should be handled in the InitializeConfig code
mkdir -p $HOME/$NODE_DIR
celestia light --node.store $HOME/$NODE_STORE
celestia light init
fi

# Handle this in GetStartCmd
celestia light start --node.store $HOME/$NODE_STORE
celestia light start
3 changes: 1 addition & 2 deletions scripts/run/rollkit_avail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mkdir -p "tmp"
if [ ! -f "$DA_LOGS" ]; then
touch "$DA_LOGS"
fi
data-avail --dev --enable-kate-rpc > "$DA_LOGS" 2>&1 &
data-avail --dev > "$DA_LOGS" 2>&1 &

LOGS="tmp/avail-light-bootstrap.log"
if [ ! -f "$LOGS" ]; then
Expand All @@ -49,7 +49,6 @@ LOGS="tmp/avail-light.log"
if [ ! -f "$LOGS" ]; then
touch "$LOGS"
fi
echo "$HOME/.orb/scripts/configs/avail-config.yaml"
# avail-light --network local -c $HOME/.orb/scripts/configs/avail-config.yaml --clean > "$LOGS" 2>&1 &
avail-light --network local > "$LOGS" 2>&1 &

Expand Down
45 changes: 45 additions & 0 deletions scripts/run/rollkit_celestia.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
set -e

INTERNAL_DIR="/usr/local/bin"
NODE_STORE=".orb/celestia-arabica"

# check if the binary is already installed
if [ -f "$INTERNAL_DIR/celestia" ]; then
echo "🚀 Celestia is already installed"
if [ ! -f "$HOME/.celestia-light-arabica-11/config.yml" ]; then
# This should be handled in the InitializeConfig code
mkdir -p $HOME/$NODE_DIR
celestia light init --p2p.network arabica
fi
celestia light start --p2p.network arabica
exit 0
fi

OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

if [[ "$ARCH" == "x86_64" ]]; then
ARCH="amd64"
elif [[ "$ARCH" == "arm64" ]] || [[ "$ARCH" == "aarch64" ]]; then
ARCH="arm64"
fi

# Download avail binary
FILE="celestia-$OS-$ARCH.tar.xz"
echo "💈 Downloading Celestia..."
TGZ_URL="https://github.com/orbitron-labs/orb/releases/download/avail-v1.7.9/$FILE"
curl -sLO "$TGZ_URL" --progress-bar

tar -xf $FILE
chmod +x avail-light
sudo mv avail-light "$INTERNAL_DIR"/avail-light
rm $FILE

if [ ! -f "$HOME/.celestia-light-arabica-11/config.yml" ]; then
# This should be handled in the InitializeConfig code
celestia light --p2p.network arabica
fi

# Handle this in GetStartCmd
celestia light start --p2p.network arabica
84 changes: 84 additions & 0 deletions scripts/run/rollkit_gmd_celestia.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/sh
set -e

INTERNAL_DIR="/usr/local/bin"

# check if the binary is already installed
if [ ! -f "$INTERNAL_DIR/cel-gmd" ]; then
echo "💈 Downloading cel-gmd..."
# OS=$(uname -s | tr '[:upper:]' '[:lower:]')
# ARCH=$(uname -m)

# if [[ "$ARCH" == "x86_64" ]]; then
# ARCH="amd64"
# elif [[ "$ARCH" == "arm64" ]] || [[ "$ARCH" == "aarch64" ]]; then
# ARCH="arm64"
# fi

FILE="rollkit-cel-gmd-linux-amd64.tar.xz"

# Download avail binary
TGZ_URL="https://github.com/orbitron-labs/orb/releases/download/rollkit-gmd/$FILE"
curl -sLO "$TGZ_URL" --progress-bar

tar -xf $FILE
chmod +x cel-gmd
sudo mv cel-gmd "$INTERNAL_DIR"/cel-gmd
rm $FILE

fi
# set variables for the chain
VALIDATOR_NAME=validator1
CHAIN_ID=gm
KEY_NAME=gm-key
KEY_2_NAME=gm-key-2
CHAINFLAG="--chain-id ${CHAIN_ID}"
TOKEN_AMOUNT="10000000000000000000000000stake"
STAKING_AMOUNT="1000000000stake"

# query the DA Layer start height, in this case we are querying
# an RPC endpoint provided by Celestia Labs. The RPC endpoint is
# to allow users to interact with Celestia's core network by querying
# the node's state and broadcasting transactions on the Celestia
# network. This is for Arabica, if using another network, change the RPC.
DA_BLOCK_HEIGHT=$(curl https://rpc.celestia-arabica-11.com/block | jq -r '.result.block.header.height')
echo -e "\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n"

AUTH_TOKEN=$(celestia light auth write --p2p.network arabica)
echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n"

# reset any existing genesis/chain data
cel-gmd tendermint unsafe-reset-all

# initialize the validator with the chain ID you set
cel-gmd init $VALIDATOR_NAME --chain-id $CHAIN_ID

# add keys for key 1 and key 2 to keyring-backend test
cel-gmd keys add $KEY_NAME --keyring-backend test
cel-gmd keys add $KEY_2_NAME --keyring-backend test

# add these as genesis accounts
cel-gmd genesis add-genesis-account $KEY_NAME $TOKEN_AMOUNT --keyring-backend test
cel-gmd genesis add-genesis-account $KEY_2_NAME $TOKEN_AMOUNT --keyring-backend test

# set the staking amounts in the genesis transaction
cel-gmd genesis gentx $KEY_NAME $STAKING_AMOUNT --chain-id $CHAIN_ID --keyring-backend test

# collect genesis transactions
cel-gmd genesis collect-gentxs

# copy centralized sequencer address into genesis.json
# Note: validator and sequencer are used interchangeably here
ADDRESS=$(jq -r '.address' ~/.gm/config/priv_validator_key.json)
PUB_KEY=$(jq -r '.pub_key' ~/.gm/config/priv_validator_key.json)
jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000", "name": "Rollkit Sequencer"}]' ~/.gm/config/genesis.json > temp.json && mv temp.json ~/.gm/config/genesis.json

# create a restart-testnet.sh file to restart the chain later
[ -f restart-testnet.sh ] && rm restart-testnet.sh
echo "DA_BLOCK_HEIGHT=$DA_BLOCK_HEIGHT" >> restart-testnet.sh
echo "AUTH_TOKEN=$AUTH_TOKEN" >> restart-testnet.sh

echo "cel-gmd start --rollkit.aggregator --rollkit.da_auth_token=\$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height \$DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr \"0.0.0.0:36656\" --minimum-gas-prices="0.025stake"" >> restart-testnet.sh

# start the chain
cel-gmd start --rollkit.aggregator --rollkit.da_auth_token=$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr "0.0.0.0:36656" --minimum-gas-prices="0.025stake"
1 change: 0 additions & 1 deletion src/executor/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::{
io::{BufRead, BufReader},
process::{exit, Command, Stdio},
};

use crate::config;

pub fn execute_run_command(component_name: &str, subcomponent_name: &str) {
Expand Down

0 comments on commit 85d32d1

Please sign in to comment.