Repository navigation
fix(p2p): add p2p.announce_addresses to override advertised addresses - #3510
Conversation
Nodes running in containers without host networking (or behind NAT) advertised only their loopback/Docker bridge addresses, so remote peers could not dial them. The new option installs a libp2p AddrsFactory that replaces the auto-detected addresses with the configured multiaddrs for identify, the DHT and namespace discovery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
A value made only of separators (e.g. ",") passed the empty-string guard and installed an AddrsFactory returning no addresses, so the node advertised nothing. Also make the test order-independent (libp2p sorts the factory output), align the p2p README table and link the PR in the changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3510 +/- ##
==========================================
+ Coverage 69.35% 69.37% +0.02%
==========================================
Files 122 122
Lines 12219 12237 +18
==========================================
+ Hits 8474 8489 +15
- Misses 3745 3748 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Overview
ev-node gives operators no way to choose the P2P addresses it advertises. celestia-node has
AnnounceAddressesand ev-reth has--nat extip:<IP>. A containerized ev-node that doesn't use host networking advertises only its loopback and Docker bridge addresses, so other peers can't connect to it. Right now, 6 of the 10 nodes announcing the eden-mainnet namespace advertise only loopback, Docker bridge or CGNAT addresses, and so do 3 of the 6 testnet nodes.This PR adds
p2p.announce_addresses(flag--evnode.p2p.announce_addresses), a comma-separated list of multiaddrs. When it's set,listen()installs a libp2pAddrsFactorythat replaces the addresses detected from the network interfaces with the configured ones. libp2p uses that list everywhere it reports the node's addresses (identify, the DHT, namespace discovery) and so doesGetNetworkInfo(/net_info,p2p info).TranslateAddresses, so values must be multiaddrs. Both/ip4/...and/dns4/...work.Docker example: publish the port with
-p 7676:7676and set--evnode.p2p.announce_addresses /ip4/<public-ip>/tcp/7676.Not included
no_announce_addressesfilter like celestia-node's.Testing
TestAnnounceAddressescovers the replacement,GetNetworkInfooutput and an invalid value. The config flag test is updated (expected flag count 91 → 92).go test ./pkg/config/... ./pkg/cmd/... ./pkg/p2p/...passes.TestDiscoveryfailed once in a combined run but passed 10/10 on both this branch and the base commit, so it looks flaky.🤖 Generated with Claude Code
Summary by CodeRabbit