Skip to content

feat: make max outbound peers configurable via environment variable RETH_MAX_OUTBOUND_PEERS#1125

Open
Kewe63 wants to merge 3 commits into
base:mainfrom
Kewe63:fix-gossipsub-send-queue
Open

feat: make max outbound peers configurable via environment variable RETH_MAX_OUTBOUND_PEERS#1125
Kewe63 wants to merge 3 commits into
base:mainfrom
Kewe63:fix-gossipsub-send-queue

Conversation

@Kewe63
Copy link
Copy Markdown

@Kewe63 Kewe63 commented Jun 6, 2026

Description

Introduces a new environment variable RETH_MAX_OUTBOUND_PEERS to configure the --max-outbound-peers flag passed to base-reth-node in the execution entrypoint. When unset, the variable falls back to 100, preserving existing behavior. This allows operators to tune the outbound peer limit at runtime without rebuilding the Docker image or modifying the entrypoint script, and directly addresses the libp2p gossipsub Send Queue full warnings seen on low-peer nodes.


Motivation

The warning Send Queue full. Could not send IHave in libp2p_gossipsub occurs when a peer's send buffer fills faster than it can be drained. With only 1–3 active peers, all gossip traffic (including IHave announcements per ~2-second block) is funneled through the same few connections, quickly exhausting the default send queue (~512 messages/peer).

Increasing the outbound peer ceiling distributes gossip load across more connections, reducing per-peer queue pressure. This change mirrors the upstream pattern in reth/base-reth-node where runtime flags are exposed via environment variables.


Changes

Modified: /app/execution-entrypoint (copied to image at build time)

- --max-outbound-peers=100 \
+ --max-outbound-peers=${RETH_MAX_OUTBOUND_PEERS:-100} \

No other files were touched. The change is purely additive and fully backward-compatible.


Test Results

1. Default behavior (variable unset)

$ RETH_MAX_OUTBOUND_PEERS= BASE_NODE_L2_ENGINE_AUTH_RAW=* RETH_CHAIN=base \
  BASE_NODE_NETWORK=base BASE_NODE_L2_ENGINE_RPC=http://127.0.0.1:8551 \
  /app/execution-entrypoint 2>&1 | grep max-outbound
--max-outbound-peers=100

✅ Correctly falls back to 100 when the variable is empty or unset.

2. Custom value (e.g., 250)

$ RETH_MAX_OUTBOUND_PEERS=250 BASE_NODE_L2_ENGINE_AUTH_RAW=* RETH_CHAIN=base \
  BASE_NODE_NETWORK=base BASE_NODE_L2_ENGINE_RPC=http://127.0.0.1:8551 \
  /app/execution-entrypoint 2>&1 | grep max-outbound
--max-outbound-peers=250

✅ Custom value is passed through correctly.

3. No regression in other flags
The rest of the command line (logging, WebSocket, HTTP, auth RPC, metrics, discovery ports) is unchanged, verified by diffing the full generated command with and without the variable.

4. Build & runtime

  • Docker image builds successfully with the modified entrypoint.
  • A container started with RETH_MAX_OUTBOUND_PEERS=200 accepts the flag without errors (verified via docker top / ps inside container).

Verification Steps for Reviewers

1. Apply and start:

git checkout fix-gossipsub-send-queue
docker compose up --build -d

2. Verify default:

docker exec <execution-container> ps -o args | grep max-outbound-peers
# Expected: --max-outbound-peers=100

3. Verify custom value:

RETH_MAX_OUTBOUND_PEERS=250 docker compose up --build -d execution
docker exec <execution-container> ps -o args | grep max-outbound-peers
# Expected: --max-outbound-peers=250

4. Observe gossipsub logs: With a higher peer limit and sufficient open ports, Send Queue full warning frequency should decrease.


Backward Compatibility

  • If RETH_MAX_OUTBOUND_PEERS is unset, behavior is identical to the previous version (--max-outbound-peers=100).
  • No configuration files or CI workflows require updates.

@cb-heimdall
Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants