Skip to content

Commit

Permalink
chore: add bin install script (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemijspavlovs authored Aug 8, 2024
1 parent 17243ea commit 6e3ea30
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/config/init/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func UpdateGenesisParams(home string, raCfg *config.RollappConfig) error {
addGenAccountCmd := exec.Command(
consts.Executables.RollappEVM,
"add-genesis-account",
sa,
consts.KeysIds.RollappSequencer,
fmt.Sprintf("%s%s", consts.DefaultTokenSupply, cfg.BaseDenom),
"--home",
fmt.Sprintf("%s/%s", home, consts.ConfigDirName.Rollapp),
Expand All @@ -117,7 +117,7 @@ func GetAddGenesisAccountCmd(addr, amount string, raCfg *config.RollappConfig) *
consts.Executables.RollappEVM,
"add-genesis-account",
addr,
fmt.Sprintf("%s%s", consts.DefaultTokenSupply, raCfg.BaseDenom),
fmt.Sprintf("%s%s", amount, raCfg.BaseDenom),
"--home",
fmt.Sprintf("%s/%s", home, consts.ConfigDirName.Rollapp),
"--keyring-backend",
Expand Down Expand Up @@ -161,7 +161,7 @@ func GetRollappSequencerAddress(home string) (string, error) {
ChainBinary: consts.Executables.RollappEVM,
Type: config.EVM_ROLLAPP,
}
addr, err := utils.GetAddressBinary(seqKeyConfig, seqKeyConfig.Dir)
addr, err := utils.GetAddressBinary(seqKeyConfig, consts.Executables.RollappEVM)
if err != nil {
return "", err
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/rollapp/init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package initrollapp

import (
"fmt"
"strings"

"github.com/pterm/pterm"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -30,7 +29,7 @@ func Cmd() *cobra.Command {
return
}

err = runInit(cmd, WithConfig(strings.TrimSpace(archivePath)))
err = runInit(cmd, WithConfig(archivePath))
if err != nil {
fmt.Printf("failed to initialize the RollApp: %v\n", err)
return
Expand Down
85 changes: 85 additions & 0 deletions scripts/install-binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash
BINS_DIR="/usr/local/bin"
ROLLER_BINS_DIR="$BINS_DIR/roller_bins"

ROLLAPP_EVN_VERSION="v2.2.1-rc01"
DYMD_VERSION=""
DYMD_COMMIT="b9d863e6"
EIBC_VERSION="main"
RLY_VERSION="v0.3.4-v2.5.2-relayer"
CELESTIA_VERSION="v0.14.1"

if [ -z "$BECH32_PREFIX" ]; then
echo "please provide BECH32_PREFIX of the RollApp before running this script"
exit 1
fi

# /usr/local/bin
# roller
if ! command -v "$BINS_DIR/roller" &> /dev/null; then
cd ~/ && rm -rf roller/
git clone https://github.com/dymensionxyz/roller.git && cd roller || exit 1
make build && sudo mv ./build/roller "$BINS_DIR"
cd ../ && rm -rf roller/
fi

# rollapp-evm
if ! command -v "$BINS_DIR/rollapp-evm" &> /dev/null; then
cd ~/ && rm -rf rollapp-evm/
git clone https://github.com/dymensionxyz/rollapp-evm.git --branch "$ROLLAPP_EVN_VERSION" && cd rollapp-evm || exit 1
make build && sudo mv ./build/rollapp-evm "$BINS_DIR"
cd ../ && rm -rf rollapp-evm/
fi

#dymd
if ! command -v "$BINS_DIR/dymd" &> /dev/null; then
cd ~/ && rm -rf dymension/
if [ "$DYMD_VERSION" != "" ]; then
git clone https://github.com/dymensionxyz/dymension.git --branch "$DYMD_VERSION" && cd dymension || exit 1
make build && sudo mv ./build/dymd "$BINS_DIR"
cd ../ && rm -rf dymension/
elif [ "$DYMD_COMMIT" != "" ]; then
git clone https://github.com/dymensionxyz/dymension.git && cd dymension || exit 1
git checkout $DYMD_COMMIT
make build && sudo mv ./build/dymd "$BINS_DIR"
cd ../ && rm -rf dymension/
else
exit 1
fi
fi

# eibc
if ! command -v "$BINS_DIR/eibc-client" &> /dev/null; then
cd ~/ && rm -rf eibc-client/
git clone https://github.com/dymensionxyz/eibc-client.git --branch $EIBC_VERSION && cd eibc-client || exit 1
make build && sudo mv ./build/eibc-client "$BINS_DIR"
cd ../ && rm -rf eibc-client/
fi


# /usr/local/bin/roller_bins
if [ ! -d "$ROLLER_BINS_DIR" ]; then
sudo mkdir -p "$ROLLER_BINS_DIR"
fi

# celestia & cel-key
if ! command -v "$ROLLER_BINS_DIR/celestia" &> /dev/null || ! command -v "$ROLLER_BINS_DIR/cel-key" &> /dev/null; then
cd ~/ && rm -rf celestia-node
git clone https://github.com/celestiaorg/celestia-node.git --branch $CELESTIA_VERSION && cd celestia-node || exit 1
if ! command -v "$ROLLER_BINS_DIR/celestia" &> /dev/null; then
make build && sudo mv build/celestia "$ROLLER_BINS_DIR"
fi

if ! command -v "$ROLLER_BINS_DIR/cel-key" &> /dev/null; then
make cel-key && sudo mv cel-key "$ROLLER_BINS_DIR"
fi
cd ../ && rm -rf celestia-node
fi

# rly
if ! command -v "$ROLLER_BINS_DIR/rly" &> /dev/null; then
cd ~/ && rm -rf go-relayer/
git clone https://github.com/dymensionxyz/go-relayer.git --branch $RLY_VERSION && cd go-relayer || exit 1
make build && sudo mv build/rly "$ROLLER_BINS_DIR"
cd ../ && rm -rf go-relayer/
fi

0 comments on commit 6e3ea30

Please sign in to comment.