Skip to content

Commit

Permalink
refactor(relay): Use new links to download zkey/dat if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
kkirkov authored and Dimo99 committed Sep 5, 2024
1 parent abe370e commit 8fd9538
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions relay/process-compose-scripts/start-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,37 @@ calculate_checksum() {
}

download_zkey_file() {
echo "Downloading zkey file from http://dendreth.metacraft-labs.com/deneb_284.zkey ..."
echo "Downloading zkey file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.zkey ..."

curl http://dendreth.metacraft-labs.com/deneb_284.zkey >"${GIT_ROOT}/data/light_client.zkey"
curl https://dendrethstorage.blob.core.windows.net/light-client/light-client.zkey >"${GIT_ROOT}/data/light_client.zkey"

CALCULATED_ZKEY_SUM=$(calculate_checksum "${GIT_ROOT}/data/light_client.zkey")

if [ "${ZKEY_B3SUM_SUM}" = "${CALCULATED_ZKEY_SUM}" ]; then
echo "Zkey file downloaded successfully to ${GIT_ROOT}/data/light_client.zkey"
else
echo "Failed to download zkey file from http://dendreth.metacraft-labs.com/deneb_284.zkey"
echo "Failed to download zkey file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.zkey"
exit 1
fi
}

download_dat_file() {
echo "Downloading .dat file from https://media.githubusercontent.com/media/metacraft-labs/DendrETH-build-artifacts/master/light_client_cpp/light_client.dat ..."
echo "Downloading .dat file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.dat ..."

curl -k https://media.githubusercontent.com/media/metacraft-labs/DendrETH-build-artifacts/master/light_client_cpp/light_client.dat >"data/light_client.dat"
curl -k https://dendrethstorage.blob.core.windows.net/light-client/light-client.dat >"data/light_client.dat"

CALCULATED_DAT_SUM=$(calculate_checksum "${GIT_ROOT}/data/light_client.dat")

if [ "${DAT_B3SUM_SUM}" = "${CALCULATED_DAT_SUM}" ]; then
echo ".dat file downloaded successfully to ${GIT_ROOT}/data/light_client.dat"
else
echo "Failed to download .dat file from https://media.githubusercontent.com/media/metacraft-labs/DendrETH-build-artifacts/master/light_client_cpp/light_client.dat"
echo "Failed to download .dat file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.dat"
exit 1
fi
}

mkdir -p "${GIT_ROOT}/data"

if [ ! -f "${GIT_ROOT}/data/light_client.zkey" ]; then
download_zkey_file
else
Expand Down
14 changes: 8 additions & 6 deletions relay/run-relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,37 @@ calculate_checksum() {
}

download_zkey_file() {
echo "Downloading zkey file from http://dendreth.metacraft-labs.com/deneb_284.zkey ..."
echo "Downloading zkey file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.zkey ..."

curl http://dendreth.metacraft-labs.com/deneb_284.zkey >"data/light_client.zkey"
curl https://dendrethstorage.blob.core.windows.net/light-client/light-client.zkey >"data/light_client.zkey"

CALCULATED_ZKEY_SUM=$(calculate_checksum data/light_client.zkey)

if [ "${ZKEY_B3SUM_SUM}" = "${CALCULATED_ZKEY_SUM}" ]; then
echo "Zkey file downloaded successfully to data/light_client.zkey"
else
echo "Failed to download zkey file from http://dendreth.metacraft-labs.com/deneb_284.zkey"
echo "Failed to download zkey file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.zkey"
exit 1
fi
}

download_dat_file() {
echo "Downloading .dat file from https://media.githubusercontent.com/media/metacraft-labs/DendrETH-build-artifacts/master/light_client_cpp/light_client.dat ..."
echo "Downloading .dat file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.dat ..."

curl -k https://media.githubusercontent.com/media/metacraft-labs/DendrETH-build-artifacts/master/light_client_cpp/light_client.dat >"data/light_client.dat"
curl -k https://dendrethstorage.blob.core.windows.net/light-client/light-client.dat >"data/light_client.dat"

CALCULATED_DAT_SUM=$(calculate_checksum data/light_client.dat)

if [ "${DAT_B3SUM_SUM}" = "${CALCULATED_DAT_SUM}" ]; then
echo ".dat file downloaded successfully to data/light_client.dat"
else
echo "Failed to download .dat file from https://media.githubusercontent.com/media/metacraft-labs/DendrETH-build-artifacts/master/light_client_cpp/light_client.dat"
echo "Failed to download .dat file from https://dendrethstorage.blob.core.windows.net/light-client/light-client.dat"
exit 1
fi
}

mkdir -p "${GIT_ROOT}/data"

if [ ! -f "data/light_client.zkey" ]; then
download_zkey_file
else
Expand Down

0 comments on commit 8fd9538

Please sign in to comment.