go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

Sending DiscV5 WHOAREYOU challenge only once

Open GrapeBaBa opened this issue 1 year ago • 4 comments

Other DiscV5 implementation sending only once

Nim: https://github.com/status-im/nim-eth/blob/470baf82bdbf05dd399881123ae9020b8f117871/eth/p2p/discoveryv5/protocol.nim#L404

Rust: https://github.com/sigp/discv5/blob/master/src/handler/mod.rs#L1047

This may cause Invalid nonce error when communicating with other clients from go-ethereum.

We have a change in shisui PR, does it make sense to merge
into go-ethereum?

GrapeBaBa avatar Oct 12 '24 02:10 GrapeBaBa

CC @fjl

karalabe avatar Oct 15 '24 08:10 karalabe

I think the issue fixed by the PR may be a valid one, but the fix you linked is confusing. It would be better to perform the check for duplicate WHOAREYOU in the place where it is sent, instead of dropping it in Encode.

fjl avatar Oct 16 '24 17:10 fjl

@fjl I only see this function getHandshake in SessionCache could judge duplicate WHOAREYOU, how can I make this code out of Encode?

GrapeBaBa avatar Oct 17 '24 07:10 GrapeBaBa

Hmm. We have an explicit test that verifies the current Geth behavior, the node is supposed to respond to every handshake attempt with a new WHOAREYOU challenge.

This is also explicitly mentioned by the spec, in the Handshake Implementation Considerations section (sentence beginning with "Another important issue is the processing...")

I'm curious if this happens often. Possibly we could change the spec.

fjl avatar Oct 18 '24 13:10 fjl

@fjl for portal use case, i observed it happens very frequently, i thought we may need change the spec.

GrapeBaBa avatar Jan 29 '25 07:01 GrapeBaBa