Skip to content

Commit

Permalink
Use latest staker package scripts version
Browse files Browse the repository at this point in the history
  • Loading branch information
dappnodedev committed Jul 22, 2024
1 parent 9bd2fe7 commit b5fc76e
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 75 deletions.
10 changes: 7 additions & 3 deletions beacon-chain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ FROM sigp/lighthouse:${UPSTREAM_VERSION}-modern
ARG NETWORK
ARG STAKER_SCRIPTS_VERSION
ARG DATA_DIR
ARG P2P_PORT

ENV JWT_FILE_PATH=/jwtsecret \
DATA_DIR=${DATA_DIR} \
BEACON_API_PORT=3500 \
NETWORK=${NETWORK} \
P2P_PORT=${P2P_PORT} \
STAKER_SCRIPTS_URL=https://github.com/dappnode/staker-package-scripts/releases/download/${STAKER_SCRIPTS_VERSION}

COPY jwtsecret.hex ${JWT_FILE_PATH}
COPY entrypoint.sh /usr/local/bin/entrypoint.sh

ADD ${STAKER_SCRIPTS_URL}/consensus_tools.sh /etc/profile.d/

RUN chmod +rx /usr/local/bin/entrypoint.sh /etc/profile.d/consensus_tools.sh
RUN apt-get update && apt-get --yes install curl && apt-get clean && \
chmod +rx /usr/local/bin/entrypoint.sh /etc/profile.d/consensus_tools.sh

RUN apt-get update && apt-get install curl --yes && apt-get clean
# This env changes the variant
# Placed at the end to regenerate the least amount of layers
ENV NETWORK=${NETWORK}

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
53 changes: 26 additions & 27 deletions beacon-chain/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,35 @@

SUPPORTED_NETWORKS="gnosis holesky mainnet"
CHECKPOINT_SYNC_FLAG="--checkpoint-sync-url"
MEVBOOST_FLAGS="--builder"
MEVBOOST_FLAG_KEYS="--builder"

# shellcheck disable=SC1091 # Path is relative to the Dockerfile
. /etc/profile

run_beacon() {
echo "[INFO - entrypoint] Starting beacon node..."
ENGINE_URL=$(get_engine_api_url "${NETWORK}" "${SUPPORTED_NETWORKS}")
VALID_FEE_RECIPIENT=$(get_valid_fee_recipient "${FEE_RECIPIENT}")
CHECKPOINT_SYNC_FLAG=$(get_checkpoint_sync_flag "${CHECKPOINT_SYNC_FLAG}" "${CHECKPOINT_SYNC_URL}")
MEVBOOST_FLAG=$(get_mevboost_flag "${NETWORK}" "${MEVBOOST_FLAG_KEYS}")

# shellcheck disable=SC2086
exec lighthouse \
--debug-level "${LOG_LEVEL}" \
--network "${NETWORK}" \
beacon_node \
--datadir="${DATA_DIR}" \
--http \
--http-allow-origin "*" \
--http-address 0.0.0.0 \
--http-port "${BEACON_API_PORT}" \
--port "${P2P_PORT}" \
--metrics \
--metrics-address 0.0.0.0 \
--metrics-port 8008 \
--metrics-allow-origin "*" \
--execution-endpoint "${ENGINE_API_URL}" \
--execution-jwt "${JWT_FILE_PATH}" \
${EXTRA_OPTS}
}
EXTRA_OPTS=$(add_flag_to_extra_opts_safely "${EXTRA_OPTS}" "--checkpoint-sync-url-timeout=300")
EXTRA_OPTS=$(add_flag_to_extra_opts_safely "${EXTRA_OPTS}" "--suggested-fee-recipient=${VALID_FEE_RECIPIENT}")

add_flag_to_extra_opts "--checkpoint-sync-url-timeout=300"
set_beacon_config_by_network "${NETWORK}" "${SUPPORTED_NETWORKS}"
set_checkpointsync_url "${CHECKPOINT_SYNC_FLAG}" "${CHECKPOINT_SYNC_URL}"
set_mevboost_flag "${MEVBOOST_FLAGS}" # MEV-Boost: https://chainsafe.github.io/lodestar/usage/mev-integration/
run_beacon
echo "[INFO - entrypoint] Starting beacon node..."

# shellcheck disable=SC2086
exec lighthouse \
--debug-level "${LOG_LEVEL}" \
--network "${NETWORK}" \
beacon_node \
--datadir="${DATA_DIR}" \
--http \
--http-allow-origin "*" \
--http-address 0.0.0.0 \
--http-port "${BEACON_API_PORT}" \
--port "${P2P_PORT}" \
--metrics \
--metrics-address 0.0.0.0 \
--metrics-port 8008 \
--metrics-allow-origin "*" \
--execution-endpoint "${ENGINE_URL}" \
--execution-jwt "${JWT_FILE_PATH}" ${CHECKPOINT_SYNC_FLAG} ${MEVBOOST_FLAG} ${EXTRA_OPTS}
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ services:
STAKER_SCRIPTS_VERSION: v0.1.0
BEACON_API_PORT: 3500
DATA_DIR: /root/.lighthouse
FEE_RECIPIENT: ""
volumes:
- "beacon-data:/root/.lighthouse"
restart: unless-stopped
# security_opt:
# - "seccomp:unconfined"
security_opt:
- "seccomp:unconfined"
environment:
LOG_LEVEL: info
CHECKPOINT_SYNC_URL: ""
Expand All @@ -25,8 +26,8 @@ services:
STAKER_SCRIPTS_VERSION: v0.1.0
DATA_DIR: /root/.lighthouse
restart: unless-stopped
# security_opt:
# - "seccomp:unconfined"
security_opt:
- "seccomp:unconfined"
environment:
LOG_LEVEL: info
GRAFFITI: validating_from_DAppNode
Expand Down
2 changes: 1 addition & 1 deletion setup-wizard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fields:
target:
type: environment
name: FEE_RECIPIENT
service: validator
service: [beacon-chain, validator]
title: Fee Recipient Address
description: >-
Fee Recipient is a feature that lets you specify a priority fee recipient address on your validator client instance and beacon node. Make sure this is an address you control. After The Merge, Execution Clients will begin depositing priority fees into this address whenever your validator proposes a new block.
Expand Down
8 changes: 5 additions & 3 deletions validator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ COPY entrypoint.sh /usr/local/bin

