discv5
discv5 copied to clipboard
Permit Invalid ENRS to perform FINDNODE?
There are a number of nodes out there that often misconfigure their ENRs or potentially undergo an IP shift.
Currently we simple drop the session and do not respond to the request leaving the node unaware of its mis-configuration.
We could potentially respond to a FINDNODE and not record the ENR in our table (as it is not contactable).
This would allow discovery to function perfectly fine for misconfigured nodes. Potentially this may allow more misconfigurations to exist and go unnoticed however.
on a quick check I'm thinking one way to do this would be to leverage the one time sessions we already have and instead of dropping the session, downgrading them to a one time one. That way the next request the peer sends is answered without maintaining the invalid session. Would need a bit of work tho.
I'm thinking this as an option to avoid simply dealing with traffic of nodes we -in principle- don't want
Yeah that's a good idea.
imo https://github.com/sigp/discv5/pull/250 solves this to a satisfactory degree.
nonetheless, nodes behind NAT in geth for example, will never discover their local node id, and will never get a session. geth sets default IP in enr to localhost if node is started to listen on all interfaces.
if we use this soon to be stable is_reserved
method from rust, and treat ENRs that don't verify due to enr-socket != src-socket
, as ENRs without a socket, iff they are advertising a reserved IP, then we could safely improve connectivity through out the network.
not sure how geth discv5 treats peers that don't advertise any socket in the ENR, if it lets them have sessions or fails them, based on the assumption that all ENRs contain at least a localhost socket. this would be an unjustified assumption and should be fixed, since what to advertise in the ENR, before IP voting, is not spec'd.