Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ephemery/ephemery-config.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
# Fetches the network config of the current Ephemery iteration and prints the directory holding
# config.yaml, genesis.ssz, genesis.json, bootstrap_nodes.txt, enodes.txt and deposit_contract_block.txt.
# Prysm, Geth, Nimbus, Lighthouse, Erigon and Nethermind have no built-in Ephemery. The genesis repo
# Prysm, Geth, Nimbus, Lighthouse, Erigon, Reth and Nethermind have no built-in Ephemery. The genesis repo
# does not keep these files in git, they come as a release per iteration, so the git-based custom
# network path cannot fetch them.
# Each iteration's retention.vars has its genesis time and reset interval. An iteration fetched before
# is used as long as it is live, without asking GitHub. Once it has ended, this looks up the latest
# release, and waits for one that is live if there is none yet: a node on an ended iteration is useless.
# Call with the directory to keep iterations in. Messages go to stderr, the path to stdout.
# Client images get it from the "ephemery" additional build context, see geth.yml, prysm.yml,
# nimbus.yml, nimbus-el.yml, lighthouse.yml, erigon.yml and nethermind.yml.
# nimbus.yml, nimbus-el.yml, lighthouse.yml, erigon.yml, reth.yml and nethermind.yml.
set -Eeuo pipefail

base_dir="$1"
Expand Down
1 change: 1 addition & 0 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -7045,6 +7045,7 @@ __query_execution_client() {
choices+=("besu.yml" "Besu (Java)")
choices+=("erigon.yml" "Erigon (Go)")
choices+=("nethermind.yml" "Nethermind (.NET)")
choices+=("reth.yml" "Reth (Rust)")
fi
elif [[ "${arch}" =~ (aarch64|arm64) ]] ; then
choices+=("ethrex.yml" "Ethrex (Rust)")
Expand Down
2 changes: 2 additions & 0 deletions reth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
restart: "unless-stopped"
build:
context: ./reth
additional_contexts:
ephemery: ./ephemery
dockerfile: ${RETH_DOCKERFILE}
args:
- BUILD_TARGET=${RETH_SRC_BUILD_TARGET:-main}
Expand Down
4 changes: 3 additions & 1 deletion reth/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# hadolint global ignore=DL3007,DL3008,DL3059
# hadolint global ignore=DL3007,DL3008,DL3022,DL3059
ARG DOCKER_TAG=latest
ARG DOCKER_REPO=ghcr.io/paradigmxyz/reth

Expand All @@ -21,6 +21,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install
git-lfs \
wget \
jq \
curl \
&& gosu nobody true \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -37,6 +38,7 @@ RUN mkdir -p /var/lib/reth/ee-secret && chown -R ${USER}:${USER} /var/lib/reth &

# Cannot assume buildkit, hence no chmod
COPY --chown=${USER}:${USER} ./docker-entrypoint.sh /usr/local/bin/
COPY --from=ephemery --chown=${USER}:${USER} ephemery-config.sh /usr/local/bin/
# Belt and suspenders
RUN chmod -R 755 /usr/local/bin/*

Expand Down
4 changes: 3 additions & 1 deletion reth/Dockerfile.source
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# hadolint global ignore=DL3007,DL3008,DL3059,DL4006
# hadolint global ignore=DL3007,DL3008,DL3022,DL3059,DL4006
# Build reth in a stock rust container
FROM rust:trixie AS builder

Expand Down Expand Up @@ -58,6 +58,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install
git-lfs \
wget \
jq \
curl \
&& gosu nobody true \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -78,6 +79,7 @@ RUN mkdir -p /var/lib/reth/ee-secret && chown -R ${USER}:${USER} /var/lib/reth &
# Cannot assume buildkit, hence no chmod
COPY --from=builder --chown=${USER}:${USER} /src/bin/reth /usr/local/bin/
COPY --chown=${USER}:${USER} ./docker-entrypoint.sh /usr/local/bin/
COPY --from=ephemery --chown=${USER}:${USER} ephemery-config.sh /usr/local/bin/
# Belt and suspenders
RUN chmod -R 755 /usr/local/bin/*

Expand Down
28 changes: 24 additions & 4 deletions reth/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,25 @@ if [[ -O /var/lib/reth/ee-secret/jwtsecret ]]; then
chmod 666 /var/lib/reth/ee-secret/jwtsecret
fi

if [[ "${NETWORK}" =~ ^https?:// ]]; then
config_dir_path=""
if [[ "${NETWORK}" = "ephemery" ]]; then
config_dir_path="$(ephemery-config.sh /var/lib/reth/testnet/ephemery)"
# A new iteration has a new genesis, and the chain data of the old one is for a dead chain.
# ee-secret is the JWT secret volume and testnet holds the Ephemery configs; both stay.
__iteration="$(basename "$(dirname "${config_dir_path}")")"
if [[ -f /var/lib/reth/ephemery-iteration ]]; then
__old_iteration="$(cat /var/lib/reth/ephemery-iteration)"
if [[ ! "${__old_iteration}" = "${__iteration}" ]]; then
echo "Ephemery reset from ${__old_iteration} to ${__iteration}, removing the old chain data"
find /var/lib/reth -mindepth 1 -maxdepth 1 ! -name ee-secret ! -name testnet \
! -name ephemery-iteration -exec rm -rf {} +
if [[ -n "${STATIC_DIR}" && ! "${STATIC_DIR}" = ".nada" ]]; then
find /var/lib/static -mindepth 1 -maxdepth 1 -exec rm -rf {} +
fi
fi
fi
echo "${__iteration}" > /var/lib/reth/ephemery-iteration
elif [[ "${NETWORK}" =~ ^https?:// ]]; then
echo "Custom testnet at ${NETWORK}"
repo=$(awk -F'/tree/' '{print $1}' <<< "${NETWORK}")
branch=$(awk -F'/tree/' '{print $2}' <<< "${NETWORK}" | cut -d'/' -f1)
Expand All @@ -60,6 +78,8 @@ if [[ "${NETWORK}" =~ ^https?:// ]]; then
git pull origin "${branch}"
fi
config_dir_path="/var/lib/reth/testnet/${config_dir}"
fi
if [[ -n "${config_dir_path}" ]]; then
if [[ -f "${config_dir_path}/enodes.txt" ]]; then
bootnodes="$(paste -sd, "${config_dir_path}/enodes.txt")"
else
Expand Down Expand Up @@ -219,7 +239,7 @@ if [[ -n "${__prune}" ]]; then
fi

if [[ -f /var/lib/reth/repair-trie ]]; then
if [[ "${NETWORK}" =~ ^https?:// ]]; then
if [[ -n "${config_dir_path}" ]]; then
echo "Can't repair database on custom network"
rm -f /var/lib/reth/repair-trie
else
Expand All @@ -231,7 +251,7 @@ if [[ -f /var/lib/reth/repair-trie ]]; then
fi

if [[ -f /var/lib/reth/migrate-v2 ]]; then
if [[ "${NETWORK}" =~ ^https?:// ]]; then
if [[ -n "${config_dir_path}" ]]; then
echo "Can't migrate database on custom network"
rm -f /var/lib/reth/migrate-v2
else
Expand Down Expand Up @@ -271,7 +291,7 @@ if [[ -n "${__snap}" && ! -d /var/lib/reth/db ]]; then
fi

# EraE import
if [[ -n "${ERE_URL}" && ! -f /var/lib/reth/ere-import-complete && ! "${NETWORK}" =~ ^https?:// ]]; then # Fresh sync and named network
if [[ -n "${ERE_URL}" && ! -f /var/lib/reth/ere-import-complete && -z "${config_dir_path}" ]]; then # Fresh sync and named network
if [[ "${NODE_TYPE}" =~ ^(full|archive|custom)$ ]]; then
echo "Starting EraE history import from ${ERE_URL}"
# shellcheck disable=SC2086
Expand Down
Loading