Skip to content

Unbound _VC crash#184

Open
b0a7 wants to merge 19 commits intocoincashew:mainfrom
b0a7:unbound_VC
Open

Unbound _VC crash#184
b0a7 wants to merge 19 commits intocoincashew:mainfrom
b0a7:unbound_VC

Conversation

@b0a7
Copy link

@b0a7 b0a7 commented Nov 24, 2025

In "Failover Staking Node" mode there is no validator client. In this mode, when you try to view the software versions you get the following crash:
/usr/local/bin/ethpillar: line 680: _VC: unbound variable
This PR fixes this by adding a missing check that _VC is set, and if not setting the value to 'Validator client: Not Installed'
ethpillar_fallback_sw_versions_fixed_Screenshot 2025-11-24 133528

Summary by CodeRabbit

  • Bug Fixes

    • Better handling and default messages when validator/execution/consensus components or MEV-Boost are missing or still starting.
    • More robust version detection and safer empty-variable checks.
  • Chores

    • Improved update/download flow with clearer errors and safer archive handling.
  • Documentation

    • Added instructions for switching to this fork and updating from it.

b0a7 added 3 commits November 24, 2025 13:55
Refactor client version checks to use conditional assignments for better error handling.
properly handles unset variables
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

📝 Walkthrough

Walkthrough

Bumps EthPillar version and hardens status reporting; adds README section about switching to the fork; improves Nethermind asset selection/download flow; and tightens MEV-Boost version parsing and tag selection logic. Changes touch scripts and docs to make version/asset detection and messaging more robust.

Changes

