Skip to content
Open
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
18 changes: 11 additions & 7 deletions progress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,24 @@ echo "Getting final block number..."
T1=$(cast block-number --rpc-url "$ETH_RPC_URL" 2>/dev/null) || error_exit "Failed to get final block number"
echo "Final block: $T1"

# Get L2 head block with error handling
HEAD=$(cast block-number --rpc-url "$L2_URL" 2>/dev/null) || error_exit "Failed to get L2 block number"
BEHIND=$((HEAD - T1))

if [ "$BEHIND" -le 0 ]; then
echo "Local node is fully synced with L2 (current block: $T1, remote head: $HEAD)."
exit 0
fi

# Calculate blocks per minute
PER_MIN=$(($T1 - $T0))
PER_MIN=$(($PER_MIN * 6))
echo "Blocks per minute: $PER_MIN"

[ $PER_MIN -eq 0 ] && error_exit "Not syncing"

# Get L2 head block with error handling
HEAD=$(cast block-number --rpc-url "$L2_URL" 2>/dev/null) || error_exit "Failed to get L2 block number"
BEHIND=$((HEAD - T1))
[ $BEHIND -lt 0 ] && error_exit "L2 is ahead of local node"
[ "$PER_MIN" -le 0 ] && error_exit "Not syncing (0 blocks synced in 10s, $BEHIND blocks behind)"

# Calculate time estimates
echo "Calculating time estimates..."
echo "Calculating time estimates ($BEHIND blocks behind)..."
MINUTES=$((BEHIND / PER_MIN))
HOURS=$((MINUTES / 60))

Expand Down
8 changes: 6 additions & 2 deletions scripts/init-bedrock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,13 @@ if [ -n "$BEDROCK_TAR_DOWNLOAD" ]; then
rm "$BEDROCK_TAR_CHECKSUM_PATH"
fi

echo "Creating JWT..."
mkdir -p "$(dirname "$BEDROCK_JWT_PATH")"
openssl rand -hex 32 > "$BEDROCK_JWT_PATH"
if [ -s "$BEDROCK_JWT_PATH" ]; then
echo "JWT secret already exists at $BEDROCK_JWT_PATH, keeping existing file."
else
echo "Creating JWT..."
openssl rand -hex 32 > "$BEDROCK_JWT_PATH"
fi

echo "Creating Bedrock flag..."
touch "$INITIALIZED_FLAG"