diff --git a/erigon.yml b/erigon.yml index 0d80c001..5db65a4d 100644 --- a/erigon.yml +++ b/erigon.yml @@ -27,6 +27,7 @@ services: - ARCHIVE_NODE=${ARCHIVE_NODE:-} - NETWORK=${NETWORK} - IPV6=${IPV6:-false} + - DOCKER_TAG=${ERIGON_DOCKER_TAG:-stable} volumes: - erigon-el-data:/var/lib/erigon - /etc/localtime:/etc/localtime:ro @@ -87,15 +88,6 @@ services: - /var/lib/erigon/ee-secret/jwtsecret - --maxpeers - ${EL_MAX_PEER_COUNT:-100} - # To assist with recordsize 16k in ZFS - - --db.pagesize - - 16K - # Breaking change from 2.55 on - - --db.size.limit - - 8TB - # Memory use reduction. Not needed with 32G and does not help with 16G - #- --batchSize - #- 64m labels: - metrics.scrape=true - metrics.path=/debug/metrics/prometheus diff --git a/erigon/docker-entrypoint.sh b/erigon/docker-entrypoint.sh index c3ff835e..dd05553b 100755 --- a/erigon/docker-entrypoint.sh +++ b/erigon/docker-entrypoint.sh @@ -54,34 +54,46 @@ else __network="--chain ${NETWORK} --http.api web3,eth,net,engine" fi -# Check for network, and set prune accordingly - -if [ "${ARCHIVE_NODE}" = "true" ]; then - echo "Erigon archive node without pruning" - __prune="" +#if [[ "${DOCKER_TAG}" =~ "v3" || "${DOCKER_TAG}" = "latest" || "${DOCKER_TAG}" = "stable" ]]; then # No stable yet +if [[ "${DOCKER_TAG}" =~ "v3" || "${DOCKER_TAG}" = "latest" ]]; then + 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 + __db_params="--externalcl=true" 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" +# Check for network, and set prune accordingly + if [ "${ARCHIVE_NODE}" = "true" ]; then + echo "Erigon archive node without pruning" + __prune="" else - echo "Unable to determine eth deposit contract, running without prune.r" - __prune="--prune=htc" + 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 fi + __db_params="--db.pagesize 16K --db.size.limit 8TB" fi if [ "${IPV6}" = "true" ]; then @@ -93,4 +105,4 @@ fi # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 -exec "$@" ${__ipv6} ${__network} ${__prune} ${EL_EXTRAS} +exec "$@" ${__ipv6} ${__network} ${__prune} ${__db_params} ${EL_EXTRAS} diff --git a/ethd b/ethd index 0ec290e8..61fbdde3 100755 --- a/ethd +++ b/ethd @@ -736,10 +736,6 @@ delete_reth() { delete_erigon() { -# Enable this when Erigon v3 is out - if true; then - return 0 - fi # Check for Erigon var="COMPOSE_FILE" value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" "${ENV_FILE}" || true) @@ -754,19 +750,20 @@ delete_erigon() { value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" "${ENV_FILE}" || true) # I do mean to match literally # shellcheck disable=SC2076 - if [[ ! ("${value}" =~ "v3" || "${value}" = "stable") ]]; then +# if [[ ! ("${value}" =~ "v3" || "${value}" = "latest" || "${value}" = "stable") ]]; then # No stable yet + if [[ ! ("${value}" =~ "v3" || "${value}" = "latest") ]]; then return 0 fi - if [ -z "$(dodocker volume ls -q -f "name=erigon-el-data")" ]; then # No Erigon volume + if [ -z "$(dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]erigon-el-data")" ]; then # No Erigon volume return 0 fi -# https://discord.com/channels/687972960811745322/886550095749873666/1068994749480054866 -# Detect Erigon v3 by files in snapshots/history - if [ -n "$(dodocker run --rm -v "$(dodocker volume ls -q -f "name=erigon-el-data")":"/var/lib/erigon" \ - alpine:3 ls /var/lib/erigon/snapshots/history)" ]; then - return 0 # Files in snapshots/history means it's v3 +# 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." @@ -781,7 +778,7 @@ delete_erigon() { echo "Stopping Erigon container" docompose stop execution && docompose rm -f execution - dodocker volume rm "$(dodocker volume ls -q -f "name=erigon-el-data")" + dodocker volume rm "$(dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]erigon-el-data")" echo echo "Erigon stopped and database deleted." echo