Cohort / File(s) Summary
Core status and version display
ethpillar.sh
Bumped EP_VERSION to 5.2.7; added defensive initialization for _VC, _CL, _EL using parameter-expansion-safe checks and default status messages; improved MEV-Boost version extraction and final message assembly.
Updater: Nethermind asset flow
scripts/.../update_execution.sh
Switched asset selection to platform/arch suffix matching, added lowercase platform variant, added BINARIES_URL-empty fallback with asset listing, replaced download/cleanup with wget/unzip/rm -f, and adjusted service start sequence.
MEV-Boost updater
scripts/.../update_mevboost.sh
Made installed-version parsing more permissive (optional leading v, optional patch), added parsing fallbacks, changed tag sorting to version-aware reverse sort (-Vr), and simplified latest-tag retrieval.
Documentation
README.md
Added "Switching to this fork for updates!" section with one-time git-remote steps, update instructions via UI, and fork version note (5.2.7).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 I hopped through scripts with a twitchy nose,
Tightened the checks where the empty string grows,
Bumped the version, tidied the flow,
Downloaded with wget through sun and snow,
I nibble bugs, then cheer — off I go! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main issue fixed in this PR: handling the unbound _VC variable crash when validator client is not installed in Failover Staking Node mode.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@update_mevboost.sh`:
- Around line 20-33: The getCurrentVersion function wrongly treats stderr output
as evidence the binary exists because INSTALLED captures stderr via `2>&1`,
making the `-n $INSTALLED` branch always true; fix by first checking binary
existence or mev-boost exit status before using its output—e.g., use `command -v
mev-boost` or run mev-boost and test `$?` to decide whether to set
VERSION="Client not installed." and only then capture and parse output into
VERSION with the existing sed fallback logic; update references in
getCurrentVersion (INSTALLED, VERSION) accordingly.
🧹 Nitpick comments (2)
README.md (1)

18-38: Hardcoded version string will go stale.

Line 36 hardcodes "5.2.7" — this will need manual updates with every future release. Consider referencing the version dynamically (e.g., linking to the releases page) or adding a note to update this line on each bump.

Also, the install one-liner (line 61) and manual clone (line 123) still point at coincashew/EthPillar. This is presumably intentional (install from upstream, then switch remote), but it may confuse readers of this fork's README. A brief clarification note near those commands would help.

update_mevboost.sh (1)

88-88: Minor: sed 's/^v//' strips the leading v here, but ${TAG#v} is applied again on lines 55, 64, 67.

Not a bug — stripping an already-stripped prefix is a no-op — but it's slightly confusing. Consider either keeping the v in TAG and relying on ${TAG#v} everywhere, or stripping it once here and removing the ${TAG#v} expansions downstream.

Comment on lines 20 to +33
function getCurrentVersion(){
INSTALLED=$(mev-boost --version 2>&1)
#Find version in format #.#.#
if [[ $INSTALLED ]] ; then
INSTALLED=$(mev-boost --version 2>&1) # capture stderr too, just in case
if [[ -n $INSTALLED ]] ; then
# shellcheck disable=SC2001
VERSION=$(echo "$INSTALLED" | sed 's/.*\s\([0-9]*\.[0-9]*\).*/\1/')
else
VERSION="Client not installed."
fi
# Extract major.minor or major.minor.patch, optional leading 'v', ignore suffix/commit info
# Patch part is optional to handle versions like 1.11 (no patch)
VERSION=$(echo "$INSTALLED" | sed 's/.*v\?\([0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*/\1/')
# Fallback if sed fails or no match
if [[ -z $VERSION || $VERSION == "$INSTALLED" ]]; then
VERSION="unknown"
fi
else
VERSION="Client not installed."
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

"Client not installed." branch is unreachable due to stderr capture.

On line 21, 2>&1 redirects stderr into $INSTALLED. When mev-boost is not found on the system, bash emits a "command not found" message to stderr, so $INSTALLED will be non-empty. This means line 22's -n test always succeeds, the else branch (line 31–32) is never reached, and a missing binary reports "unknown" instead of "Client not installed."

Proposed fix: check the exit code or binary existence first
 function getCurrentVersion(){
-    INSTALLED=$(mev-boost --version 2>&1)  # capture stderr too, just in case
-    if [[ -n $INSTALLED ]] ; then
+    if ! command -v mev-boost &>/dev/null; then
+        VERSION="Client not installed."
+        return
+    fi
+    INSTALLED=$(mev-boost --version 2>&1)
+    if [[ -n $INSTALLED ]] ; then
         # shellcheck disable=SC2001
 		# Extract major.minor or major.minor.patch, optional leading 'v', ignore suffix/commit info
 		# Patch part is optional to handle versions like 1.11 (no patch)
 		VERSION=$(echo "$INSTALLED" | sed 's/.*v\?\([0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*/\1/')
         # Fallback if sed fails or no match
         if [[ -z $VERSION || $VERSION == "$INSTALLED" ]]; then
             VERSION="unknown"
         fi
     else
         VERSION="Client not installed."
     fi
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function getCurrentVersion(){
INSTALLED=$(mev-boost --version 2>&1)
#Find version in format #.#.#
if [[ $INSTALLED ]] ; then
INSTALLED=$(mev-boost --version 2>&1) # capture stderr too, just in case
if [[ -n $INSTALLED ]] ; then
# shellcheck disable=SC2001
VERSION=$(echo "$INSTALLED" | sed 's/.*\s\([0-9]*\.[0-9]*\).*/\1/')
else
VERSION="Client not installed."
fi
# Extract major.minor or major.minor.patch, optional leading 'v', ignore suffix/commit info
# Patch part is optional to handle versions like 1.11 (no patch)
VERSION=$(echo "$INSTALLED" | sed 's/.*v\?\([0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*/\1/')
# Fallback if sed fails or no match
if [[ -z $VERSION || $VERSION == "$INSTALLED" ]]; then
VERSION="unknown"
fi
else
VERSION="Client not installed."
fi
function getCurrentVersion(){
if ! command -v mev-boost &>/dev/null; then
VERSION="Client not installed."
return
fi
INSTALLED=$(mev-boost --version 2>&1)
if [[ -n $INSTALLED ]] ; then
# shellcheck disable=SC2001
# Extract major.minor or major.minor.patch, optional leading 'v', ignore suffix/commit info
# Patch part is optional to handle versions like 1.11 (no patch)
VERSION=$(echo "$INSTALLED" | sed 's/.*v\?\([0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*/\1/')
# Fallback if sed fails or no match
if [[ -z $VERSION || $VERSION == "$INSTALLED" ]]; then
VERSION="unknown"
fi
else
VERSION="Client not installed."
fi
}
🤖 Prompt for AI Agents
In `@update_mevboost.sh` around lines 20 - 33, The getCurrentVersion function
wrongly treats stderr output as evidence the binary exists because INSTALLED
captures stderr via `2>&1`, making the `-n $INSTALLED` branch always true; fix
by first checking binary existence or mev-boost exit status before using its
output—e.g., use `command -v mev-boost` or run mev-boost and test `$?` to decide
whether to set VERSION="Client not installed." and only then capture and parse
output into VERSION with the existing sed fallback logic; update references in
getCurrentVersion (INSTALLED, VERSION) accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants