From f1ad1c32909ac381169e24f4e7fe9213674421b9 Mon Sep 17 00:00:00 2001 From: Sovereign Agent Date: Fri, 13 Mar 2026 07:11:25 +0300 Subject: [PATCH 1/2] fix: use unset-safe expansions in entrypoint validation checks Fixes #988 The entrypoint scripts use `set -u` which causes bash to exit when an unset variable is expanded. However, the validation logic uses `-z "$VAR"` which expands the variable before checking if it's empty. This means if OP_NODE_NETWORK is unset and OP_NODE_ROLLUP_CONFIG is set, the script crashes on unbound OP_NODE_NETWORK expansion instead of evaluating the condition correctly. Changes: - op-node-entrypoint: Use `${OP_NODE_NETWORK:-}` and `${OP_NODE_ROLLUP_CONFIG:-}` - nethermind-entrypoint: Use `${OP_NODE_NETWORK:-}` and `${OP_NODE_L2_ENGINE_AUTH_RAW:-}` This allows the validation logic to work correctly while keeping `set -u` for safety. --- nethermind/nethermind-entrypoint | 4 ++-- op-node-entrypoint | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nethermind/nethermind-entrypoint b/nethermind/nethermind-entrypoint index d818d92fc..20b5f776d 100755 --- a/nethermind/nethermind-entrypoint +++ b/nethermind/nethermind-entrypoint @@ -14,7 +14,7 @@ P2P_PORT="${P2P_PORT:-30303}" ADDITIONAL_ARGS="" # Check if required variables are set -if [[ -z "$OP_NODE_NETWORK" ]]; then +if [[ -z "${OP_NODE_NETWORK:-}" ]]; then echo "Expected OP_NODE_NETWORK to be set" 1>&2 exit 1 fi @@ -23,7 +23,7 @@ fi mkdir -p "$NETHERMIND_DATA_DIR" # Write the JWT secret -if [[ -z "$OP_NODE_L2_ENGINE_AUTH_RAW" ]]; then +if [[ -z "${OP_NODE_L2_ENGINE_AUTH_RAW:-}" ]]; then echo "Expected OP_NODE_L2_ENGINE_AUTH_RAW to be set" 1>&2 exit 1 fi diff --git a/op-node-entrypoint b/op-node-entrypoint index 525372e90..bf96a4cb9 100755 --- a/op-node-entrypoint +++ b/op-node-entrypoint @@ -22,7 +22,7 @@ get_public_ip() { return 1 } -if [[ -z "$OP_NODE_NETWORK" && -z "$OP_NODE_ROLLUP_CONFIG" ]]; then +if [[ -z "${OP_NODE_NETWORK:-}" && -z "${OP_NODE_ROLLUP_CONFIG:-}" ]]; then echo "expected OP_NODE_NETWORK to be set" 1>&2 exit 1 fi From f04299f1f38ea24dde42c8fb235828276677bfa8 Mon Sep 17 00:00:00 2001 From: Sovereign Agent Date: Fri, 13 Mar 2026 07:12:47 +0300 Subject: [PATCH 2/2] fix: use parameter expansion for env validation with set -u When using `set -u` (nounset), referencing unset variables causes an unbound variable error before the script can check if they're set. This change uses `${VAR:-}` parameter expansion to safely handle unset variables in validation checks, allowing proper error messages instead of shell errors. Fixes #988 --- geth/geth-entrypoint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geth/geth-entrypoint b/geth/geth-entrypoint index 7180e8337..7d9055449 100755 --- a/geth/geth-entrypoint +++ b/geth/geth-entrypoint @@ -21,7 +21,7 @@ GETH_CACHE_GC="${GETH_CACHE_GC:-12}" GETH_CACHE_SNAPSHOT="${GETH_CACHE_SNAPSHOT:-24}" GETH_CACHE_TRIE="${GETH_CACHE_TRIE:-44}" -if [[ -z "$OP_NODE_NETWORK" ]]; then +if [[ -z "${OP_NODE_NETWORK:-}" ]]; then echo "expected OP_NODE_NETWORK to be set" 1>&2 exit 1 fi