-
Notifications
You must be signed in to change notification settings - Fork 861
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
Use From
field in a PING
packet when creating a peer table entry
#6225
Conversation
|
From
field in a PING
packet when creating a peer table entry
0af44e7
to
6060030
Compare
Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
6060030
to
17d7d9a
Compare
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/PeerDiscoveryAgent.java
Outdated
Show resolved
Hide resolved
…unit test. Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
…w how selection is being done Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
05fbeb8
to
75a0a37
Compare
@fab-10 would you be happy to put a review on the PR? |
e602f09
to
75a0a37
Compare
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.
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.
It would be nice to understand what the specification says about this field in the PING message.
The
and that the recipient should send a
The docs for
Interestingly the ethereum discovery overview wiki (https://github.com/ethereum/devp2p/wiki/Discovery-Overview#discovery-v4) says this:
It's not completely clear to me whether that means "must be ignored by" or "are often ignored by"? If it's the case that it should be ignored (and that this PR/issue isn't valid) I'm a bit confused as to the purpose of the |
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.
@matthew1001 That comment in the spec made me suspicious.
With your change I think we would run in to problems with nodes that do not correctly set the FROM field in the PING message.
Without your change I can imagine that we could run into problems if someone is running a few local nodes (including the bootnode) and wants to add an external node to the chain using that bootnode. The bootnode would send the 127.0.0.1 addresses to the external node, which would not work.
One thing that we could do is to run at least a mainnet node for some time that reports (metric?) how many PING messages do contain a different IP address than the one that we currently use (not counting 127.0.0.1).
Yes I agree, it's difficult to know if fixing this is going to break existing setups that rely on the current behaviour. I think running a mainnet node for a period of time like you describe would be a useful way of getting some more data to base a decision on. I'm not sure if I'm able to do that personally (I need to look into what I have available re. a public-facing system) but I think it would be a useful test. I also wonder if there's any convention within Besu for a "fallback to previous behaviour" env-var or similar (something that doesn't require a first-class config option, but gives any user a way of reverting to the old behaviour if their environment doesn't suit the new behaviour). I think a first-class config option (e.g. something like Finally, maybe a look at what options Geth & Nethermind offer and what they do in code with that field would be useful input to the discussion? |
For Nethermind, based on NethermindEth/nethermind...PingMsgSerializer, I think they honor the |
Merging for now as this would appear to be in keeping with how other clients work. |
I see a huge amount of error message after merging main banch today . Is it related to this PR ? {"@timestamp":"2024-01-19T11:31:39,831","level":"ERROR","thread":"vert.x-eventloop-thread-3","class":"ContextBase","message":"Unhandled exception","throwable":" java.lang.IllegalArgumentException: Invalid ip address.\n\tat org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl$Builder.ipAddress(EnodeURLImpl.java:405)\n\tat org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl$Builder.ipAddress(EnodeURLImpl.java:380)\n\tat org.hyperledger.besu.ethereum.p2p.discovery.PeerDiscoveryAgent.handleIncomingPacket(PeerDiscoveryAgent.java:312)\n\tat org.hyperledger.besu.ethereum.p2p.discovery.VertxPeerDiscoveryAgent.lambda$handlePacket$10(VertxPeerDiscoveryAgent.java:298)\n\tat io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)\n\tat io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)\n\tat io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)\n\tat io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)\n\tat io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:413)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Thread.java:1583)\n"} |
Just having a look @matkt. Is this syncing a public node? |
yes during checkpoint on mainnet, directly at the beginning |
Just started a thread on discord if it's easier to discuss on there? https://discord.com/channels/905194001349627914/905205502940696607/1197868266635407410 |
I've raised #6439 which validates the |
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.
LGTM
PR description
This PR uses the
From
field of aPING
packet when creating a local entry in the peer table, unless theFrom
field is not available in which case it reverts to the existing behaviour of using theUDP
source address.Since (as far as I can tell) all
PING
packets include aFrom
field (with127.0.0.1
in the case where the user hasn't specified a custom value) the PR is coded to ignore aFrom
field of127.0.0.1
and use the UDP source address instead. The reality is that on a localhost system the UDP source will be127.0.0.1
anyway but it provides a little extra protection from this change/fix causing issues on existing systems that might be working just fine using the UDP source address in peer'senode
URL. The main aim of this fix is that if something has specified a custom value it is honoured by thePING
recipient.Fixed Issue(s)
Fixes #6224