Skip to content
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

config: p2p, fix parsing HostDNS #1995

Merged
merged 3 commits into from
Jan 24, 2025
Merged

Conversation

iurii-ssv
Copy link
Contributor

Originally this issue was raised by Kraken team, namely they couldn't set HostDNS such that it would work - it would fail with:

2025-01-21T12:58:53.223889Z	FATAL	failed to setup network	{"error": "could not create p2p host: cannot specify multiple address factories", "errorVerbose": "cannot specify multiple address factories\ncould not create p2p host\ngithub.com/ssvlabs/ssv/network/p2p.(*p2pNetwork).SetupHost\n\t/go/src/github.com/ssvlabs/ssv/network/p2p/p2p_setup.go:136\ngithub.com/ssvlabs/ssv/network/p2p.(*p2pNetwork).Setup\n\t/go/src/github.com/ssvlabs/ssv/network/p2p/p2p_setup.go:67\ngithub.com/ssvlabs/ssv/cli/operator.init.func2\n\t/go/src/github.com/ssvlabs/ssv/cli/operator/node.go:445\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:989\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041\ngithub.com/ssvlabs/ssv/cli.Execute\n\t/go/src/github.com/ssvlabs/ssv/cli/cli.go:27\nmain.main\n\t/go/src/github.com/ssvlabs/ssv/cmd/ssvnode/main.go:20\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_arm64.s:1222"}
make: *** [Makefile:105: start-node] Error 1
make: *** [docker] Error 2

the root cause was due to them also specifying HostAddress in addition to HostDNS without knowing about it (due to them using our Makefile to start SSV node - with our Makefile defining env variable to set default value for HostAddress), and our code registering both values with libp2p which doesn't tolerate the usage of more than 1

this PR resolves the issue by making sure only one of conflicting p2p settings is used with libp2p prioritizing HostDNS over HostAddress (which seems what we wanna be doing).

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Project coverage is 47.0%. Comparing base (3e76188) to head (b4e8e09).
Report is 7 commits behind head on stage.

Files with missing lines Patch % Lines
network/p2p/config.go 22.2% 5 Missing and 2 partials ⚠️
Additional details and impacted files

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@moshe-blox moshe-blox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you or Kraken can confirm that it works after testing with a real DNS, LGTM :)

@iurii-ssv
Copy link
Contributor Author

if you or Kraken can confirm that it works after testing with a real DNS, LGTM :)

I've tested locally in Docker to see if it gets us past that error (mentioned in description), and it does - but for real-world setup I'd ask them to confirm (they said they'd like HostDNS eventually, so I'm sure we'll confirm whether it works or not sooner or later).

@iurii-ssv iurii-ssv merged commit 49b18ec into stage Jan 24, 2025
6 of 7 checks passed
@iurii-ssv iurii-ssv deleted the config-p2p-fix-parsing-host-dns branch January 24, 2025 12:30
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.

3 participants