ENV VALIDATOR_PORT=3500 \
DATA_DIR=${DATA_DIR} \
NETWORK=${NETWORK} \
STAKER_SCRIPTS_URL=https://github.com/dappnode/staker-package-scripts/releases/download/${STAKER_SCRIPTS_VERSION}

ADD ${STAKER_SCRIPTS_URL}/consensus_tools.sh /etc/profile.d/

RUN chmod +rx /usr/local/bin/entrypoint.sh /etc/profile.d/consensus_tools.sh
RUN apt-get update && apt-get --yes install curl && apt-get clean && \
chmod +rx /usr/local/bin/entrypoint.sh /etc/profile.d/consensus_tools.sh

RUN apt-get update && apt-get install curl --yes && apt-get clean
# This env changes the variant
# Placed at the end to regenerate the least amount of layers
ENV NETWORK=${NETWORK}

ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
68 changes: 31 additions & 37 deletions validator/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,39 @@ MEVBOOST_FLAG="--builder-proposals"
SKIP_MEVBOOST_URL="true"
CLIENT="lighthouse"

handle_doppelganger() {
# If ENABLE_DOPPELGANGER != false, then enable it
if [ "${ENABLE_DOPPELGANGER}" != "false" ]; then
echo "[INFO - entrypoint] Doppelganger protection is enabled"
add_flag_to_extra_opts "--enable-doppelganger-protection"
else
echo "[WARN - entrypoint] Doppelganger protection is disabled"
fi
}

# shellcheck disable=SC1091
. /etc/profile

run_validator() {
echo "Starting validator..."
VALID_GRAFFITI=$(get_valid_graffiti "${GRAFFITI}")
VALID_FEE_RECIPIENT=$(get_valid_fee_recipient "${FEE_RECIPIENT}")
BEACON_API_URL=$(get_beacon_api_url "${NETWORK}" "${SUPPORTED_NETWORKS}" "${CLIENT}")
MEVBOOST_FLAG=$(get_mevboost_flag "${MEVBOOST_FLAG_KEY}" "${SKIP_MEVBOOST_URL}")

if [ "${ENABLE_DOPPELGANGER}" != "false" ]; then
echo "[INFO - entrypoint] Doppelganger protection is enabled"
EXTRA_OPTS=$(add_flag_to_extra_opts_safely "${EXTRA_OPTS}" "--enable-doppelganger-protection")
else
echo "[WARN - entrypoint] Doppelganger protection is disabled"
fi

# shellcheck disable=SC2086
exec lighthouse \
--debug-level="${LOG_LEVEL}" \
--network="${NETWORK}" \
validator \
--init-slashing-protection \
--datadir "${DATA_DIR}" \
--beacon-nodes "${BEACON_API_URL}" \
--graffiti="${GRAFFITI}" \
--http \
--http-address 0.0.0.0 \
--http-port "${VALIDATOR_PORT}" \
--http-allow-origin "*" \
--unencrypted-http-transport \
--metrics \
--metrics-address 0.0.0.0 \
--metrics-port 8008 \
--metrics-allow-origin "*" \
--suggested-fee-recipient="${FEE_RECIPIENT}" ${EXTRA_OPTS}
}
echo "[INFO - entrypoint] Starting validator service"

handle_doppelganger
format_graffiti
set_validator_config_by_network "${NETWORK}" "${SUPPORTED_NETWORKS}" "${CLIENT}"
set_mevboost_flag "${MEVBOOST_FLAG}" "${SKIP_MEVBOOST_URL}" # MEV-Boost: https://chainsafe.github.io/lodestar/usage/mev-integration/
run_validator
# shellcheck disable=SC2086
exec lighthouse \
--debug-level="${LOG_LEVEL}" \
--network="${NETWORK}" \
validator \
--init-slashing-protection \
--datadir "${DATA_DIR}" \
--beacon-nodes "${BEACON_API_URL}" \
--graffiti="${VALID_GRAFFITI}" \
--http \
--http-address 0.0.0.0 \
--http-port "${VALIDATOR_PORT}" \
--http-allow-origin "*" \
--unencrypted-http-transport \
--metrics \
--metrics-address 0.0.0.0 \
--metrics-port 8008 \
--metrics-allow-origin "*" \
--suggested-fee-recipient="${VALID_FEE_RECIPIENT}" ${MEVBOOST_FLAG} ${EXTRA_OPTS}

0 comments on commit b5fc76e

Please sign in to comment.