Skip to content

Commit

Permalink
refactor: refactor scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
captainlee1024 committed Aug 10, 2024
1 parent 18bb42c commit e8fb5af
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 16 deletions.
25 changes: 21 additions & 4 deletions scripts/build-and-install-lighthouse.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
cd ..
echo $PWD
mkdir -p tmp/lighthouse-source
cd tmp/lighthouse-source
set -e

CURRENT_PATH=$( cd "$( dirname "$0" )" && pwd )
PROJECT_PATH=$(dirname "${CURRENT_PATH}")
echo "PROJECT_PATH: ${PROJECT_PATH}"

LIGHTHOUSE_SOURCE_PATH="${PROJECT_PATH}/tmp/lighthouse-source"
echo "LIGHTHOUSE_SOURCE_PATH: ${LIGHTHOUSE_SOURCE_PATH}"

if [ ! -d "${LIGHTHOUSE_SOURCE_PATH}" ]; then
mkdir -p "${LIGHTHOUSE_SOURCE_PATH}"
fi

cd ${LIGHTHOUSE_SOURCE_PATH}

echo "Removing existing lighthouse source"
rm -rf ./*

echo "Cloning lighthouse source"
git clone https://github.com/sigp/lighthouse.git
cd lighthouse

## lighthouse tag: v5.2.1
echo "Checkout lighthouse commit: 9e12c21f268c80a3f002ae0ca27477f9f512eb6f"
git checkout 9e12c21f268c80a3f002ae0ca27477f9f512eb6f

echo "Build and Install lighthouse"
make install
28 changes: 22 additions & 6 deletions scripts/build-eth2-validator-tools.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
cd ..
echo $PWD
mkdir -p tmp/tools
cd tmp/tools
set -e

CURRENT_PATH=$( cd "$( dirname "$0" )" && pwd )
PROJECT_PATH=$(dirname "${CURRENT_PATH}")
echo "PROJECT_PATH: ${PROJECT_PATH}"

INSTALL_PATH="${PROJECT_PATH}/tmp/tools/bin"
echo "Tools INSTALL_PATH: ${INSTALL_PATH}"
if [ ! -d "${PROJECT_PATH}/tmp/tools" ]; then
mkdir -p "${PROJECT_PATH}/tmp/tools"
fi

cd "${PROJECT_PATH}/tmp/tools"

echo "Removing existing eth2-val-tools"
rm -rf ./*

echo "Cloning eth2-val-tools"
git clone https://github.com/protolambda/eth2-val-tools.git
cd eth2-val-tools

echo "Checkout eth2-val-tools commit: 0d6d1ddb36479e73d7d876b29ac2d10ab3988e85"
git checkout 0d6d1ddb36479e73d7d876b29ac2d10ab3988e85
echo "Build eth2-val-tools, target path: $PWD/tools/bin/eth2-val-tools"
go build -o ../bin/eth2-val-tools

echo "Build eth2-val-tools, target path: ${INSTALL_PATH}"
go build -o ${INSTALL_PATH}/eth2-val-tools
29 changes: 23 additions & 6 deletions scripts/generate-eth2-validator-keys.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
cd ../tmp
echo $PWD
set -e

rm -rf ../testdata/layer2/pos/validator-keys
CURRENT_PATH=$( cd "$( dirname "$0" )" && pwd )
PROJECT_PATH=$(dirname "${CURRENT_PATH}")
echo "PROJECT_PATH: ${PROJECT_PATH}"

tools/bin/eth2-val-tools keystores \
VALIDATOR_KEYS_PATH="${PROJECT_PATH}/testdata/layer2/pos/validator-keys"
echo "VALIDATOR_KEYS_PATH: ${VALIDATOR_KEYS_PATH}"

echo "Removing existing validator keys"
rm -rf ${VALIDATOR_KEYS_PATH}

DEFAULT_MNEMONIC="giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete"
echo "Default mnemonic: ${DEFAULT_MNEMONIC}"

DEFAULT_TOOLS_BIN_PATH="${PROJECT_PATH}/tmp/tools/bin/eth2-val-tools"
echo "DEFAULT_TOOLS_BIN_PATH: ${DEFAULT_TOOLS_BIN_PATH}"
if [ ! -f "${DEFAULT_TOOLS_BIN_PATH}" ]; then
echo "eth2-val-tools binary not found: ${DEFAULT_TOOLS_BIN_PATH}, please run make build_eth2_validator_tools or scripts/build-eth2-validator-tools.sh"
exit 1
fi

${DEFAULT_TOOLS_BIN_PATH} keystores \
--insecure \
--prysm-pass password \
--out-loc ../testdata/layer2/pos/validator-keys \
--source-mnemonic "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete" \
--out-loc ${VALIDATOR_KEYS_PATH} \
--source-mnemonic "${DEFAULT_MNEMONIC}" \
--source-min 0 \
--source-max 64

0 comments on commit e8fb5af

Please sign in to comment.