Add AbstractSkippingEnvelopeHandler so all handlers will skip BAD_PACKET#218
Merged
zilm13 merged 2 commits intoConsensys:masterfrom Apr 23, 2026
Merged
Add AbstractSkippingEnvelopeHandler so all handlers will skip BAD_PACKET#218zilm13 merged 2 commits intoConsensys:masterfrom
zilm13 merged 2 commits intoConsensys:masterfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
Author
|
recheck |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PR Description
We have errors like this in logs:
It happens because WhoAreYou handler in pipeline was not able to parse WHOAREYOU packet, marked it with BAD_PACKET, next this packet arrives in
UnknownPacketTagToSenderhandler, which is just down in the pipeline andUnknownPacketTagToSenderjust doesn't expect this type of packet at all and throws an exception. For me the proper fix would be to make all handlers ignoring any packet which is marked as aBAD_PACKETexcept bad packets handler. That idea is implemented in this PRFixed Issue(s)
Note
Low Risk
Behavioral change is narrowly scoped to pipeline error handling (early-exit on
BAD_PACKET) and is covered by new unit tests; minimal impact on core protocol logic beyond skipping post-error processing.Overview
Introduces
AbstractSkippingEnvelopeHandler, a new base handler that short-circuits processing when an envelope has been marked withField.BAD_PACKET.Updates the main discovery pipeline handlers (packet parsing, session resolution, dispatch, and message/task handlers) to extend this base class and move their logic into
handlePacket, so only the terminalBadPacketHandler(still implementingEnvelopeHandlerdirectly) continues to observe and log bad packets.Adds unit tests verifying that once
BAD_PACKETis set, downstream skipping handlers are not invoked, while non-skipping terminal handlers still run and healthy envelopes continue through the chain.Reviewed by Cursor Bugbot for commit 5b7468e. Bugbot is set up for automated code reviews on this repo. Configure here.