Files
proxmox/scripts/archive/consolidated/verify/check-validator-prerequisites.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- 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>
2026-02-12 15:46:57 -08:00

104 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Pre-startup Validator Prerequisites Check
# Validates all required files and configurations before starting Besu
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
check_file() {
local file=$1
local description=$2
if [ -f "$file" ]; then
log_info "$description: OK ($file)"
return 0
else
log_error "$description: MISSING ($file)"
return 1
fi
}
fix_missing_file() {
local file=$1
local description=$2
local fallback=$3
if [ ! -f "$file" ]; then
log_warn "Fixing missing $description..."
if [ -f "$fallback" ]; then
mkdir -p "$(dirname "$file")"
ln -sf "$fallback" "$file"
log_info "Created symlink: $file -> $fallback"
else
log_error "Cannot fix: $description missing and no fallback"
return 1
fi
fi
}
main() {
local errors=0
# Check genesis file
if ! check_file "/genesis/genesis.json" "Genesis file"; then
fix_missing_file "/genesis/genesis.json" "genesis file" "/etc/besu/genesis.json" || ((errors++))
fi
# Check static-nodes file
if ! check_file "/genesis/static-nodes.json" "Static nodes file"; then
fix_missing_file "/genesis/static-nodes.json" "static-nodes file" "/etc/besu/static-nodes.json" || {
# Create empty file if no fallback
mkdir -p /genesis
echo "[]" > /genesis/static-nodes.json
log_info "Created empty static-nodes.json"
}
fi
# Check permissions file
if ! check_file "/permissions/permissions-accounts.toml" "Permissions file"; then
fix_missing_file "/permissions/permissions-accounts.toml" "permissions file" "/etc/besu/permissions-accounts.toml" || {
# Create proper empty file
mkdir -p /permissions
cat > /permissions/permissions-accounts.toml <<EOF
# Permissions Accounts Configuration
# Empty allowlist - all accounts allowed
accounts-allowlist=[]
EOF
log_info "Created empty permissions-accounts.toml"
}
fi
# Validate TOML format
if [ -f "/permissions/permissions-accounts.toml" ]; then
if ! grep -q "accounts-allowlist" /permissions/permissions-accounts.toml; then
log_warn "Fixing invalid permissions file format..."
cat > /permissions/permissions-accounts.toml <<EOF
# Permissions Accounts Configuration
# Empty allowlist - all accounts allowed
accounts-allowlist=[]
EOF
log_info "Fixed permissions file format"
fi
fi
if [ "$errors" -gt 0 ]; then
log_error "Prerequisites check failed with $errors error(s)"
exit 1
fi
log_info "All prerequisites satisfied"
exit 0
}
main "$@"