From 22901479ba05441772e3fec2984d77869254387a Mon Sep 17 00:00:00 2001 From: 3alpha <15694175+3alpha@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:09:04 +0100 Subject: [PATCH] fix(beacon-chain): exit on a failed checkpoint sync trustedNodeSync exits non-zero on failure, but its exit code was ignored, so a failed checkpoint sync silently fell back to syncing from genesis. On failure, remove the partial database and exit so the container restarts and retries; otherwise the next start would find the database and skip checkpoint sync. --- beacon-chain/entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/beacon-chain/entrypoint.sh b/beacon-chain/entrypoint.sh index 8fbd3ac..0864de6 100755 --- a/beacon-chain/entrypoint.sh +++ b/beacon-chain/entrypoint.sh @@ -32,11 +32,17 @@ if [ -n "$(ls -A "${DATA_DIR}/db" 2>/dev/null)" ]; then elif [ -n "${CHECKPOINT_SYNC_URL}" ]; then echo "[INFO - entrypoint] Running checkpoint sync script" - ${NIMBUS_BIN} trustedNodeSync \ + if ! ${NIMBUS_BIN} trustedNodeSync \ --network="${NETWORK}" \ --trusted-node-url="${CHECKPOINT_SYNC_URL}" \ --backfill=false \ - --data-dir="${DATA_DIR}" + --data-dir="${DATA_DIR}"; then + # Remove the partial database so the next start retries checkpoint sync + # instead of skipping it and syncing from genesis. + echo "[ERROR - entrypoint] Checkpoint sync from ${CHECKPOINT_SYNC_URL} failed. Exiting so the container restarts and retries. To sync from genesis instead, clear the checkpoint sync URL." + rm -rf "${DATA_DIR}/db" + exit 1 + fi else echo "[WARN - entrypoint] No checkpoint sync script provided. Syncing from genesis."