-
Notifications
You must be signed in to change notification settings - Fork 272
Support Nimbus Verified Proxy #2474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Test Nimbus Verified Proxy | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| types: [opened, synchronize, labeled, unlabeled] | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| test-nimbus-proxy: | ||
| if: | | ||
| contains(github.event.pull_request.labels.*.name, 'test-nimbus-proxy') || | ||
| contains(github.event.pull_request.labels.*.name, 'test-all') || | ||
| github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Set up Docker buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Create .env file | ||
| run: cp default.env .env | ||
| - name: Set Nimbus Verified Proxy | ||
| run: | | ||
| source ./.github/helper.sh | ||
| NETWORK=mainnet | ||
| var=NETWORK | ||
| set_value_in_env | ||
| COMPOSE_FILE=nimbus-vp.yml | ||
| var=COMPOSE_FILE | ||
| set_value_in_env | ||
| RPC_URL=wss://ethereum-rpc.publicnode.com | ||
| var=RPC_URL | ||
| set_value_in_env | ||
| CL_NODE=https://ethereum.operationsolarstorm.org/ | ||
| var=CL_NODE | ||
| set_value_in_env | ||
| - name: Start Nimbus Verified Proxy | ||
| run: ./ethd up | ||
| - name: Pause for 30 seconds | ||
| run: sleep 30 | ||
| - name: Test Nimbus Verified Proxy | ||
| run: ./.github/check-service.sh rpc-proxy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| x-logging: &logging | ||
| logging: | ||
| driver: json-file | ||
| options: | ||
| max-size: 100m | ||
| max-file: "3" | ||
| tag: '{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}' | ||
|
|
||
| services: | ||
| rpc-proxy: | ||
| restart: "unless-stopped" | ||
| build: | ||
| context: ./nimbus-vp | ||
| dockerfile: ${NIMVP_DOCKERFILE} | ||
| args: | ||
| - BUILD_TARGET=${NIMVP_SRC_BUILD_TARGET:-master} | ||
| - SRC_REPO=${NIMVP_SRC_REPO:-https://github.com/status-im/nimbus-eth1} | ||
| - DOCKER_TAG=${NIMVP_DOCKER_TAG:-latest} | ||
| - DOCKER_REPO=${NIMVP_DOCKER_REPO:-statusim/nimbus-verified-proxy} | ||
| stop_grace_period: 30s | ||
| image: nimbus-vp:local | ||
| pull_policy: never | ||
| user: user | ||
| environment: | ||
| - CL_NODE=${CL_NODE} | ||
| volumes: | ||
| - nimbus-vp-data:/var/lib/nimbus | ||
| - /etc/localtime:/etc/localtime:ro | ||
| networks: | ||
| default: | ||
| aliases: | ||
| # This allows multiple Eth Docker stacks all connected to the same bridge network | ||
| - ${RPC_PROXY_ALIAS:-default-rpc-proxy} | ||
| <<: *logging | ||
| entrypoint: | ||
| - docker-entrypoint.sh | ||
| - nimbus_verified_proxy | ||
| - --data-dir=/var/lib/nimbus | ||
| - --network=${NETWORK} | ||
| - --execution-api-url=${RPC_URL} | ||
| - --listen-url=http://0.0.0.0:${PROXY_RPC_PORT:-48545} | ||
| - --listen-url=ws://0.0.0.0:${PROXY_WS_PORT:-48546} | ||
| - --beacon-api-url=${CL_NODE} | ||
| - --log-level=${LOG_LEVEL} | ||
|
|
||
| volumes: | ||
| nimbus-vp-data: | ||
|
|
||
| networks: | ||
| default: | ||
| enable_ipv6: ${IPV6:-false} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # hadolint global ignore=DL3007,DL3008,DL3059 | ||
| ARG DOCKER_TAG=latest | ||
| ARG DOCKER_REPO=statusim/nimbus-verified-proxy | ||
|
|
||
| FROM ${DOCKER_REPO}:${DOCKER_TAG} | ||
|
|
||
| # Included here to avoid build-time complaints | ||
| ARG BUILD_TARGET | ||
| ARG SRC_REPO | ||
|
|
||
| ARG USER=user | ||
| ARG UID=11001 | ||
|
|
||
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| tzdata \ | ||
| gosu \ | ||
| adduser \ | ||
| bash \ | ||
| curl \ | ||
| jq \ | ||
| && gosu nobody true \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # See https://stackoverflow.com/a/55757473/12429735RUN | ||
| RUN adduser \ | ||
| --disabled-password \ | ||
| --gecos "" \ | ||
| --home "/nonexistent" \ | ||
| --shell "/usr/sbin/nologin" \ | ||
| --no-create-home \ | ||
| --uid "${UID}" \ | ||
| "${USER}" | ||
|
|
||
| RUN mkdir -p /var/lib/nimbus && chown -R ${USER}:${USER} /var/lib/nimbus && chmod 700 /var/lib/nimbus | ||
|
|
||
| RUN cp /home/user/nimbus-verified-proxy/build/nimbus_verified_proxy /usr/local/bin/ && chown ${USER}:${USER} /usr/local/bin/nimbus_verified_proxy | ||
| # Cannot assume buildkit, hence no chmod | ||
| COPY --chown=${USER}:${USER} ./docker-entrypoint.sh /usr/local/bin/ | ||
| # Belt and suspenders | ||
| RUN chmod -R 755 /usr/local/bin/* | ||
|
|
||
| USER ${USER} | ||
|
|
||
| ENTRYPOINT ["nimbus_verified_proxy"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # hadolint global ignore=DL3007,DL3008,DL3059,DL4006 | ||
| # Build Nimbus verified proxy in a stock debian container | ||
| FROM debian:trixie-slim AS builder | ||
|
|
||
| # Included here to avoid build-time complaints | ||
| ARG DOCKER_TAG | ||
| ARG DOCKER_REPO | ||
|
|
||
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| ca-certificates \ | ||
| git | ||
|
|
||
| ARG BUILD_TARGET | ||
| ARG SRC_REPO | ||
|
|
||
| WORKDIR /usr/src | ||
|
|
||
| ARG SRC_DIR=nimbus-eth1 | ||
| RUN bash -eo pipefail <<'EOF' | ||
| git clone "$SRC_REPO" "$SRC_DIR" | ||
| cd "$SRC_DIR" | ||
| git config advice.detachedHead false | ||
| git fetch --all --tags | ||
| CLEANED=$(echo "$BUILD_TARGET" | sed 's/\$\$(/$(/g') | ||
| TARGET=$(eval echo "$CLEANED") | ||
| if [[ "$TARGET" =~ pr-.+ ]]; then | ||
| git fetch origin pull/$(echo "$TARGET" | cut -d '-' -f 2)/head:build-pr | ||
| git checkout build-pr | ||
| else | ||
| git checkout "$TARGET" | ||
| fi | ||
| make -j$(nproc) update | ||
| make -j$(nproc) nimbus_verified_proxy | ||
| EOF | ||
|
|
||
|
|
||
| # Pull all binaries into a second stage deploy debian container | ||
| FROM debian:trixie-slim | ||
|
|
||
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| tzdata \ | ||
| gosu \ | ||
| adduser \ | ||
| bash \ | ||
| curl \ | ||
| jq \ | ||
| && gosu nobody true \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| ARG USER=user | ||
| ARG UID=11001 | ||
|
|
||
| # See https://stackoverflow.com/a/55757473/12429735RUN | ||
| RUN adduser \ | ||
| --disabled-password \ | ||
| --gecos "" \ | ||
| --home "/nonexistent" \ | ||
| --shell "/usr/sbin/nologin" \ | ||
| --no-create-home \ | ||
| --uid "${UID}" \ | ||
| "${USER}" | ||
|
|
||
| RUN mkdir -p /var/lib/nimbus && chown -R ${USER}:${USER} /var/lib/nimbus && chmod 700 /var/lib/nimbus | ||
|
|
||
| # Cannot assume buildkit, hence no chmod | ||
| COPY --from=builder --chown=${USER}:${USER} /usr/src/nimbus-eth1/build/nimbus_verified_proxy /usr/local/bin/ | ||
| COPY --chown=${USER}:${USER} ./docker-entrypoint.sh /usr/local/bin/ | ||
| # Belt and suspenders | ||
| RUN chmod -R 755 /usr/local/bin/* | ||
|
|
||
| USER ${USER} | ||
|
|
||
| ENTRYPOINT ["nimbus_verified_proxy"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [[ "$(id -u)" -eq 0 ]]; then | ||
| chown -R user:user /var/lib/nimbus | ||
| exec gosu user docker-entrypoint.sh "$@" | ||
| fi | ||
|
|
||
|
|
||
| while true; do | ||
| if curl -s -m 5 "${CL_NODE}" &> /dev/null; then | ||
| echo "Consensus Layer node is up, fetching trusted block root" | ||
| break | ||
| else | ||
| echo "Waiting for Consensus Layer node to be reachable..." | ||
| sleep 5 | ||
| fi | ||
| done | ||
|
|
||
| set +e | ||
| root=$(curl -s -f -m 30 "${CL_NODE}/eth/v1/beacon/headers/finalized" | jq -r '.data.root') | ||
| exitstatus=$? | ||
yorickdowne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set -e | ||
|
|
||
| if [[ "${exitstatus}" -ne 0 ]]; then | ||
| echo "Failed to fetch trusted block root from ${CL_NODE}" | ||
| echo "Please verify it's reachable" | ||
| sleep 30 | ||
| exit 1 | ||
| fi | ||
|
|
||
| __trusted_root="--trusted-block-root=${root}" | ||
| i=0 | ||
| # Verified proxy can get "stuck" if light client bootstrap isn't ready. Check for it here | ||
| while true; do | ||
| if curl -s -f -m 30 "${CL_NODE}/eth/v1/beacon/light_client/bootstrap/${root}" &> /dev/null; then | ||
| echo "Consensus Layer node has light client bootstrap available, starting Nimbus Verified Proxy" | ||
| break | ||
| else | ||
| ((++i)) | ||
| if [[ "$i" -eq 4 ]]; then | ||
| echo "Failed to get light client bootstrap data four times in a row. Waiting for epoch switchover to try with fresh block root" | ||
| secs=370 # Plus the 15 we already waited, 385. Epoch is 384 | ||
| while [ $secs -gt 0 ]; do | ||
| echo "Waiting for $secs seconds" | ||
| sleep 10 | ||
| ((secs -= 10)) || true # To protect against "falsy" evaluation when secs==10, in some version of bash | ||
| done | ||
| exit 1 | ||
| else | ||
| echo "Waiting for Consensus Layer node to have light client bootstrap data..." | ||
| sleep 5 | ||
| fi | ||
| fi | ||
| done | ||
|
|
||
| # Word splitting is desired for the command line parameters | ||
| # shellcheck disable=SC2086 | ||
| exec "$@" ${__trusted_root} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # To be used in conjunction with nimbus-vp.yml | ||
| services: | ||
| rpc-proxy: | ||
| ports: | ||
| - ${SHARE_IP:-}:${PROXY_RPC_PORT}:${PROXY_RPC_PORT:-48545}/tcp | ||
| - ${SHARE_IP:-}:${PROXY_WS_PORT}:${PROXY_WS_PORT:-48546}/tcp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # To be used in conjunction with nimbus-vp.yml | ||
| services: | ||
| rpc-proxy: | ||
| labels: | ||
| - traefik.enable=true | ||
| - traefik.http.routers.${PROXY_RPC_HOST:-rpc}.service=${PROXY_RPC_HOST:-rpc} | ||
| - traefik.http.routers.${PROXY_RPC_HOST:-rpc}.entrypoints=websecure | ||
| - traefik.http.routers.${PROXY_RPC_HOST:-rpc}.rule=Host(`${PROXY_RPC_HOST:-rpc}.${DOMAIN}`) | ||
| - traefik.http.routers.${PROXY_RPC_HOST:-rpc}.tls.certresolver=letsencrypt | ||
| - traefik.http.services.${PROXY_RPC_HOST:-rpc}.loadbalancer.server.port=${PROXY_RPC_PORT:-48545} | ||
| - traefik.http.routers.${PROXY_WS_HOST:-ws}.service=${PROXY_WS_HOST:-ws} | ||
| - traefik.http.routers.${PROXY_WS_HOST:-ws}.entrypoints=websecure | ||
| - traefik.http.routers.${PROXY_WS_HOST:-ws}.rule=Host(`${PROXY_WS_HOST:-ws}.${DOMAIN}`) | ||
| - traefik.http.routers.${PROXY_WS_HOST:-ws}.tls.certresolver=letsencrypt | ||
| - traefik.http.services.${PROXY_WS_HOST:-ws}.loadbalancer.server.port=${PROXY_WS_PORT:-48546} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.