Skip to content

Commit

Permalink
Manual v6 enr (#1941)
Browse files Browse the repository at this point in the history
* V6 manual ENRs

* discv5
  • Loading branch information
yorickdowne authored Sep 30, 2024
1 parent 5dd679d commit a82462b
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 10 deletions.
1 change: 1 addition & 0 deletions besu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ services:
- EL_EXTRAS=${EL_EXTRAS:-}
- ARCHIVE_NODE=${ARCHIVE_NODE:-}
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
volumes:
- besu-el-data:/var/lib/besu
- besu-eth1-data:/var/lib/besu-og
Expand Down
10 changes: 9 additions & 1 deletion besu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ else
__datadir="--data-path /var/lib/besu"
fi

# DiscV5 for IPV6
if [ "${IPV6:-false}" = "true" ]; then
echo "Configuring Besu for discv5 for IPv6 advertisements"
__ipv6="--Xv5-discovery-enabled"
else
__ipv6=""
fi

if [ -f /var/lib/besu/prune-marker ]; then
rm -f /var/lib/besu/prune-marker
if [ "${ARCHIVE_NODE}" = "true" ]; then
Expand All @@ -84,5 +92,5 @@ if [ -f /var/lib/besu/prune-marker ]; then
else
# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" ${__datadir} ${__network} ${__prune} ${__spec} ${EL_EXTRAS}
exec "$@" ${__datadir} ${__network} ${__ipv6} ${__prune} ${__spec} ${EL_EXTRAS}
fi
4 changes: 3 additions & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ CL_P2P_PORT=9000
PRYSM_PORT=9000
PRYSM_UDP_PORT=9000
CL_QUIC_PORT=9001
# Some clients need a separate port for IPv6
CL_IPV6_P2P_PORT=9090
# Local grafana dashboard port. Do not expose to Internet, it is insecure http
GRAFANA_PORT=3000
# Local Siren UI port
Expand Down Expand Up @@ -331,4 +333,4 @@ DDNS_TAG=v2
NODE_EXPORTER_IGNORE_MOUNT_REGEX='^/(dev|proc|sys|run|var/lib/docker/.+)($|/)'

# Used by ethd update - please do not adjust
ENV_VERSION=16
ENV_VERSION=17
8 changes: 8 additions & 0 deletions grandine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ if [ "${IPV6}" = "true" ]; then
echo "Configuring Grandine to listen on IPv6 ports"
__ipv6="--listen-address-ipv6 :: --libp2p-port-ipv6 ${CL_P2P_PORT:-9000} --discovery-port-ipv6 ${CL_P2P_PORT:-9000} \
--quic-port-ipv6 ${CL_QUIC_PORT:-9001}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v6=$(curl -s -6 ifconfig.me)
set -e
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
__ipv6+=" --enr-address-ipv6 ${__public_v6} --enr-tcp-port-ipv6 ${CL_P2P_PORT:-9000} --enr-udp-port-ipv6 ${CL_P2P_PORT:-9000}"
fi
else
__ipv6=""
fi
Expand Down
8 changes: 8 additions & 0 deletions lighthouse/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ fi
if [ "${IPV6}" = "true" ]; then
echo "Configuring Lighthouse to listen on IPv6 ports"
__ipv6="--listen-address :: --port6 ${CL_P2P_PORT:-9000} --quic-port6 ${CL_QUIC_PORT:-9001}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v6=$(wget -6 -q -O- ifconfig.me)
set -e
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
__ipv6+=" --enr-address ${__public_v6}"
fi
else
__ipv6=""
fi
Expand Down
4 changes: 3 additions & 1 deletion lodestar-cl-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ services:
- ARCHIVE_NODE=${ARCHIVE_NODE:-}
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
- NODE_OPTIONS=${LODESTAR_HEAP:---max-old-space-size=8192}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
4 changes: 3 additions & 1 deletion lodestar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ services:
- ARCHIVE_NODE=${ARCHIVE_NODE:-}
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
- NODE_OPTIONS=${LODESTAR_HEAP:---max-old-space-size=8192}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
3 changes: 2 additions & 1 deletion lodestar/Dockerfile.binary
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ FROM ${DOCKER_REPO}:${DOCKER_TAG}
ARG BUILD_TARGET
ARG SRC_REPO

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ARG USER=lsconsensus
ARG UID=10002
Expand Down
3 changes: 2 additions & 1 deletion lodestar/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ RUN bash -c "cd .. && rm -rf app && git clone ${SRC_REPO} app && cd app && git c

FROM node:22.4-slim

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata bash gosu git wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ARG USER=lsconsensus
ARG UID=10002
Expand Down
10 changes: 9 additions & 1 deletion lodestar/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ fi

if [ "${IPV6}" = "true" ]; then
echo "Configuring Lodestar to listen on IPv6 ports"
__ipv6="--listenAddress6 :: --port6 ${CL_P2P_PORT:-9000}"
__ipv6="--listenAddress 0.0.0.0 --listenAddress6 :: --port6 ${CL_IPV6_P2P_PORT:-9090}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v6=$(wget -6 -q -O- ifconfig.me)
set -e
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
__ipv6+=" --enr.ip6 ${__public_v6}"
fi
else
__ipv6=""
fi
Expand Down
2 changes: 2 additions & 0 deletions nethermind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ services:
- "6060"
- --Pruning.FullPruningCompletionBehavior
- AlwaysShutdown
- --Discovery.Discv5Enabled
- "true"
- --log
- ${LOG_LEVEL}
labels:
Expand Down
4 changes: 4 additions & 0 deletions teku-allin1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ services:
- EMBEDDED_VC=true
- NETWORK=${NETWORK}
- ENABLE_DIST_ATTESTATION_AGGR=${ENABLE_DIST_ATTESTATION_AGGR:-false}
- IPV6=${IPV6:-false}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
4 changes: 3 additions & 1 deletion teku-cl-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ services:
- WEB3SIGNER=false
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
4 changes: 3 additions & 1 deletion teku.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ services:
- EMBEDDED_VC=false
- NETWORK=${NETWORK}
- IPV6=${IPV6:-false}
- CL_P2P_PORT=${CL_P2P_PORT:-9000}
- CL_IPV6_P2P_PORT=${CL_IPV6_P2P_PORT:-9090}
ports:
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/tcp
- ${HOST_IP:-}:${CL_P2P_PORT:-9000}:${CL_P2P_PORT:-9000}/udp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/tcp
- ${HOST_IP:-}:${CL_IPV6_P2P_PORT:-9090}:${CL_IPV6_P2P_PORT:-9090}/udp
networks:
default:
aliases:
Expand Down
20 changes: 19 additions & 1 deletion teku/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,25 @@ fi

if [ "${IPV6}" = "true" ]; then
echo "Configuring Teku to listen on IPv6 ports"
__ipv6="--p2p-interface 0.0.0.0,:: --p2p-port-ipv6 ${CL_P2P_PORT:-9000}"
__ipv6="--p2p-interface 0.0.0.0,:: --p2p-port-ipv6 ${CL_IPV6_P2P_PORT:-9090}"
# ENR discovery on v6 is not yet working, likely too few peers. Manual for now
__ipv4_pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
__ipv6_pattern="^[0-9A-Fa-f]{1,4}:" # Sufficient to check the start
set +e
__public_v4=$(curl -s -4 ifconfig.me)
__public_v6=$(curl -s -6 ifconfig.me)
set -e
__valid_v4=0
if [[ "$__public_v4" =~ $__ipv4_pattern ]]; then
__valid_v4=1
fi
if [[ "$__public_v6" =~ $__ipv6_pattern ]]; then
if [ "${__valid_v4}" -eq 1 ]; then
__ipv6+=" --p2p-advertised-ips ${__public_v4},${__public_v6}"
else
__ipv6+=" --p2p-advertised-ip ${__public_v6}"
fi
fi
else
__ipv6=""
fi
Expand Down

0 comments on commit a82462b

Please sign in to comment.