Skip to content
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

Add Nethermind #329

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fb6630c
feat: add nethermind to base
stdevMac Sep 27, 2024
2805814
feat: add supported clients to readme
stdevMac Sep 27, 2024
6d69a82
fix: add missing flags on nethermind config
stdevMac Sep 27, 2024
0c9c0d0
Update version
benaadams Sep 27, 2024
a66f08f
Update commit
benaadams Sep 28, 2024
d03608d
Update commit
benaadams Sep 29, 2024
1018327
Update nethermind/Dockerfile
benaadams Sep 29, 2024
bbab781
feat: add qemu to nethermind docker build
stdevMac Oct 2, 2024
d6a8829
Merge pull request #1 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
7188de1
fix: update release/1.29.0 commit
stdevMac Oct 2, 2024
0889f2b
Merge pull request #2 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
85c9f6b
fix: build on nethermind
stdevMac Oct 2, 2024
a926e31
Merge pull request #3 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
5140551
fix: build on nethermind, buildx command
stdevMac Oct 2, 2024
642d542
Merge pull request #4 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
f2feba6
fix: build on nethermind, labels breaking buildx
stdevMac Oct 2, 2024
70cc93e
Merge pull request #5 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
fa24cec
fix: build on nethermind, labels breaking buildx again
stdevMac Oct 2, 2024
ce8149c
Merge pull request #6 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
52f7c07
fix: build on nethermind, buildx
stdevMac Oct 2, 2024
94c66df
Merge pull request #7 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
4acf6e1
fix: build on nethermind, buildx labels
stdevMac Oct 2, 2024
2d1df56
Merge pull request #8 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
313cc0a
fix: build on nethermind, buildx labels, now as cmd
stdevMac Oct 2, 2024
b869967
Merge pull request #9 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
d5528dd
fix: build on nethermind, buildx labels
stdevMac Oct 2, 2024
9ffcd44
Merge pull request #10 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
b277f17
fix: update with sed targetarch
stdevMac Oct 2, 2024
09e009e
Merge pull request #11 from NethermindEth/feat/add_nethermind
stdevMac Oct 2, 2024
531d0e0
fix: upgrade build action on nethermind to use buildx
stdevMac Oct 4, 2024
2863682
Merge pull request #12 from NethermindEth/feat/add_nethermind
stdevMac Oct 4, 2024
8a051cd
fix: update dockerfile
stdevMac Oct 4, 2024
b340a7f
Merge pull request #14 from NethermindEth/feat/add_nethermind
stdevMac Oct 4, 2024
937e206
fix: update commit release 1.29.0
stdevMac Oct 4, 2024
9fd1617
Merge pull request #15 from NethermindEth/feat/add_nethermind
stdevMac Oct 4, 2024
0eaafdf
fix: update commit release 1.29.0 and solve docker build issues
benaadams Sep 27, 2024
7f028a0
fix: update pr action
stdevMac Oct 4, 2024
db7b3f4
feat: add workflow dispatch
stdevMac Oct 10, 2024
7f99fbe
feat: update nethermind to latest version
stdevMac Oct 10, 2024
af3625e
Merge remote-tracking branch 'neth/main' into feat/add_nethermind
stdevMac Oct 10, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
geth-data/
reth-data/
nethermind-data/
5 changes: 5 additions & 0 deletions .env.mainnet
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
RETH_CHAIN=base
RETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org
OP_GETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org
OP_SEQUENCER_HTTP=https://mainnet-sequencer.base.org

# [optional] used to enable geth stats:
# OP_GETH_ETH_STATS=nodename:secret@host:port
# OP_NETHERMIND_ETHSTATS_ENABLED=true
# OP_NETHERMIND_ETHSTATS_NODE_NAME=NethermindNode
# OP_NETHERMIND_ETHSTATS_ENDPOINT=ethstats_endpoint

