From 0ced6564fbcd3620e286c4592732660174d44129 Mon Sep 17 00:00:00 2001 From: szczerbp <01159503@pw.edu.pl> Date: Wed, 9 Apr 2025 16:05:01 +0200 Subject: [PATCH 1/4] Add hoodi support --- distros/raspberry_pi/nimbus/nimbus.sh | 47 ++++++++++++++----- .../scripts/servers_list_hoodi.txt | 4 ++ 2 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 distros/raspberry_pi/scripts/servers_list_hoodi.txt diff --git a/distros/raspberry_pi/nimbus/nimbus.sh b/distros/raspberry_pi/nimbus/nimbus.sh index 00cd3f1..7bf1cac 100644 --- a/distros/raspberry_pi/nimbus/nimbus.sh +++ b/distros/raspberry_pi/nimbus/nimbus.sh @@ -44,9 +44,9 @@ get_install_stage() { set_status() { local status="$1" # Assign the first argument to a local variable echo "STAGE $(get_install_stage): $status" > /opt/web3pi/status.txt # Write the string to the file - echolog " " - echolog "STAGE $(get_install_stage): $status" - echolog " " + echolog " " + echolog "STAGE $(get_install_stage): $status" + echolog " " } # Function to calculate average ping time @@ -110,17 +110,17 @@ while read -r server; do echolog "Attempting to sync with server: $server" avg_ping=$(calculate_average_ping "$server") echolog "Average ping = $avg_ping ms" - + # Run the Nimbus beacon node command and display output in real time output=$(nimbus_beacon_node trustedNodeSync --network=${eth_network} --data-dir="$nimbus_dir" --trusted-node-url="$server" --backfill=false 2>&1) # output=$(nimbus_beacon_node trustedNodeSync --network=mainnet --data-dir="$nimbus_dir" --trusted-node-url="$server" --backfill=false 2>&1 | tee /dev/tty) - - # Searching for a line containing 'horizon' and extracting the value. - horizon_value=$(echo "$output" | grep -oP 'horizon=\K\d+') - echolog "horizon=$horizon_value " - + + # Check if output contains line indicating success + echo "$output" | grep -q "Done, your beacon node is ready to serve you!" + finished=$? + # Check the output for success messages - if [ "$horizon_value" -gt 0 ]; then + if [ "$finished" -eq 0 ]; then echolog "Sync successful with server: $server " success=true break @@ -132,13 +132,36 @@ while read -r server; do fi done < "$SERVERS_FILE" +# If trustedNodeSync failed with all, try downloading finalized state via curl from each server +if [ "$success" = false ]; then + echolog "All trustedNodeSync attempts failed. Trying to download finalized state from servers..." + + while read -r server; do + if [[ -n "$server" ]]; then + url="${server%/}/eth/v2/debug/beacon/states/finalized" + echolog "Attempting to download finalized state from: $url" + + mkdir -p "$nimbus_dir" + curl -sSf -o "$nimbus_dir/state.finalized.ssz" -H 'Accept: application/octet-stream' "$url" + if [ $? -eq 0 ]; then + echolog "Successfully downloaded finalized state from $server" + success=true + state_finalized=true + break + else + echolog "Failed to download from $server, trying next..." + rm -f "$nimbus_dir/state.finalized.ssz" + fi + fi + done < "$SERVERS_FILE" +fi # If the trustedNodeSync was successful if [ "$success" = true ]; then echolog "Run Nimbus beacon node" - nimbus_beacon_node --non-interactive --tcp-port=${nimbus_port} --udp-port=${nimbus_port} --el=${exec_url} --network=${eth_network} --data-dir=${nimbus_dir} --jwt-secret=/home/ethereum/clients/secrets/jwt.hex --rest=true --rest-port=5052 --rest-address=0.0.0.0 --rest-allow-origin='*' --enr-auto-update + nimbus_beacon_node --non-interactive --tcp-port=${nimbus_port} --udp-port=${nimbus_port} --el=${exec_url} --network=${eth_network} --data-dir=${nimbus_dir} --jwt-secret=/home/ethereum/clients/secrets/jwt.hex --rest=true --rest-port=5052 --rest-address=0.0.0.0 --rest-allow-origin='*' --enr-auto-update ${state_finalized:+--finalized-checkpoint-state="$nimbus_dir/state.finalized.ssz"} else # If no server was successful - echolog "All servers failed to complete the trustedNodeSync." + echolog "All sync attempts failed. Nimbus will not be started." exit 1 fi diff --git a/distros/raspberry_pi/scripts/servers_list_hoodi.txt b/distros/raspberry_pi/scripts/servers_list_hoodi.txt new file mode 100644 index 0000000..91d196e --- /dev/null +++ b/distros/raspberry_pi/scripts/servers_list_hoodi.txt @@ -0,0 +1,4 @@ +https://checkpoint-sync.hoodi.ethpandaops.io/ +https://hoodi.beaconstate.info +https://hoodi-checkpoint-sync.attestant.io +https://beaconstate-hoodi.chainsafe.io \ No newline at end of file From 9f15bc39fd4e2f1c29749fc93b4b2c529a5ca73c Mon Sep 17 00:00:00 2001 From: szczerbp <01159503@pw.edu.pl> Date: Wed, 9 Apr 2025 16:45:17 +0200 Subject: [PATCH 2/4] Add branch name --- distros/raspberry_pi/rc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/raspberry_pi/rc.local b/distros/raspberry_pi/rc.local index 22a0d8a..9f02755 100644 --- a/distros/raspberry_pi/rc.local +++ b/distros/raspberry_pi/rc.local @@ -3,7 +3,7 @@ # Web3 Pi - rc.local # -BRANCH="main" +BRANCH="hoodi" # Function: echolog # Description: Logs messages with a timestamp prefix. If no arguments are provided, From d4b21da0637bdbc956a3e72c06704156f87ff4f3 Mon Sep 17 00:00:00 2001 From: szczerbp <01159503@pw.edu.pl> Date: Wed, 9 Apr 2025 16:48:28 +0200 Subject: [PATCH 3/4] Add hoodi support --- distros/raspberry_pi/config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/raspberry_pi/config.txt b/distros/raspberry_pi/config.txt index be7c93f..686e689 100644 --- a/distros/raspberry_pi/config.txt +++ b/distros/raspberry_pi/config.txt @@ -15,7 +15,7 @@ bnm=true # Execution endpoint address exec_url=http://localhost:8551 -# Ethereum network: mainnet/holesky/sepolia +# Ethereum network: mainnet/holesky/sepolia/hoodi eth_network=mainnet [geth] From 6090712284b0aa979e9c971474cb6b072f2089f5 Mon Sep 17 00:00:00 2001 From: szczerbp <01159503@pw.edu.pl> Date: Wed, 9 Apr 2025 18:38:14 +0200 Subject: [PATCH 4/4] Correct address --- distros/raspberry_pi/scripts/servers_list_hoodi.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/raspberry_pi/scripts/servers_list_hoodi.txt b/distros/raspberry_pi/scripts/servers_list_hoodi.txt index 91d196e..910d1c0 100644 --- a/distros/raspberry_pi/scripts/servers_list_hoodi.txt +++ b/distros/raspberry_pi/scripts/servers_list_hoodi.txt @@ -1,4 +1,4 @@ -https://checkpoint-sync.hoodi.ethpandaops.io/ +https://checkpoint-sync.hoodi.ethpandaops.io https://hoodi.beaconstate.info https://hoodi-checkpoint-sync.attestant.io https://beaconstate-hoodi.chainsafe.io \ No newline at end of file