forked from Layr-Labs/eigenda-operator-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
srs_setup.sh
executable file
·43 lines (36 loc) · 1.48 KB
/
srs_setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# Path: srs_setup.sh
. ./.env
DOWNLOADED_FILE=false
echo "Downloading srs resources"
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=$NODE_G1_PATH_HOST
DOWNLOADED_FILE=true
else
echo "g1.point already exists."
fi
if ! [ -f ./resources/g2.point.powerOf2 ]; then
echo "g2.point.powerOf2 does not exist."
echo "Downloading g2 point powerOf2. This will take few seconds"
wget https://srs-mainnet.s3.amazonaws.com/kzg/g2.point.powerOf2 --output-document=./resources/g2.point.powerOf2
DOWNLOADED_FILE=true
else
echo "g2.point.powerOf2 already exists."
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"
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