Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
114 lines
3.7 KiB
Bash
Executable File
114 lines
3.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Validate All Validator Configurations
|
|
# Ensures all validators have consistent, valid configurations
|
|
|
|
set -euo pipefail
|
|
|
|
# Load IP configuration
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
VALIDATOR_VMIDS=(1000 1001 1002 1003 1004)
|
|
PROXMOX_HOSTS=("${PROXMOX_HOST_R630_01:-192.168.11.11}" "${PROXMOX_HOST_R630_01:-192.168.11.11}" "${PROXMOX_HOST_R630_01:-192.168.11.11}" "${PROXMOX_HOST_ML110:-192.168.11.10}" "${PROXMOX_HOST_ML110:-192.168.11.10}")
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
|
|
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[✗]${NC} $1"; }
|
|
|
|
validate_validator_config() {
|
|
local vmid=$1
|
|
local host=$2
|
|
|
|
log_info "Validating Validator-$vmid configuration..."
|
|
local issues=0
|
|
|
|
# Check required files exist
|
|
local files=(
|
|
"/genesis/genesis.json:/etc/besu/genesis.json"
|
|
"/genesis/static-nodes.json:/etc/besu/static-nodes.json"
|
|
"/permissions/permissions-accounts.toml:/etc/besu/permissions-accounts.toml"
|
|
)
|
|
|
|
for file_pair in "${files[@]}"; do
|
|
local expected="${file_pair%%:*}"
|
|
local fallback="${file_pair##*:}"
|
|
|
|
if ! ssh root@$host "pct exec $vmid -- test -f $expected 2>&1" >/dev/null 2>&1; then
|
|
if ! ssh root@$host "pct exec $vmid -- test -f $fallback 2>&1" >/dev/null 2>&1; then
|
|
log_error "Validator-$vmid: Missing $expected and $fallback"
|
|
((issues++))
|
|
else
|
|
log_warn "Validator-$vmid: $expected missing, but $fallback exists"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# Validate TOML format
|
|
local toml_content=$(ssh root@$host "pct exec $vmid -- cat /permissions/permissions-accounts.toml 2>&1" || echo "")
|
|
if [ -n "$toml_content" ] && ! echo "$toml_content" | grep -q "accounts-allowlist"; then
|
|
log_error "Validator-$vmid: Invalid permissions file format"
|
|
((issues++))
|
|
fi
|
|
|
|
# Check node permissioning setting
|
|
local config_file=""
|
|
if ssh root@$host "pct exec $vmid -- test -f /etc/besu/config-validator.toml 2>&1" >/dev/null 2>&1; then
|
|
config_file="/etc/besu/config-validator.toml"
|
|
elif ssh root@$host "pct exec $vmid -- test -f /config/config-validator.toml 2>&1" >/dev/null 2>&1; then
|
|
config_file="/config/config-validator.toml"
|
|
fi
|
|
|
|
if [ -n "$config_file" ]; then
|
|
local node_perm=$(ssh root@$host "pct exec $vmid -- grep 'permissions-nodes-config-file-enabled' $config_file 2>&1" | grep -c "true" || echo "0")
|
|
if [ "$node_perm" -gt 0 ]; then
|
|
log_warn "Validator-$vmid: Node permissioning enabled (may cause issues)"
|
|
fi
|
|
fi
|
|
|
|
if [ "$issues" -eq 0 ]; then
|
|
log_success "Validator-$vmid: Configuration valid"
|
|
return 0
|
|
else
|
|
log_error "Validator-$vmid: Found $issues issue(s)"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
log_info "Validating all validator configurations..."
|
|
echo ""
|
|
|
|
local total_issues=0
|
|
|
|
for i in "${!VALIDATOR_VMIDS[@]}"; do
|
|
local vmid=${VALIDATOR_VMIDS[$i]}
|
|
local host=${PROXMOX_HOSTS[$i]}
|
|
|
|
if ! validate_validator_config "$vmid" "$host"; then
|
|
((total_issues++))
|
|
fi
|
|
echo ""
|
|
done
|
|
|
|
if [ "$total_issues" -eq 0 ]; then
|
|
log_success "All validator configurations are valid"
|
|
exit 0
|
|
else
|
|
log_error "Found issues in $total_issues validator(s)"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
main "$@"
|