From 500e1390fc8a193de6973d3e42c5214c80a09f0d Mon Sep 17 00:00:00 2001 From: Dusk1e <135010814+Dusk1e@users.noreply.github.com> Date: Sat, 12 Sep 2026 18:23:10 +0300 Subject: [PATCH] fix(scripts): drop ggrep from register-validator.sh The registration id is parsed with `ggrep -oP`. ggrep is Homebrew's GNU grep, which is not in the README's install list and does not exist on Linux, so the command is not found on a machine set up from the docs. It fails quietly instead of stopping: `export VAR=$(...)` reports the status of export rather than of the substitution, so `set -e` does not fire. The script carries on with an empty REGISTRATION_ID through configureController, activateValidator and updateVotingPower, then exits 0. Parse with POSIX sed and stop with a message when no id comes back. --- scripts/register-validator.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/register-validator.sh b/scripts/register-validator.sh index 6c33ab9c..2959ad37 100755 --- a/scripts/register-validator.sh +++ b/scripts/register-validator.sh @@ -49,8 +49,16 @@ cmd='forge script contracts/scripts/ValidatorManagement.s.sol --rpc-url http://l echo "Registering validator with public key: $VALIDATOR_PUBLIC_KEY_BYTES" result=$($cmd --sig "registerValidator()") -# Find registration id from the output -export REGISTRATION_ID=$(echo "$result" | ggrep -oP '_registrationId: uint256 \K[0-9]+' | tail -1) +# Find registration id from the output. ggrep is Homebrew's GNU grep, which is +# not installed by the setup in the README and does not exist on Linux, so +# parse with POSIX sed instead. +REGISTRATION_ID=$(echo "$result" | sed -n 's/.*_registrationId: uint256 \([0-9][0-9]*\).*/\1/p' | tail -1) +if [ -z "$REGISTRATION_ID" ]; then + echo "Failed to read a registration id from the registerValidator() output:" >&2 + echo "$result" >&2 + exit 1 +fi +export REGISTRATION_ID echo "Registered validator with registration id: $REGISTRATION_ID"