Skip to content

Commit

Permalink
Support Erigon Caplin CL (#1898)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne authored Aug 10, 2024
1 parent f068d95 commit 5248520
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
4 changes: 4 additions & 0 deletions caplin-shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
execution:
ports:
- ${SHARE_IP:-}:${CL_REST_PORT:-5052}:${CL_REST_PORT:-5052}/tcp
15 changes: 15 additions & 0 deletions caplin-traefik.yml
Original file line number Diff line number Diff line change
@@ -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}
6 changes: 6 additions & 0 deletions erigon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 26 additions & 2 deletions erigon/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}

0 comments on commit 5248520

Please sign in to comment.