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

Unable to download Lisk Sepolia datadir snapshots #50

Merged
Merged
Show file tree
Hide file tree
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
31 changes: 26 additions & 5 deletions geth/download-apply-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,35 @@ if [[ "${GETH_DATA_DIR-x}" == x ]]; then
exit 1
fi

if [[ "${SNAPSHOT_URL-x}" == x || -z $SNAPSHOT_URL ]]; then
readonly SNAPSHOT_URL_BASE="https://snapshots.lisk.com/$SNAPSHOT_NETWORK"
# Snapshot base URLs
readonly SNAPSHOT_BASE_URL_DEFAULT="https://snapshots.lisk.com"
readonly SNAPSHOT_BASE_URL_ALTERNATE="https://s3.eu-west-3.amazonaws.com/snapshots.lisk.com"

# Automatically resolve SNAPSHOT_URL, if not specified
SNAPSHOT_URL="$SNAPSHOT_URL"
if [[ "${SNAPSHOT_URL-x}" == x || -z $SNAPSHOT_URL ]];
then
readonly SNAPSHOT_URL_BASE="$SNAPSHOT_BASE_URL_DEFAULT/$SNAPSHOT_NETWORK"
readonly LATEST_SNAPSHOT_NAME=$(curl --silent --location $SNAPSHOT_URL_BASE/latest-$SNAPSHOT_TYPE)
readonly SNAPSHOT_URL="$SNAPSHOT_URL_BASE/$LATEST_SNAPSHOT_NAME"

SNAPSHOT_URL="$SNAPSHOT_URL_BASE/$LATEST_SNAPSHOT_NAME"
echo "SNAPSHOT_URL not specified; automatically resolved to $SNAPSHOT_URL"
fi

# Update SNAPSHOT_URL to alternate URL, if it uses the default base URL and it doesn't respond
readonly http_code=$(curl -o /dev/null --silent -Iw '%{http_code}' $SNAPSHOT_URL)
if [[ "$http_code" != "200" ]];
then
echo "Unable to access $SNAPSHOT_URL"
if [[ $SNAPSHOT_URL =~ $SNAPSHOT_BASE_URL_DEFAULT ]];
then
readonly SNAPSHOT_URL=$(echo "${SNAPSHOT_URL/$SNAPSHOT_BASE_URL_DEFAULT/$SNAPSHOT_BASE_URL_ALTERNATE}")
echo "Updating SNAPSHOT_URL to $SNAPSHOT_URL"
else
echo "Try using the official URL instead. Exiting snapshot download & application..."
exit 2
fi
fi

readonly SNAPSHOT_DIR=./snapshot
readonly SNAPSHOT_REMOTE_FILENAME=$(basename ${SNAPSHOT_URL})
readonly SNAPSHOT_SHA256_URL="${SNAPSHOT_URL}.SHA256"
Expand Down Expand Up @@ -102,4 +123,4 @@ if [[ "$SNAPSHOT_IMPORT_EXIT_CODE" == "0" ]]; then
else
echo "Snapshot import failed. Skipping snapshot application..."
exit 12
fi
fi
2 changes: 1 addition & 1 deletion geth/geth-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi
mkdir -p $GETH_DATA_DIR

# Download and apply snapshot, when configured
(. download-apply-snapshot.sh)
(. download-apply-snapshot.sh) || echo "Unable to download and apply snapshot. Skipping snapshot application..."

# Set the start flags
echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH"
Expand Down