# [required] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=https://1rpc.io/eth
Expand Down Expand Up @@ -42,4 +46,5 @@ OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
# To enable snap sync, uncomment and set the env vars below:
# OP_NODE_SYNCMODE=execution-layer
# OP_GETH_BOOTNODES=enode://87a32fd13bd596b2ffca97020e31aef4ddcc1bbd4b95bb633d16c1329f654f34049ed240a36b449fda5e5225d70fe40bc667f53c304b71f8e68fc9d448690b51@3.231.138.188:30301,enode://ca21ea8f176adb2e229ce2d700830c844af0ea941a1d8152a9513b966fe525e809c3a6c73a2c18a12b74ed6ec4380edf91662778fe0b79f6a591236e49e176f9@184.72.129.189:30301,enode://acf4507a211ba7c1e52cdf4eef62cdc3c32e7c9c47998954f7ba024026f9a6b2150cd3f0b734d9c78e507ab70d59ba61dfe5c45e1078c7ad0775fb251d7735a2@3.220.145.177:30301,enode://8a5a5006159bf079d06a04e5eceab2a1ce6e0f721875b2a9c96905336219dbe14203d38f70f3754686a6324f786c2f9852d8c0dd3adac2d080f4db35efc678c5@3.231.11.52:30301,enode://cdadbe835308ad3557f9a1de8db411da1a260a98f8421d62da90e71da66e55e98aaa8e90aa7ce01b408a54e4bd2253d701218081ded3dbe5efbbc7b41d7cef79@54.198.153.150:30301
# OP_NETHERMIND_BOOTNODES=enode://87a32fd13bd596b2ffca97020e31aef4ddcc1bbd4b95bb633d16c1329f654f34049ed240a36b449fda5e5225d70fe40bc667f53c304b71f8e68fc9d448690b51@3.231.138.188:30301,enode://ca21ea8f176adb2e229ce2d700830c844af0ea941a1d8152a9513b966fe525e809c3a6c73a2c18a12b74ed6ec4380edf91662778fe0b79f6a591236e49e176f9@184.72.129.189:30301,enode://acf4507a211ba7c1e52cdf4eef62cdc3c32e7c9c47998954f7ba024026f9a6b2150cd3f0b734d9c78e507ab70d59ba61dfe5c45e1078c7ad0775fb251d7735a2@3.220.145.177:30301,enode://8a5a5006159bf079d06a04e5eceab2a1ce6e0f721875b2a9c96905336219dbe14203d38f70f3754686a6324f786c2f9852d8c0dd3adac2d080f4db35efc678c5@3.231.11.52:30301,enode://cdadbe835308ad3557f9a1de8db411da1a260a98f8421d62da90e71da66e55e98aaa8e90aa7ce01b408a54e4bd2253d701218081ded3dbe5efbbc7b41d7cef79@54.198.153.150:30301
# OP_GETH_SYNCMODE=snap
5 changes: 5 additions & 0 deletions .env.sepolia
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
RETH_CHAIN=base-sepolia
RETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org
OP_GETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org
OP_SEQUENCER_HTTP=https://sepolia-sequencer.base.org

# [optional] used to enable geth stats:
# OP_GETH_ETH_STATS=nodename:secret@host:port
# OP_NETHERMIND_ETHSTATS_ENABLED=true
# OP_NETHERMIND_ETHSTATS_NODE_NAME=NethermindNode
# OP_NETHERMIND_ETHSTATS_ENDPOINT=ethstats_endpoint

# [required] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=https://rpc.sepolia.org
Expand Down Expand Up @@ -42,4 +46,5 @@ OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
# To enable snap sync, set env vars below:
# OP_NODE_SYNCMODE=execution-layer
# OP_GETH_BOOTNODES=enode://548f715f3fc388a7c917ba644a2f16270f1ede48a5d88a4d14ea287cc916068363f3092e39936f1a3e7885198bef0e5af951f1d7b1041ce8ba4010917777e71f@18.210.176.114:30301,enode://6f10052847a966a725c9f4adf6716f9141155b99a0fb487fea3f51498f4c2a2cb8d534e680ee678f9447db85b93ff7c74562762c3714783a7233ac448603b25f@107.21.251.55:30301
# OP_NETHERMIND_BOOTNODES=enode://548f715f3fc388a7c917ba644a2f16270f1ede48a5d88a4d14ea287cc916068363f3092e39936f1a3e7885198bef0e5af951f1d7b1041ce8ba4010917777e71f@18.210.176.114:30301,enode://6f10052847a966a725c9f4adf6716f9141155b99a0fb487fea3f51498f4c2a2cb8d534e680ee678f9447db85b93ff7c74562762c3714783a7233ac448603b25f@107.21.251.55:30301
# OP_GETH_SYNCMODE=snap
33 changes: 33 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
GETH_DEPRECATED_IMAGE_NAME: node
GETH_IMAGE_NAME: node-geth
RETH_IMAGE_NAME: node-reth
NETHERMIND_IMAGE_NAME: node-nethermind

