Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes srs_setup.sh to use .env instead of hardcoded values #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions srs_setup.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/sh
# Path: srs_setup.sh

. ./.env

DOWNLOADED_FILE=false
echo "Downloading srs resources"
if ! [ -f ./resources/g1.point ]; then
if ! [ -f $NODE_G1_PATH_HOST ]; then
echo "g1.point does not exist."
echo "Downloading g1 point. This could take upto 5 minutes"
wget https://srs-mainnet.s3.amazonaws.com/kzg/g1.point --output-document=./resources/g1.point
wget https://srs-mainnet.s3.amazonaws.com/kzg/g1.point --output-document=$NODE_G1_PATH_HOST
DOWNLOADED_FILE=true
else
echo "g1.point already exists."
Expand All @@ -24,10 +26,18 @@ fi
# Any time we download the file, validate hashes
if [ "$DOWNLOADED_FILE" = true ]; then
echo "validating hashes of g1 and g2 points This could take upto 5 minutes"
if (cd ./resources && sha256sum -c srssha256sums.txt); then
CHECKSUM_FILE="./resources/srssha256sums.txt"

G1_CHECKSUM_EXPECTED=$(grep 'g1.point$' "$CHECKSUM_FILE" | awk '{print $1}')
G2_CHECKSUM_EXPECTED=$(grep 'g2.point.powerOf2$' "$CHECKSUM_FILE" | awk '{print $1}')

G1_CHECKSUM_ACTUAL=$(sha256sum "$NODE_G1_PATH_HOST" | awk '{print $1}')
G2_CHECKSUM_ACTUAL=$(sha256sum "$NODE_G2_PATH_HOST" | awk '{print $1}')

if [ "$G1_CHECKSUM_EXPECTED" = "$G1_CHECKSUM_ACTUAL" ] && [ "$G2_CHECKSUM_EXPECTED" = "$G2_CHECKSUM_ACTUAL" ]; then
echo "Checksums match. Verification successful."
else
echo "Error: Checksums do not match. Exiting."
exit 1
fi
fi
fi