Skip to content

fix: resend original WHOAREYOU for any new ordinary packet during han…#234

Closed
usmansaleem wants to merge 2 commits into
Consensys:masterfrom
usmansaleem:fix/handshake-resend-whoareyou
Closed

fix: resend original WHOAREYOU for any new ordinary packet during han…#234
usmansaleem wants to merge 2 commits into
Consensys:masterfrom
usmansaleem:fix/handshake-resend-whoareyou

Conversation

@usmansaleem

Copy link
Copy Markdown
Contributor

PR Description

fix: resend original WHOAREYOU for any new ordinary packet during handshake

When a responder has already issued a WHOAREYOU challenge and receives a second ordinary packet with a different nonce, it now resends the original WHOAREYOU rather than issuing a fresh challenge. This matches the discv5 spec intent: hold one challenge per session attempt so the initiator can complete the handshake it already started.

On the initiator side, WHOAREYOU validation is relaxed from 'must match the last sent nonce' to 'must match any recently sent nonce' (bounded window of 8). The nonce-to-session lookup in NodeSessionManager is updated to keep all recent nonces (not just the last), cleared together when the session is deleted, reset on handshake timeout, and cleared on AUTHENTICATED transition.

Fixed Issue(s)

…dshake

When a responder has already issued a WHOAREYOU challenge and receives a
second ordinary packet with a different nonce, it now resends the original
WHOAREYOU rather than issuing a fresh challenge. This matches the discv5
spec intent: hold one challenge per session attempt so the initiator can
complete the handshake it already started.

On the initiator side, WHOAREYOU validation is relaxed from 'must match the
last sent nonce' to 'must match any recently sent nonce' (bounded window of
8). The nonce-to-session lookup in NodeSessionManager is updated to keep all
recent nonces (not just the last), cleared together when the session is
deleted, reset on handshake timeout, and cleared on AUTHENTICATED transition.
@usmansaleem

Copy link
Copy Markdown
Contributor Author

Closing due to new PR.

@usmansaleem usmansaleem closed this Jun 4, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant