Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/eth-educators/eth-docker in…
Browse files Browse the repository at this point in the history
…to remove-extnetwork
  • Loading branch information
yorickdowne committed Jan 31, 2025
2 parents f86b97c + ef1815b commit 911277b
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 22 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build-nimbus-gnosis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Source build Nimbus on Gnosis

defaults:
run:
shell: bash

on:
schedule:
- cron: "42 7 * * 2" # Weekly Tuesday at 7:42 AM UTC
workflow_dispatch:

jobs:
build-nimbus:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: Create .env file
run: cp default.env .env
- name: Set Nimbus/Nethermind
run: |
source ./.github/helper.sh
COMPOSE_FILE=nimbus.yml:nethermind.yml
var=COMPOSE_FILE
set_value_in_env
FEE_RECIPIENT=0xDccf8451070a86183eE70D330C4c43b686E9CF86
var=FEE_RECIPIENT
set_value_in_env
NIM_DOCKERFILE=Dockerfile.sourcegnosis
var=NIM_DOCKERFILE
set_value_in_env
NETWORK=gnosis
var=NETWORK
set_value_in_env
- name: Build clients
run: ./ethd update
- name: Start Nimbus/Nethermind
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Nimbus CL
run: ./.github/check-service.sh consensus
- name: Test Nimbus VC
run: ./.github/check-service.sh validator
- name: Test Nethermind
run: ./.github/check-service.sh execution
- name: Set Nimbus/Nethermind w/ VC
run: |
source ./.github/helper.sh
COMPOSE_FILE=nimbus-cl-only.yml:nimbus-vc-only.yml:nethermind.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Nimbus/Nethermind
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Nimbus CL
run: ./.github/check-service.sh consensus
- name: Test Nimbus VC
run: ./.github/check-service.sh validator
- name: Test Nethermind
run: ./.github/check-service.sh execution
61 changes: 61 additions & 0 deletions .github/workflows/build-nimbus-slottime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Source build Nimbus with Ethereum slot time

defaults:
run:
shell: bash

on:
schedule:
- cron: "42 7 * * 2" # Weekly Tuesday at 7:42 AM UTC
workflow_dispatch:

jobs:
build-nimbus:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: Create .env file
run: cp default.env .env
- name: Set Nimbus/Nethermind
run: |
source ./.github/helper.sh
COMPOSE_FILE=nimbus.yml:nethermind.yml
var=COMPOSE_FILE
set_value_in_env
FEE_RECIPIENT=0xDccf8451070a86183eE70D330C4c43b686E9CF86
var=FEE_RECIPIENT
set_value_in_env
NIM_DOCKERFILE=Dockerfile.sourceslottime
var=NIM_DOCKERFILE
set_value_in_env
- name: Build clients
run: ./ethd update
- name: Start Nimbus/Nethermind
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Nimbus CL
run: ./.github/check-service.sh consensus
- name: Test Nimbus VC
run: ./.github/check-service.sh validator
- name: Test Nethermind
run: ./.github/check-service.sh execution
- name: Set Nimbus/Nethermind w/ VC
run: |
source ./.github/helper.sh
COMPOSE_FILE=nimbus-cl-only.yml:nimbus-vc-only.yml:nethermind.yml
var=COMPOSE_FILE
set_value_in_env
- name: Start Nimbus/Nethermind
run: ./ethd up
- name: Pause for 30 seconds
run: sleep 30
- name: Test Nimbus CL
run: ./.github/check-service.sh consensus
- name: Test Nimbus VC
run: ./.github/check-service.sh validator
- name: Test Nethermind
run: ./.github/check-service.sh execution
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.env*
docker-compose.yml
ext-network.yml.original
ext-network.yml.bak
*.original
*.bak
.eth/*
.eth_backup*
!.eth/README.md
Expand All @@ -13,6 +13,7 @@ ext-network.yml.bak
!.eth/ethdo/README.md
!.eth/ethdo/create-withdrawal-change.sh
*.swp
custom.yml
ssv-config.yaml
ssv-config.yaml.bak
blox-ssv-config.yaml
Expand Down
5 changes: 4 additions & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ SHARE_IP=
# Relays to connect charon node
OBOL_P2P_RELAYS=

# External Docker network if using ext-network.yml
DOCKER_EXT_NETWORK=rocketpool_net

# P2P ports you will forward to your staking node. Adjust here if you are
# going to use something other than defaults.
EL_P2P_PORT=30303
Expand Down Expand Up @@ -356,4 +359,4 @@ NODE_EXPORTER_IGNORE_MOUNT_REGEX='^/(dev|proc|sys|run|var/lib/docker/.+)($|/)'
DOCKER_ROOT=/var/lib/docker

# Used by ethd update - please do not adjust
ENV_VERSION=25
ENV_VERSION=26
38 changes: 28 additions & 10 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,12 @@ __prep_conffiles() {
if find .eth/dkg_output \! -perm 755 | grep -q .; then
chmod -R 755 .eth/dkg_output
fi
# Create ext-network.yml if it doesn't exist
if [ ! -f "ext-network.yml" ]; then
${__as_owner} cp ext-network.yml.sample ext-network.yml
fi
# Create cb-config.toml if it doesn't exist
if [ ! -f "commit-boost/cb-config.toml" ]; then
${__as_owner} cp commit-boost/cb-config.toml.sample commit-boost/cb-config.toml
fi
# Make sure local user owns .env
if find .env \! -user "${OWNER}" -o \! -group "${OWNER_GROUP}" | grep -q .; then
if find . -name .env \! -user "${OWNER}" -o \! -group "${OWNER_GROUP}" | grep -q ./.env; then
if [ "$__cannot_sudo" -eq 0 ]; then
echo "Fixing ownership of .env"
${__auto_sudo} chown -R "${OWNER}:${OWNER_GROUP}" .env
Expand Down Expand Up @@ -1208,7 +1204,7 @@ __env_migrate() {
TRAEFIK_WEB_HTTP_PORT CL_REST_PORT EL_RPC_PORT EL_WS_PORT EE_PORT ERIGON_TORRENT_PORT LOG_LEVEL JWT_SECRET \
EL_EXTRAS CL_EXTRAS VC_EXTRAS ARCHIVE_NODE SSV_P2P_PORT SSV_P2P_PORT_UDP OBOL_P2P_PORT EL_P2P_PORT_2 \
ERIGON_P2P_PORT_3 LODESTAR_HEAP SSV_DKG_PORT SIREN_PASSWORD LIDO_DV_EXIT_VERSION OBOL_CHARON_CL_ENDPOINTS VC_ALIAS \
CL_IPV6_P2P_PORT CONTRIBUTOOR_USERNAME CONTRIBUTOOR_PASSWORD MINIMAL_NODE )
CL_IPV6_P2P_PORT CONTRIBUTOOR_USERNAME CONTRIBUTOOR_PASSWORD MINIMAL_NODE DOCKER_EXT_NETWORK )
__target_vars=( ETH_DOCKER_TAG NIM_SRC_BUILD_TARGET NIM_SRC_REPO NIM_DOCKER_TAG NIM_DOCKER_VC_TAG NIM_DOCKER_REPO \
NIM_DOCKER_VC_REPO NIM_DOCKERFILE TEKU_SRC_BUILD_TARGET TEKU_SRC_REPO TEKU_DOCKER_TAG TEKU_DOCKER_REPO \
TEKU_DOCKERFILE LH_SRC_BUILD_TARGET LH_SRC_REPO LH_DOCKER_TAG LH_DOCKER_REPO LH_DOCKERFILE SSV_NODE_REPO \
Expand Down Expand Up @@ -1527,6 +1523,13 @@ update() {
exec "${BASH_SOURCE[0]}" update "$@"
fi

if [ -f "ext-network.yml.bak" ]; then
${__as_owner} rm ext-network.yml.bak
fi
if [ -f "ext-network.yml.original" ]; then
${__as_owner} rm ext-network.yml.original
fi

__keep_targets=1
__targetcli=""
while :
Expand Down Expand Up @@ -3176,9 +3179,11 @@ checkpoint sync provider? (right-click to paste)" 10 65 "${RAPID_SYNC_URL}" 3>&1
__query_graffiti() {
__var="GRAFFITI"
GRAFFITI=$(__get_value_from_env "${__var}" "${__env_file}")
__var="DEFAULT_GRAFFITI"
DEFAULT_GRAFFITI=$(__get_value_from_env "${__var}" "${__env_file}")

while true; do
GRAFFITI=$(whiptail --title "Configure Graffiti" --inputbox "What Graffiti do you want to send with your blocks? \
GRAFFITI=$(whiptail --title "Configure Graffiti" --inputbox "What optional Graffiti do you want to send with your blocks? \
(up to 32 characters)" 10 65 "${GRAFFITI}" 3>&1 1>&2 2>&3)

if [[ $(echo -n "${GRAFFITI}" | wc -c) -gt 32 ]]; then
Expand All @@ -3188,7 +3193,14 @@ __query_graffiti() {
fi
done

echo "your Graffiti is:" "${GRAFFITI}"
if [ -n "${GRAFFITI}" ]; then
DEFAULT_GRAFFITI="false"
fi
if [ "${DEFAULT_GRAFFITI}" = "true" ]; then
echo "You are using the client's default Graffiti"
else
echo "your Graffiti is:" "${GRAFFITI}"
fi
}


Expand Down Expand Up @@ -3900,7 +3912,9 @@ config() {
# COMPOSE_FILE="${COMPOSE_FILE}:ethdo.yml"
if [ "${__deployment}" = "rocket" ]; then
COMPOSE_FILE="${COMPOSE_FILE}:ext-network.yml"
sed -i'.original' -e "s~name: traefik_default~name: rocketpool_net~" ext-network.yml
# This gets used, but shellcheck doesn't recognize that
# shellcheck disable=SC2034
DOCKER_EXT_NETWORK="rocketpool_net"
fi

echo "Your COMPOSE_FILE is:" "${COMPOSE_FILE}"
Expand All @@ -3909,14 +3923,16 @@ config() {
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=GRAFFITI
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=DEFAULT_GRAFFITI
__update_value_in_env "${__var}" "${!__var:-"true"}" "${__env_file}"
__var=CL_NODE
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=RAPID_SYNC_URL
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=COMPOSE_FILE
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=EL_NODE
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__update_value_in_env "${__var}" "${!__var:-"http://execution:8551"}" "${__env_file}"
__var=JWT_SECRET
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=NETWORK
Expand All @@ -3925,6 +3941,8 @@ config() {
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=MEV_RELAYS
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
__var=DOCKER_EXT_NETWORK
__update_value_in_env "${__var}" "${!__var:-"rocketpool_net"}" "${__env_file}"
if [ "${__deployment}" = "lido_obol" ]; then
__var=LIDO_DV_EXIT_EXIT_EPOCH
__update_value_in_env "${__var}" "${!__var-}" "${__env_file}"
Expand Down
4 changes: 2 additions & 2 deletions nimbus/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ ARG DOCKER_VC_REPO
ARG BUILD_TARGET
ARG SRC_REPO

RUN apt-get update && apt-get install -y build-essential bash git-lfs
RUN apt-get update && apt-get install -y build-essential ca-certificates bash git-lfs cmake

WORKDIR /usr/src
RUN bash -c "git clone --recurse-submodules -j8 ${SRC_REPO} nimbus-eth2 && cd nimbus-eth2 && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:nim-pr; git checkout nim-pr; else git checkout ${BUILD_TARGET}; fi && make USE_SYSTEM_NIM=1 -j$(nproc) update && make -j$(nproc) nimbus_beacon_node nimbus_validator_client"
RUN bash -c "git clone --recurse-submodules -j8 ${SRC_REPO} nimbus-eth2 && cd nimbus-eth2 && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:nim-pr; git checkout nim-pr; else git checkout ${BUILD_TARGET}; fi && make -j$(nproc) update && make -j$(nproc) nimbus_beacon_node nimbus_validator_client"

# Pull all binaries into a second stage deploy debian container
FROM debian:bookworm-slim AS consensus
Expand Down
6 changes: 3 additions & 3 deletions nimbus/Dockerfile.sourcegnosis
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ ARG DOCKER_VC_REPO
ARG BUILD_TARGET
ARG SRC_REPO

RUN apt-get update && apt-get install -y build-essential git ca-certificates
RUN apt-get update && apt-get install -y build-essential ca-certificates bash git-lfs cmake

WORKDIR /usr/src
RUN bash -c "git clone --recurse-submodules -j8 ${SRC_REPO} nimbus-eth2 && cd nimbus-eth2 && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:nim-pr; git checkout nim-pr; else git checkout ${BUILD_TARGET}; fi && make -j$(nproc) update && make -j$(nproc) gnosis-build nimbus_validator_client"
RUN bash -c "git clone --recurse-submodules -j8 ${SRC_REPO} nimbus-eth2 && cd nimbus-eth2 && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:nim-pr; git checkout nim-pr; else git checkout ${BUILD_TARGET}; fi && make -j$(nproc) update && make -j$(nproc) gnosis-build gnosis-vc-build"

# Pull all binaries into a second stage deploy debian container
FROM debian:bookworm-slim AS consensus
Expand Down Expand Up @@ -74,7 +74,7 @@ RUN adduser \
RUN mkdir -p /var/lib/nimbus && chown -R ${USER}:${USER} /var/lib/nimbus && chmod -R 700 /var/lib/nimbus

# Cannot assume buildkit, hence no chmod
COPY --from=builder --chown=${USER}:${USER} /usr/src/nimbus-eth2/build/nimbus_validator_client /usr/local/bin/
COPY --from=builder --chown=${USER}:${USER} /usr/src/nimbus-eth2/build/nimbus_validator_client_gnosis /usr/local/bin/nimbus_validator_client
COPY --chown=${USER}:${USER} ./docker-entrypoint-vc.sh /usr/local/bin/
# Belt and suspenders
RUN chmod -R 755 /usr/local/bin/*
Expand Down
4 changes: 2 additions & 2 deletions nimbus/Dockerfile.sourceslottime
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ ARG BUILD_TARGET
ARG SRC_REPO
ARG SECONDS_PER_SLOT=12

RUN apt-get update && apt-get install -y build-essential git libpcre3-dev ca-certificates
RUN apt-get update && apt-get install -y build-essential ca-certificates bash git-lfs cmake

WORKDIR /usr/src
RUN bash -c "git clone ${SRC_REPO} nimbus-eth2 && cd nimbus-eth2 && git config advice.detachedHead false && git fetch --all --tags && git checkout ${BUILD_TARGET} && \
make -j$(nproc) NIMFLAGS="-d:SECONDS_PER_SLOT=${SECONDS_PER_SLOT}" nimbus_beacon_node"
make -j$(nproc) update && make -j$(nproc) NIMFLAGS="-d:SECONDS_PER_SLOT=${SECONDS_PER_SLOT}" nimbus_beacon_node nimbus_validator_client"

# Pull all binaries into a second stage deploy debian container
FROM debian:bookworm-slim
Expand Down
14 changes: 12 additions & 2 deletions vc-utils/keymanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,18 +376,25 @@ exit-sign() {
__pubkeys+=( "${__pubkey}" )
fi

__skipped=0
__signed=0
get-token
for __pubkey in "${__pubkeys[@]}"; do
__api_data=""
__http_method=POST
__api_path=eth/v1/validator/$__pubkey/voluntary_exit
call_api
case $__code in
200) echo "Signed voluntary exit for validator with public key $__pubkey";;
200) echo "Signed voluntary exit for validator with public key $__pubkey"; (( __signed+=1 ));;
400) echo "The pubkey or limit was formatted wrong. Error: $(echo "$__result" | jq -r '.message')"; exit 1;;
401) echo "No authorization token found. This is a bug. Error: $(echo "$__result" | jq -r '.message')"; exit 70;;
403) echo "The authorization token is invalid. Error: $(echo "$__result" | jq -r '.message')"; exit 1;;
404) echo "Path not found error. Was that the right pubkey? Error: $(echo "$__result" | jq -r '.message')"; exit 0;;
404)
echo "Path not found error. The key ${__pubkey} has to be active with an index on the beacon chain to be able to sign an exit message."
echo "Error: $(echo "$__result" | jq -r '.message')"
(( __skipped+=1 ))
continue
;;
500) echo "Internal server error. Error: $(echo "$__result" | jq -r '.message')"; exit 1;;
*) echo "Unexpected return code $__code. Result: $__result"; exit 1;;
esac
Expand All @@ -404,6 +411,9 @@ exit-sign() {
fi
echo
done

echo "Signed exit messages for ${__signed} keys"
echo "Skipped ${__skipped} keys because they weren't found or were not active on the beacon chain"
}


Expand Down

0 comments on commit 911277b

Please sign in to comment.