jobs:
geth:
Expand Down Expand Up @@ -87,3 +88,35 @@ jobs:
build-args: |
FEATURES=${{ matrix.features }}
platforms: ${{ matrix.arch }}
nethermind:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Log into the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.NAMESPACE }}/${{ env.NETHERMIND_IMAGE_NAME }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push the Docker image
uses: docker/build-push-action@v4
with:
context: .
file: nethermind/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
20 changes: 20 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,23 @@ jobs:
build-args: |
FEATURES=${{ matrix.features }}
platforms: ${{ matrix.arch }}
nethermind:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ linux/amd64, linux/arm64 ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the Docker image
uses: docker/build-push-action@v4
with:
context: .
file: nethermind/Dockerfile
push: false
platforms: ${{ matrix.arch }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea/
/geth-data/
/reth-data/
/nethermind-data/
.DS_Store
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ If you encounter problems with your node, please open a [GitHub issue](https://g
docker compose up --build
```

> [!NOTE]
> To run the node using a supported client, you can use the following command:
> `CLIENT=supported_client docker compose up --build`
>
> Supported clients:
> - geth
> - reth
> - nethermind

4. You should now be able to `curl` your Base node:

```
Expand Down
49 changes: 49 additions & 0 deletions nethermind/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM golang:1.21 AS op

WORKDIR /app

ENV REPO=https://github.com/ethereum-optimism/optimism.git
ENV VERSION=v1.9.1
ENV COMMIT=4797ddb70e05d4952685bad53e608cb5606284e6
RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \
git switch -c branch-$VERSION && \
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'

RUN cd op-node && \
make VERSION=$VERSION op-node

FROM mcr.microsoft.com/dotnet/sdk:8.0-noble AS build

ARG BUILD_CONFIG=release
ARG TARGETARCH

WORKDIR /app

ENV REPO=https://github.com/NethermindEth/nethermind.git
ENV VERSION=1.29.0
ENV COMMIT=917f5349517118bf5c73c362c3902d61e68e5b40
RUN git clone $REPO --branch release/$VERSION --single-branch . && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we depend on a tagged commit rather than a branch (perhaps when the 1.29.0 release is tagged)? Otherwise new commits on that branch will break the build.

Copy link
Contributor

@benaadams benaadams Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, shipping this week likely

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RUN git clone $REPO --branch release/$VERSION --single-branch . && \
RUN git clone $REPO --branch $VERSION --single-branch . && \

to switch to tag rather than branch

git switch -c branch-$VERSION && \
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'

RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \
dotnet publish src/Nethermind/Nethermind.Runner -c $BUILD_CONFIG -a $arch -o /publish --sc false


FROM mcr.microsoft.com/dotnet/aspnet:8.0-noble

RUN apt-get update && \
apt-get install -y jq curl supervisor && \
rm -rf /var/lib/apt/lists

RUN mkdir -p /var/log/supervisor

WORKDIR /app

COPY --from=build /publish ./
COPY --from=op /app/op-node/bin/op-node ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY nethermind/nethermind-entrypoint ./execution-entrypoint
COPY op-node-entrypoint .

CMD ["/usr/bin/supervisord"]
63 changes: 63 additions & 0 deletions nethermind/nethermind-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
set -eu

# Default configurations
NETHERMIND_DATA_DIR=${NETHERMIND_DATA_DIR:-/data}
NETHERMIND_LOG_LEVEL=${NETHERMIND_LOG_LEVEL:-Info}
NETWORK=${NETWORK:-mainnet}

RPC_PORT="${RPC_PORT:-8545}"
WS_PORT="${WS_PORT:-8546}"
AUTHRPC_PORT="${AUTHRPC_PORT:-8551}"
METRICS_PORT="${METRICS_PORT:-6060}"
DISCOVERY_PORT="${DISCOVERY_PORT:-30303}"

JWT_SECRET_FILE=${JWT_SECRET_FILE:-/tmp/jwt/jwtsecret}
ADDITIONAL_ARGS=""

# Check if required variables are set
if [[ -z "$NETWORK" ]]; then
echo "Expected NETWORK to be set" 1>&2
exit 1
fi

# Create necessary directories
mkdir -p "$NETHERMIND_DATA_DIR"

# Write the JWT secret
if [[ -z "${OP_NODE_L2_ENGINE_AUTH_RAW:-}" ]]; then
echo "Expected OP_NODE_L2_ENGINE_AUTH_RAW to be set" 1>&2
exit 1
fi
echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH"

# Additional arguments based on environment variables
if [ "${OP_NETHERMIND_BOOTNODES+x}" = x ]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --Network.Bootnodes=$OP_NETHERMIND_BOOTNODES"
fi

if [[ -n "${OP_NETHERMIND_ETHSTATS_ENABLED:-}" ]]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --EthStats.Enabled=$OP_NETHERMIND_ETHSTATS_ENABLED"
fi

if [[ -n "${OP_NETHERMIND_ETHSTATS_ENDPOINT:-}" ]]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --EthStats.NodeName=${OP_NETHERMIND_ETHSTATS_NODE_NAME:-NethermindNode} --EthStats.Endpoint=$OP_NETHERMIND_ETHSTATS_ENDPOINT"
fi

# Execute Nethermind
exec ./nethermind \
--config="$OP_NODE_NETWORK" \
--datadir="$NETHERMIND_DATA_DIR" \
--Optimism.SequencerUrl=$OP_SEQUENCER_HTTP \
--log="$NETHERMIND_LOG_LEVEL" \
--JsonRpc.Enabled=true \
--JsonRpc.Host=0.0.0.0 \
--JsonRpc.WebSocketsPort="$WS_PORT" \
--JsonRpc.Port="$RPC_PORT" \
--JsonRpc.JwtSecretFile="$OP_NODE_L2_ENGINE_AUTH" \
--JsonRpc.EngineHost=0.0.0.0 \
--JsonRpc.EnginePort="$AUTHRPC_PORT" \
--HealthChecks.Enabled=true \
--Metrics.Enabled=true \
--Metrics.ExposePort="$METRICS_PORT" \
$ADDITIONAL_ARGS
Loading