test(networking): add gossipsub handler behavioral test vectors#615
Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom Apr 15, 2026
Merged
Conversation
Introduces a new GossipsubHandlerTest fixture that tests protocol DECISIONS, not wire encoding. Each vector defines an initial state (mesh topology, peers, caches, backoffs), an incoming RPC event, and captures the expected outbound RPCs plus resulting mesh state. This is the first behavioral test fixture for gossipsub. It complements the existing encoding vectors (RPC protobuf, message IDs, topic strings) by testing the logic layer: what does the node DO when it receives a GRAFT, PRUNE, IHAVE, IWANT, or published message? 14 test vectors covering: - GRAFT: accept, reject (capacity), reject (backoff), ignore (unsubscribed), idempotent - PRUNE: remove from mesh with backoff, zero backoff - IHAVE: unseen triggers IWANT, seen produces no IWANT, mixed filtering - IWANT: cached message returned - Message: forward to mesh except sender, duplicate not forwarded, IDONTWANT peer skipped Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Introduces a new GossipsubHandlerTest fixture that tests gossipsub protocol decisions, not wire encoding. This is a fundamentally different kind of test vector — it captures what the node DOES when it receives GRAFT/PRUNE/IHAVE/IWANT/messages, not what bytes it produces.
Each vector defines:
Why this matters
If two clients disagree on whether to accept a GRAFT, they have incompatible mesh topologies. If they disagree on IHAVE filtering, lazy pull breaks. These are the most interop-critical decisions after wire format.
Vectors (14 total)
Design decisions
nowtimestamp, backoffs are absolute values,time.time()is patchedTest plan
uvx tox -e all-checkspassesuv run fill --fork=devnet --clean -n auto -- tests/consensus/devnet/networking/generates all 107 fixtures🤖 Generated with Claude Code