From 524852010096cb3e20e1bc0ac1ec85cf68247c11 Mon Sep 17 00:00:00 2001 From: yorickdowne <71337066+yorickdowne@users.noreply.github.com> Date: Sat, 10 Aug 2024 15:26:59 -0400 Subject: [PATCH] Support Erigon Caplin CL (#1898) --- caplin-shared.yml | 4 ++++ caplin-traefik.yml | 15 +++++++++++++++ erigon.yml | 6 ++++++ erigon/docker-entrypoint.sh | 28 ++++++++++++++++++++++++++-- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 caplin-shared.yml create mode 100644 caplin-traefik.yml diff --git a/caplin-shared.yml b/caplin-shared.yml new file mode 100644 index 00000000..a2d60eb6 --- /dev/null +++ b/caplin-shared.yml @@ -0,0 +1,4 @@ +services: + execution: + ports: + - ${SHARE_IP:-}:${CL_REST_PORT:-5052}:${CL_REST_PORT:-5052}/tcp diff --git a/caplin-traefik.yml b/caplin-traefik.yml new file mode 100644 index 00000000..54247c99 --- /dev/null +++ b/caplin-traefik.yml @@ -0,0 +1,15 @@ +# To be used in conjunction with erigon.yml +# For remote validator setups only. Please be very cautious when exposing your consensus API port +services: + execution: + labels: + - traefik.enable=true + - traefik.http.routers.${CL_HOST:-cl}.service=${CL_HOST:-cl} + - traefik.http.routers.${CL_HOST:-cl}.entrypoints=websecure + - traefik.http.routers.${CL_HOST:-cl}.rule=Host(`${CL_HOST:-cl}.${DOMAIN}`) + - traefik.http.routers.${CL_HOST:-cl}.tls.certresolver=letsencrypt + - traefik.http.routers.${CL_HOST:-cl}lb.service=${CL_HOST:-cl} + - traefik.http.routers.${CL_HOST:-cl}lb.entrypoints=websecure + - traefik.http.routers.${CL_HOST:-cl}lb.rule=Host(`${CL_LB:-cl-lb}.${DOMAIN}`) + - traefik.http.routers.${CL_HOST:-cl}lb.tls.certresolver=letsencrypt + - traefik.http.services.${CL_HOST:-cl}.loadbalancer.server.port=${CL_REST_PORT:-5052} diff --git a/erigon.yml b/erigon.yml index 5db65a4d..4fe00f8c 100644 --- a/erigon.yml +++ b/erigon.yml @@ -28,6 +28,12 @@ services: - NETWORK=${NETWORK} - IPV6=${IPV6:-false} - DOCKER_TAG=${ERIGON_DOCKER_TAG:-stable} + - COMPOSE_FILE=${COMPOSE_FILE} + - CL_P2P_PORT=${CL_P2P_PORT:-9000} + - CL_REST_PORT=${CL_REST_PORT:-5052} + - RAPID_SYNC_URL=${RAPID_SYNC_URL:-} + - MEV_BOOST=${MEV_BOOST:-false} + - MEV_NODE=${MEV_NODE:-} volumes: - erigon-el-data:/var/lib/erigon - /etc/localtime:/etc/localtime:ro diff --git a/erigon/docker-entrypoint.sh b/erigon/docker-entrypoint.sh index dd05553b..cb294ad4 100755 --- a/erigon/docker-entrypoint.sh +++ b/erigon/docker-entrypoint.sh @@ -54,6 +54,8 @@ else __network="--chain ${NETWORK} --http.api web3,eth,net,engine" fi +__caplin="" +__db_params="" #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 @@ -63,7 +65,29 @@ if [[ "${DOCKER_TAG}" =~ "v3" || "${DOCKER_TAG}" = "latest" ]]; then echo "Erigon full node with pruning" __prune="--prune.mode=full" fi - __db_params="--externalcl=true" + 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 + if [ "${ARCHIVE_NODE}" = "true" ]; then + __caplin+=" --caplin.archive=true" + fi + if [ -n "${RAPID_SYNC_URL}" ]; then + __caplin+=" --caplin.checkpoint-sync-url=${RAPID_SYNC_URL}" + else + __caplin+=" --caplin.checkpoint-sync.disable=true" + fi + echo "Caplin parameters: ${__caplin}" + fi else # Check for network, and set prune accordingly if [ "${ARCHIVE_NODE}" = "true" ]; then @@ -105,4 +129,4 @@ fi # Word splitting is desired for the command line parameters # shellcheck disable=SC2086 -exec "$@" ${__ipv6} ${__network} ${__prune} ${__db_params} ${EL_EXTRAS} +exec "$@" ${__ipv6} ${__network} ${__prune} ${__db_params} ${__caplin} ${EL_EXTRAS}