From f46cd3525b0c709e370220d6e177178db1bf0891 Mon Sep 17 00:00:00 2001 From: bigrosss Date: Sun, 28 Dec 2025 21:34:11 +0100 Subject: [PATCH] feat(scripts): add RPC connectivity check Adds a script that tests connectivity to configured L1 and OP node RPC endpoints by calling eth_blockNumber and reporting reachability. --- bin/check_rpc_connectivity.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 bin/check_rpc_connectivity.sh diff --git a/bin/check_rpc_connectivity.sh b/bin/check_rpc_connectivity.sh new file mode 100644 index 00000000..93164d2d --- /dev/null +++ b/bin/check_rpc_connectivity.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Check connectivity to L1 and OP node JSON-RPC endpoints. +# Usage: BASE_L1_RPC_URL=http://localhost:8545 BASE_OP_RPC_URL=http://localhost:9000 ./bin/check_rpc_connectivity.sh + +L1_URL="${BASE_L1_RPC_URL:-http://localhost:8545}" +OP_URL="${BASE_OP_RPC_URL:-http://localhost:9000}" + +check_rpc() { + local url="$1" + local name="$2" + echo "Checking $name RPC at $url ..." + if curl -s -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' "$url" >/dev/null; then + echo " $name RPC is reachable." + else + echo " Failed to reach $name RPC." + fi +} + +check_rpc "$L1_URL" "L1" +check_rpc "$OP_URL" "OP node"