feat: make max outbound peers configurable via environment variable RETH_MAX_OUTBOUND_PEERS#1125
Open
Kewe63 wants to merge 3 commits into
Open
feat: make max outbound peers configurable via environment variable RETH_MAX_OUTBOUND_PEERS#1125Kewe63 wants to merge 3 commits into
Kewe63 wants to merge 3 commits into
Conversation
Collaborator
🟡 Heimdall Review Status
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Introduces a new environment variable
RETH_MAX_OUTBOUND_PEERSto configure the--max-outbound-peersflag passed tobase-reth-nodein the execution entrypoint. When unset, the variable falls back to100, 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 gossipsubSend Queue fullwarnings seen on low-peer nodes.Motivation
The warning
Send Queue full. Could not send IHaveinlibp2p_gossipsuboccurs when a peer's send buffer fills faster than it can be drained. With only 1–3 active peers, all gossip traffic (includingIHaveannouncements 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-nodewhere runtime flags are exposed via environment variables.Changes
Modified:
/app/execution-entrypoint(copied to image at build time)No other files were touched. The change is purely additive and fully backward-compatible.
Test Results
1. Default behavior (variable unset)
✅ Correctly falls back to
100when the variable is empty or unset.2. Custom value (e.g., 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
RETH_MAX_OUTBOUND_PEERS=200accepts the flag without errors (verified viadocker top/psinside container).Verification Steps for Reviewers
1. Apply and start:
2. Verify default:
3. Verify custom value:
4. Observe gossipsub logs: With a higher peer limit and sufficient open ports,
Send Queue fullwarning frequency should decrease.Backward Compatibility
RETH_MAX_OUTBOUND_PEERSis unset, behavior is identical to the previous version (--max-outbound-peers=100).