diff --git a/scripts/harb-evaluator/red-team.sh b/scripts/harb-evaluator/red-team.sh index ae4a0e0..c2ed250 100755 --- a/scripts/harb-evaluator/red-team.sh +++ b/scripts/harb-evaluator/red-team.sh @@ -176,8 +176,9 @@ compute_lm_total_eth() { output=$(cd "$REPO_ROOT" && LM="$LM" WETH="$WETH" POOL="$POOL" \ "$FORGE" script onchain/script/LmTotalEth.s.sol \ --rpc-url "$RPC_URL" --root onchain 2>&1) - # forge script prints "== Logs ==" then " " — extract the number - result=$(echo "$output" | awk '/^== Logs ==/{getline; gsub(/^[[:space:]]+/,""); print; exit}') + # forge script prints "== Logs ==" then " " — extract the number. + # Scan all lines after the marker so blank lines or warning lines don't corrupt the result. + result=$(echo "$output" | awk '/^== Logs ==/{found=1; next} found && /^[[:space:]]*[0-9]+[[:space:]]*$/{gsub(/[[:space:]]/, ""); print; exit}') [[ -n "$result" && "$result" =~ ^[0-9]+$ ]] || die "Failed to read LM total ETH (forge output: $output)" echo "$result" }