diff --git a/README.md b/README.md index 90ac2912..1cbaad17 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ To run the node using a supported client, you can use the following command: `CLIENT=supported_client docker compose up --build` Supported clients: - - reth (with Flashblocks support option, see [Reth Node README](./reth/README.md)) + - reth (runs vanilla node by default, Flashblocks mode enabled by providing RETH_FB_WEBSOCKET_URL, see [Reth Node README](./reth/README.md)) - geth - nethermind diff --git a/docker-compose.yml b/docker-compose.yml index 1ad38b79..fc7cebe1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,8 +13,6 @@ services: command: ["bash", "./execution-entrypoint"] volumes: - ${HOST_DATA_DIR}:/data - environment: - - NODE_TYPE=${NODE_TYPE:-vanilla} env_file: - ${NETWORK_ENV:-.env.mainnet} # Use .env.mainnet by default, override with .env.sepolia for testnet node: diff --git a/reth/Dockerfile b/reth/Dockerfile index ff54aab2..a0138937 100644 --- a/reth/Dockerfile +++ b/reth/Dockerfile @@ -13,20 +13,6 @@ RUN . /tmp/versions.env && git clone $OP_NODE_REPO --branch $OP_NODE_TAG --singl RUN . /tmp/versions.env && cd op-node && \ make VERSION=$OP_NODE_TAG op-node -FROM rust:1.88 AS reth - -WORKDIR /app - -COPY versions.env /tmp/versions.env - -RUN apt-get update && apt-get -y upgrade && apt-get install -y git libclang-dev pkg-config curl build-essential - -RUN . /tmp/versions.env && git clone $OP_RETH_REPO --branch $OP_RETH_TAG --single-branch . && \ - git switch -c branch-$OP_RETH_TAG && \ - bash -c '[ "$(git rev-parse HEAD)" = "$OP_RETH_COMMIT" ]' - -RUN cargo build --bin op-reth --profile maxperf --manifest-path crates/optimism/bin/Cargo.toml - FROM rust:1.88 AS reth-base WORKDIR /app @@ -41,7 +27,7 @@ RUN . /tmp/versions.env && git clone $BASE_RETH_NODE_REPO . && \ git checkout tags/$BASE_RETH_NODE_TAG && \ bash -c '[ "$(git rev-parse HEAD)" = "$BASE_RETH_NODE_COMMIT" ]' || (echo "Commit hash verification failed" && exit 1) -RUN cargo build --bin base-reth-node --release +RUN cargo build --bin base-reth-node --profile maxperf FROM ubuntu:24.04 @@ -53,8 +39,7 @@ RUN mkdir -p /var/log/supervisor WORKDIR /app COPY --from=op /app/op-node/bin/op-node ./ -COPY --from=reth /app/target/maxperf/op-reth ./ -COPY --from=reth-base /app/target/release/base-reth-node ./ +COPY --from=reth-base /app/target/maxperf/base-reth-node ./ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ./reth/reth-entrypoint ./execution-entrypoint COPY op-node-entrypoint . diff --git a/reth/README.md b/reth/README.md index 43908173..edf8e92c 100644 --- a/reth/README.md +++ b/reth/README.md @@ -1,35 +1,32 @@ # Running a Reth Node -This is a unified implementation of the Reth node setup that supports running both OP Reth and Base Reth with Flashblocks support. +This is an implementation of the Reth node setup that supports Flashblocks mode based on configuration. ## Setup - See hardware requirements mentioned in the master README -- For Base Reth mode: Access to a Flashblocks websocket endpoint (for `RETH_FB_WEBSOCKET_URL`) +- For Flashblocks mode: Access to a Flashblocks websocket endpoint (for `RETH_FB_WEBSOCKET_URL`) - We provide public websocket endpoints for mainnet and devnet, included in `.env.mainnet` and `.env.sepolia` ## Node Type Selection -Use the `NODE_TYPE` environment variable to select the implementation: +The node determines its mode based on the presence of the `RETH_FB_WEBSOCKET_URL` environment variable: -- `NODE_TYPE=vanilla` - OP Reth implementation (default) -- `NODE_TYPE=base` - Base L2 Reth implementation with Flashblocks support +- **Vanilla Mode** (default): When no `RETH_FB_WEBSOCKET_URL` is provided. +- **Flashblocks Mode**: When `RETH_FB_WEBSOCKET_URL` is provided. ## Running the Node The node follows the standard `docker-compose` workflow in the master README. ```bash -# Run OP Reth node +# To run Reth node with Flashblocks support, set RETH_FB_WEBSOCKET_URL in your .env file CLIENT=reth docker-compose up - -# Run Base L2 Reth node with Flashblocks support -NODE_TYPE=base CLIENT=reth docker-compose up ``` ## Testing Flashblocks RPC Methods -When running in Base mode (`NODE_TYPE=base`), you can query a pending block using the Flashblocks RPC: +When running in Flashblocks mode (with `RETH_FB_WEBSOCKET_URL` configured), you can query a pending block using the Flashblocks RPC: ```bash curl -X POST \ @@ -42,4 +39,4 @@ curl -X POST \ For a complete list of supported RPC methods, refer to: - [Standard Ethereum JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/) -- [Flashblocks RPC Methods](https://docs.base.org/chain/flashblocks#rpc-api) (Base mode only) +- [Flashblocks RPC Methods](https://docs.base.org/chain/flashblocks#rpc-api) (Flashblocks mode only) diff --git a/reth/reth-entrypoint b/reth/reth-entrypoint index 31e40e0f..59d533f7 100755 --- a/reth/reth-entrypoint +++ b/reth/reth-entrypoint @@ -10,30 +10,23 @@ METRICS_PORT="${METRICS_PORT:-6060}" DISCOVERY_PORT="${DISCOVERY_PORT:-30303}" P2P_PORT="${P2P_PORT:-30303}" ADDITIONAL_ARGS="" -NODE_TYPE="${NODE_TYPE:-base}" +BINARY="./base-reth-node" if [[ -z "${RETH_CHAIN:-}" ]]; then echo "expected RETH_CHAIN to be set" 1>&2 exit 1 fi -# Add Flashblocks support for base mode -if [[ "$NODE_TYPE" == "base" && -n "${RETH_FB_WEBSOCKET_URL:-}" ]]; then +# Enable Flashblocks support if websocket URL is provided +if [[ -n "${RETH_FB_WEBSOCKET_URL:-}" ]]; then ADDITIONAL_ARGS="--websocket-url=$RETH_FB_WEBSOCKET_URL" echo "Enabling Flashblocks support with endpoint: $RETH_FB_WEBSOCKET_URL" -fi - -# Select binary based on NODE_TYPE -if [[ "$NODE_TYPE" == "base" ]]; then - echo "Starting Base Reth node" - BINARY="./base-reth-node" else - echo "Starting OP Reth node" - BINARY="./op-reth" + echo "Running in vanilla node mode (no Flashblocks URL provided)" fi # Add pruning for base -if [[ "$NODE_TYPE" == "base" && "${RETH_PRUNING_ARGS+x}" = x ]]; then +if [[ "${RETH_PRUNING_ARGS+x}" = x ]]; then echo "Adding pruning arguments: $RETH_PRUNING_ARGS" ADDITIONAL_ARGS="$ADDITIONAL_ARGS $RETH_PRUNING_ARGS" fi