diff --git a/erigon.yml b/erigon.yml index 4e3ae7ce..4b8cea1f 100644 --- a/erigon.yml +++ b/erigon.yml @@ -27,7 +27,6 @@ services: - ARCHIVE_NODE=${ARCHIVE_NODE:-} - NETWORK=${NETWORK} - IPV6=${IPV6:-false} - - DOCKER_TAG=${ERIGON_DOCKER_TAG:-latest} - COMPOSE_FILE=${COMPOSE_FILE} - CL_P2P_PORT=${CL_P2P_PORT:-9000} - CL_REST_PORT=${CL_REST_PORT:-5052} diff --git a/erigon/docker-entrypoint.sh b/erigon/docker-entrypoint.sh index 535b3acd..7325f958 100755 --- a/erigon/docker-entrypoint.sh +++ b/erigon/docker-entrypoint.sh @@ -54,73 +54,37 @@ else __network="--chain ${NETWORK} --http.api web3,eth,net,engine" fi +if [ "${ARCHIVE_NODE}" = "true" ]; then + echo "Erigon archive node without pruning" + __prune="--prune.mode=archive" +else + echo "Erigon full node with pruning" + __prune="--prune.mode=full" +fi + __caplin="" -__db_params="" -# Literal match intended -# shellcheck disable=SC2076 -if [[ "${DOCKER_TAG}" =~ "2." || "${DOCKER_TAG}" = "latest" ]]; then -# Check for network, and set prune accordingly - if [ "${ARCHIVE_NODE}" = "true" ]; then - echo "Erigon archive node without pruning" - __prune="" - else - if [[ "${NETWORK}" = "mainnet" ]]; then - echo "mainnet: Running with prune.r.before=11052984 for eth deposit contract" - __prune="--prune=htc --prune.r.before=11052984" - elif [[ "${NETWORK}" = "goerli" ]]; then - echo "goerli: Running with prune.r.before=4367322 for eth deposit contract" - __prune="--prune=htc --prune.r.before=4367322" - elif [[ "${NETWORK}" = "sepolia" ]]; then - echo "sepolia: Running with prune.r.before=1273020 for eth deposit contract" - __prune="--prune=htc --prune.r.before=1273020" - elif [[ "${NETWORK}" = "gnosis" ]]; then - echo "gnosis: Running with prune.r.before=19469077 for gno deposit contract" - __prune="--prune=htc --prune.r.before=19469077" - elif [[ "${NETWORK}" = "holesky" ]]; then - echo "holesky: Running without prune.r for eth deposit contract" - __prune="--prune=htc" - elif [[ "${NETWORK}" =~ ^https?:// ]]; then - echo "Custom testnet: Running without prune.r for eth deposit contract" - __prune="--prune=htc" - else - echo "Unable to determine eth deposit contract, running without prune.r" - __prune="--prune=htc" - fi +if [[ "${COMPOSE_FILE}" =~ (prysm\.yml|prysm-cl-only\.yml|lighthouse\.yml|lighthouse-cl-only\.yml|lodestar\.yml| \ + lodestar-cl-only\.yml|nimbus\.yml|nimbus-cl-only\.yml|nimbus-allin1\.yml|teku\.yml|teku-cl-only\.yml| \ + teku-allin1\.yml|grandine\.yml|grandine-cl-only\.yml|grandine-allin1\.yml) ]]; then + __caplin="--externalcl=true" +else + echo "Running Erigon with internal Caplin consensus layer client" + __caplin="--caplin.discovery.addr=0.0.0.0 --caplin.discovery.port=${CL_P2P_PORT} --caplin.backfilling.blob=true" + __caplin+=" --caplin.discovery.tcpport=${CL_P2P_PORT} --caplin.backfilling=true --caplin.validator-monitor=true" + __caplin+=" --beacon.api=beacon,builder,config,debug,events,node,validator,lighthouse" + __caplin+=" --beacon.api.addr=0.0.0.0 --beacon.api.port=${CL_REST_PORT} --beacon.api.cors.allow-origins=*" + if [ "${MEV_BOOST}" = "true" ]; then + __caplin+=" --caplin.mev-relay-url=${MEV_NODE}" fi - __db_params="--db.pagesize 16K --db.size.limit 8TB" -else # Erigon v3 if [ "${ARCHIVE_NODE}" = "true" ]; then - echo "Erigon archive node without pruning" - __prune="--prune.mode=archive" - else - echo "Erigon full node with pruning" - __prune="--prune.mode=full" + __caplin+=" --caplin.archive=true" fi - if [[ "${COMPOSE_FILE}" =~ (prysm\.yml|prysm-cl-only\.yml|lighthouse\.yml|lighthouse-cl-only\.yml|lodestar\.yml| \ - lodestar-cl-only\.yml|nimbus\.yml|nimbus-cl-only\.yml|nimbus-allin1\.yml|teku\.yml|teku-cl-only\.yml| \ - teku-allin1\.yml|grandine\.yml|grandine-cl-only\.yml|grandine-allin1\.yml) ]]; then - __caplin="--externalcl=true" + if [ -n "${RAPID_SYNC_URL}" ]; then + __caplin+=" --caplin.checkpoint-sync-url=${RAPID_SYNC_URL}" else - echo "Running Erigon with internal Caplin consensus layer client" - __caplin="--caplin.discovery.addr=0.0.0.0 --caplin.discovery.port=${CL_P2P_PORT} --caplin.backfilling.blob=true" - __caplin+=" --caplin.discovery.tcpport=${CL_P2P_PORT} --caplin.backfilling=true --caplin.validator-monitor=true" - __caplin+=" --beacon.api=beacon,builder,config,debug,events,node,validator,lighthouse" - __caplin+=" --beacon.api.addr=0.0.0.0 --beacon.api.port=${CL_REST_PORT} --beacon.api.cors.allow-origins=*" - if [ "${MEV_BOOST}" = "true" ]; then - __caplin+=" --caplin.mev-relay-url=${MEV_NODE}" - echo "MEV Boost enabled" - fi - if [ "${ARCHIVE_NODE}" = "true" ]; then - __caplin+=" --caplin.archive=true" - fi - if [ -n "${RAPID_SYNC_URL}" ]; then - __caplin+=" --caplin.checkpoint-sync-url=${RAPID_SYNC_URL}" - echo "Checkpoint sync enabled" - else - __caplin+=" --caplin.checkpoint-sync.disable=true" - fi - echo "Caplin parameters: ${__caplin}" + __caplin+=" --caplin.checkpoint-sync.disable=true" fi + echo "Caplin parameters: ${__caplin}" fi if [ "${IPV6}" = "true" ]; then @@ -132,4 +96,4 @@ fi # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 -exec "$@" ${__ipv6} ${__network} ${__prune} ${__db_params} ${__caplin} ${EL_EXTRAS} +exec "$@" ${__ipv6} ${__network} ${__prune} ${__caplin} ${EL_EXTRAS} diff --git a/ethd b/ethd index 23e07203..2c532864 100755 --- a/ethd +++ b/ethd @@ -215,10 +215,6 @@ __prep_conffiles() { if [ ! -f "./prometheus/custom-prom.yml" ]; then ${__as_owner} touch "./prometheus/custom-prom.yml" fi -# Move ssv-config.yaml - if [ -f "./ssv-config.yaml" ]; then - ${__as_owner} mv ./ssv-config.yaml ssv-config/config.yaml - fi # Create config.yaml if it doesn't exist if [ ! -f "ssv-config/config.yaml" ]; then ${__as_owner} cp ssv-config/config-sample.yaml ssv-config/config.yaml @@ -671,168 +667,6 @@ __migrate_compose_file() { } -__ssv_switch() { - echo "Detected legacy SSV Node. Migrating config to new testnet." - echo - echo "Stopping SSV Node container" - __node=$(__dodocker ps --format '{{.Names}}' | grep 'ssv2-node') - __dodocker stop "${__node}" && __dodocker rm -f "${__node}" - __dodocker volume rm "$(__dodocker volume ls -q | grep "$(basename "$(realpath .)")"_ssv2-data)" - echo - echo "SSV Node stopped and database deleted." - echo - cp blox-ssv-config.yaml blox-ssv-config.yaml.bak - cp blox-ssv-config.yaml ssv-config/config.yaml - rm blox-ssv-config.yaml - echo "Backup copy blox-ssv-config.yaml.bak created" - echo "Making changes to ssv-config/config.yaml" - __var="NETWORK" - NETWORK=$(__get_value_from_env "${__var}" "${__env_file}") - sed -i'.original' 's/blox-ssv2.yml/ssv.yml/' "${__env_file}".source - if ! grep -q "LogFilePath:" ssv-config/config.yaml; then -# macOS-isms: Newline for sed add - sed -i'.original' '/global:/a\ - LogFilePath: /tmp/ssv/debug.log -' ssv-config/config.yaml - fi - if ! grep -q "MetricsAPIPort:" ssv-config/config.yaml; then - sed -i'.original' '$a\ -MetricsAPIPort: 15000 -' ssv-config/config.yaml - fi - if ! grep -q "ssv:" ssv-config/config.yaml; then - sed -i'.original' '/^ Network:/d' ssv-config/config.yaml # Remove old eth2 Network line if present - sed -i'.original' '$a\ - ssv: - ' ssv-config/config.yaml - if [ "${NETWORK}" = "holesky" ]; then - sed -i'.original' '$a\ - Network: holesky -' ssv-config/config.yaml - elif [ "${NETWORK}" = "mainnet" ]; then - sed -i'.original' '$a\ - Network: mainnet -' ssv-config/config.yaml - else - echo "${NETWORK} is not something that works with SSV." - echo "Please fix this manually before running $__me update again." - echo "Aborting." - exit 1 - fi - fi - rm ssv-config/config.yaml.original -} - - -__delete_reth() { -# Check for Reth - __var="COMPOSE_FILE" - __value=$(__get_value_from_env "${__var}" "${__env_file}") -# I do mean to match literally -# shellcheck disable=SC2076 - if [[ ! "${__value}" =~ "reth.yml" ]]; then - return 0 - fi - -# Check Reth version, only continue if not on alpha - __var="RETH_DOCKER_TAG" - __value=$(__get_value_from_env "${__var}" "${__env_file}") -# I do mean to match literally -# shellcheck disable=SC2076 - if [[ "${__value}" =~ "alpha" ]]; then - return 0 - fi - - if [ -z "$(__dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]reth-el-data")" ]; then # No Reth volume - return 0 - fi - -# Has db been initialized? - __db_exists=$(__dodocker run --rm -v "$(__dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]reth-el-data")":"/var/lib/reth" \ - alpine:3 sh -c 'if [ -f "/var/lib/reth/db/database.version" ]; then echo true; else echo false; fi') - if [ "$__db_exists" = "false" ]; then - return 0 - fi - -# Check Reth db version - __db_version="$(__dodocker run --rm -v "$(__dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]reth-el-data")":"/var/lib/reth" \ - alpine:3 cat /var/lib/reth/db/database.version)" - if [ "${__db_version}" -ne "1" ]; then - return 0 - fi - - echo "Detected Reth. For Reth beta, it will need to be re-synced from scratch." - echo - if [ "${__non_interactive:-0}" -eq 0 ]; then - while true; do - read -rp "WARNING - About to delete the Reth database. Do you wish to continue? (Y/n) " __yn - case $__yn in - [Nn]o | [Nn] ) echo "No changes made"; return 0;; - * ) break;; - esac - done - fi - - echo "Stopping Reth container" - __docompose stop execution && __docompose rm -f execution - __dodocker volume rm "$(__dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]reth-el-data")" - echo - echo "Reth stopped and database deleted." - echo -} - - -__delete_erigon() { -# Check for Erigon - __var="COMPOSE_FILE" - __value=$(__get_value_from_env "${__var}" "${__env_file}") -# I do mean to match literally -# shellcheck disable=SC2076 - if [[ ! "${__value}" =~ "erigon.yml" ]]; then - return 0 - fi - -# Check Erigon version, only continue if v3 - __var="ERIGON_DOCKER_TAG" - __value=$(__get_value_from_env "${__var}" "${__env_file}") - __var="ERIGON_DOCKER_REPO" - __repo=$(__get_value_from_env "${__var}" "${__env_file}") -# I do mean to match literally -# shellcheck disable=SC2076 - if [[ ! ("${__value}" =~ "v3" || ( "${__value}" = "latest" && "${__repo}" =~ "thorax" ) || "${__value}" = "main-latest") ]]; then - return 0 - fi - - if [ -z "$(__dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]erigon-el-data")" ]; then # No Erigon volume - return 0 - fi - -# Detect Erigon v3 by directory caplin/latest - __erigon_v3=$(__dodocker run --rm -v "$(__dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]erigon-el-data")":"/var/lib/erigon" \ - alpine:3 sh -c 'if [ -d "/var/lib/erigon/caplin/latest" ]; then echo true; else echo false; fi') - if [ "$__erigon_v3" = "true" ]; then - return 0 - fi - - echo "Detected Erigon. For Erigon v3, it will need to be re-synced from scratch." - echo - while true; do - read -rp "WARNING - About to delete the Erigon database. Do you wish to continue? (Y/n) " __yn - case $__yn in - [Nn]o | [Nn] ) echo "Aborting, no changes made"; exit 130;; - * ) break;; - esac - done - - echo "Stopping Erigon container" - __docompose stop execution && __docompose rm -f execution - __dodocker volume rm "$(__dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]erigon-el-data")" - echo - echo "Erigon stopped and database deleted." - echo -} - - __upgrade_postgres() { # Check for web3signer __var="COMPOSE_FILE" @@ -956,46 +790,6 @@ __upgrade_postgres() { } -__lookup_cf_zone() { # Migrates traefik-cf setup to use Zone ID - __compose_ymls=$(__get_value_from_env "COMPOSE_FILE" "${__env_file}.source") - __dns_token=$(__get_value_from_env "CF_DNS_API_TOKEN" "${__env_file}.source") - __zone_token=$(__get_value_from_env "CF_ZONE_API_TOKEN" "${__env_file}.source") - __domain=$(__get_value_from_env "DOMAIN" "${__env_file}.source") - if [[ ! $__compose_ymls =~ traefik-cf.yml ]]; then - __value="" - return - elif [[ -n $__dns_token ]]; then - if [[ -n $__zone_token ]]; then - __token=$__zone_token - else - __token=$__dns_token - fi - set +e - __value=$(__docompose run --rm curl-jq sh -c \ - "curl -s \"https://api.cloudflare.com/client/v4/zones?name=${__domain}\" -H \"Authorization: Bearer ${__token}\" \ - -H \"Content-Type: application/json\" | jq -r '.result[0].id'" | tail -n 1) - __code=$? - if [[ "$__code" -ne 0 ]]; then - __value="" - return - fi - __success=$(__docompose run --rm curl-jq sh -c \ - "curl -s \"https://api.cloudflare.com/client/v4/zones?name=${__domain}\" -H \"Authorization: Bearer ${__token}\" \ - -H \"Content-Type: application/json\" | jq -r '.success'" | tail -n 1) - set -e - if [ "${__success}" = "true" ]; then - return - else - __value="" - return - fi - else - __value="" - return - fi -} - - __enable_v6() { if [ "${__docker_major_version}" -lt 27 ]; then return @@ -1220,14 +1014,6 @@ __env_migrate() { __migrated=1 ${__as_owner} cp default.env "${__env_file}" - __var="COMPOSE_FILE" - __value=$(__get_value_from_env "${__var}" "${__env_file}.source") -# Literal match intended -# shellcheck disable=SC2076 - if [[ "${__value}" =~ "blox-ssv2.yml" ]]; then - __ssv_switch - fi - # Migrate over user settings for __var in "${__all_vars[@]}"; do __value=$(__get_value_from_env "${__var}" "${__env_file}.source") @@ -1275,13 +1061,6 @@ __env_migrate() { fi # Handle & in GRAFFITI gracefully, as well as multi-line __update_value_in_env "${__var}" "$__value" "${__env_file}" - else # empty __value - if [ "${__var}" = "CF_ZONE_ID" ]; then - __lookup_cf_zone - if [ -n "${__value}" ]; then - __update_value_in_env "${__var}" "$__value" "${__env_file}" - fi - fi fi done if [ "${__keep_targets}" -eq 1 ]; then @@ -1289,21 +1068,6 @@ __env_migrate() { for __var in "${__target_vars[@]}"; do __value=$(__get_value_from_env "${__var}" "${__env_file}.source") if [ -n "${__value}" ]; then - if [[ "${__var}" = "DDNS_TAG" && "${__source_ver}" -lt "8" ]]; then # Switch to ddns-updater - __value="v2" - fi - if [[ "${__var}" = "LH_DOCKER_TAG" && "${__value}" = "latest-modern" ]]; then # LH 5.2 ditched latest-modern - __value="latest" - fi - if [[ "${__var}" = "ERIGON_DOCKER_TAG" && "${__value}" = "stable" ]]; then # Erigon switched to latest - __value="latest" - fi - if [[ "${__var}" = "ERIGON_DOCKER_REPO" && "${__value}" = "thorax/erigon" ]]; then # Erigon new repo - __value="erigontech/erigon" - fi - if [[ "${__var}" = "SSV_NODE_REPO" && "${__value}" = "bloxstaking/ssv-node" ]]; then # SSV new repo - __value="ssvlabs/ssv-node" - fi __update_value_in_env "${__var}" "$__value" "${__env_file}" fi done @@ -1528,8 +1292,6 @@ update() { __env_migrate __pull_and_build - __delete_erigon - __delete_reth __upgrade_postgres echo