-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
cmd/utils, p2p: clean up discovery setup #27518
Merged
Merged
Conversation
This file contains 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
While reading through the server, I noticed the `setupDiscovery()` function had a lot of branching and it seemed like an somewhat easy thing to simplify. It appears that the complication stems mostly from the fact that `--nodiscover` actually doesn't fully stop discovery. There are two cases where it will proceed: 1) DNS discovery will currently proceed regardless of this flag, because it uses this new per-protocol discovery mechanism via the discmix iterator and it is set before the early return. 2) If light sync or server is specified, the flags interpreter will forcefully start discv5. This is, I think, why the function needed to be more complicated. After this change, the DNS discovery will not proceed `--nodiscover` is set. This made me think that it might be interesting to give users more control over their discovery mechanisms, e.g. DNS-only, DHT-only, etc. Also, the geth command will exit if a light-mode flag is used with `--nodiscover`. That should make it so `--nodiscover` really does mean no discovery!
lightclient
commented
Jun 19, 2023
fjl
changed the title
p2p,cmd: disable all discovery when --nodiscover is set
p2p: disable all discovery when --nodiscover is set
Jun 19, 2023
fjl
reviewed
Jun 19, 2023
lightclient
force-pushed
the
disc-no-means-no
branch
from
June 19, 2023 22:00
fad818a
to
2ccbbe8
Compare
lightclient
force-pushed
the
disc-no-means-no
branch
from
June 20, 2023 12:07
2ccbbe8
to
bea160a
Compare
fjl
reviewed
Jun 23, 2023
fjl
changed the title
p2p: disable all discovery when --nodiscover is set
p2p: clean up discovery setup
Jun 30, 2023
This moves the LegacyDiscoveryV5 flag into flags_legacy.go and also cleans up some other deprecated flags issues.
fjl
changed the title
p2p: clean up discovery setup
cmd/utils, p2p: clean up discovery setup
Jul 11, 2023
devopsbo3
pushed a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
This simplifies the code that initializes the discovery a bit, and adds new flags for enabling/disabling discv4 and discv5 separately. --------- Co-authored-by: Felix Lange <fjl@twurst.com>
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
This reverts commit 899a656.
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
This reverts commit 899a656.
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.
While reading through the server, I noticed the
setupDiscovery()
function had a lot of branching and it seemed like an somewhat easy thing to simplify. It appears that the complication stems mostly from the fact that--nodiscover
actually doesn't fully stop discovery. There are two cases where it will proceed:DNS discovery will currently proceed regardless of this flag, becauseTurns out this is actually not true, the dns URLs are nil'd out in the flags: https://discord.com/channels/420394352083337236/424272951366385664/1120690530792255548it uses this new per-protocol discovery mechanism via the discmix
iterator and it is set before the early return.
If light sync or server is specified, the flags interpreter will
forcefully start discv5. This is, I think, why the function needed to
be more complicated.
After this change, the DNS discovery will not proceed when
--nodiscover
is set.This made me think that it might be interesting to give users more control over their discovery mechanisms, e.g. DNS-only, DHT-only, etc(I think this will be possible now with thediscv4
flag). Also, the geth command will exit if a light-mode flag is used with--nodiscover
.That should make it so
--nodiscover
really does mean no discovery!