-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add announce_ip config override (Prysm --p2p-host-ip equivalent) #108
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
Open
ygd58
wants to merge
4
commits into
getoptimum:main
Choose a base branch
from
ygd58:feat/announce-ip-override
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a0a1f32
feat: add announce_ip config override (Prysm --p2p-host-ip equivalent)
ygd58 9db7e67
fix: address CodeRabbit review on #108
ygd58 e4a15c6
fix: address remaining CodeRabbit nitpicks on #108
ygd58 9572389
fix: correct misleading AnnounceIP comment wording on #108
ygd58 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,12 +152,33 @@ func (s *Service) RegisterAndGetMumP2PPeers() ([]string, error) { | |
| func (s *Service) predictMumP2PAddrInfo() (peerInfo peer.AddrInfo, publicIP string, err error) { | ||
| publicIPV4, publicIPV6, err := commonnet.GetExternalIPs() | ||
| if err != nil { | ||
| s.log.Error("failed to get public IP, falling back to interface IP", err) | ||
| publicIPV4, err = commonnet.ExternalIP() | ||
| if err != nil { | ||
| return peer.AddrInfo{}, "", fmt.Errorf("unable to get any IP address: %w", err) | ||
| if s.cfg.AnnounceIP == "" { | ||
| s.log.Error("failed to get public IP, falling back to interface IP", err) | ||
| publicIPV4, err = commonnet.ExternalIP() | ||
| if err != nil { | ||
| return peer.AddrInfo{}, "", fmt.Errorf("unable to get any IP address: %w", err) | ||
| } | ||
| } else { | ||
| // Autodetection (and its interface-inspection fallback) both | ||
| // only matter when we don't already have an operator-supplied | ||
| // address. Continue without IPv6 rather than failing startup. | ||
| s.log.Info("autodetection failed but announce_ip is configured, continuing without IPv6", | ||
| logger.WithString("autodetect_error", err.Error()), | ||
| ) | ||
| publicIPV6 = "" | ||
| } | ||
| } | ||
| if s.cfg.AnnounceIP != "" { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Use When 🤖 Prompt for AI Agents |
||
| // Must match the override used when the mump2p host actually starts | ||
| // (setupMumP2PHost / mum_p2p.NewNode) - this prediction is registered | ||
| // with the bootstrap server ahead of time, and a mismatch here would | ||
| // have the gateway announce one address to bootstrap and then bind/ | ||
| // advertise a different one once the host is up. | ||
| s.log.Info("using configured announce_ip override for bootstrap prediction IPv4, autodetected IPv6 (if any) is kept", | ||
| logger.WithString("announce_ip", s.cfg.AnnounceIP), | ||
| ) | ||
| publicIPV4 = s.cfg.AnnounceIP | ||
| } | ||
| s.log.Info("public IP address detected from prediction", | ||
| logger.WithString("public_ip", publicIPV4), | ||
| logger.WithString("public_ip_v6", publicIPV6), | ||
|
|
||
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Apply
AnnounceIPbefore external-IP discovery insetupLibP2PHost. When it is set,commonnet.GetExternalIPs()currently runs first and its error aborts host creation. Skip autodetection and use the configured address so it reaches the libp2p advertisement factory. Leave bootstrap prediction andmum_p2p.NewNodeunchanged.🤖 Prompt for AI Agents