ef_tests: add EF gossip_validation handler (#9232)#9256
ef_tests: add EF gossip_validation handler (#9232)#9256latifkasuli wants to merge 1 commit intosigp:unstablefrom
Conversation
Add support for the EF networking/gossip_validation test format in ef_tests. The new handler loads metadata, preloaded blocks, and message fixtures, then drives each message through the BeaconChain gossip verification paths and checks Valid/Ignore/Reject outcomes. Includes test-only fork-choice support for reconciling finalized checkpoint overrides needed by the EF format.
|
thanks for the contribution @latifkasuli can you disclose the AI usage if any in this PR? |
Hey @dapplion, thanks for asking. Yes, I should have disclosed this upfront. A significant portion of this PR was AI-assisted. I used Cursor(Claude) during investigation, implementation drafting, and review of edge cases. I reviewed the full diff, made the final scoping/design decisions, adjusted the implementation, and ran the local verification gate listed in the PR body. In particular, I understand and take responsibility for the constrained I also reviewed and edited the PR description/comments so they reflect my own understanding. Happy to split or scope this down further if you’d prefer. |
Issue Addressed
Adds support for the EF
networking/gossip_validationtest format. Addresses #9232.Proposed Changes
Introduces a new
gossip_validationhandler inef_tests, wired throughcases.rs/handler.rs/tests/tests.rs, that drives gossip validation throughBeaconChainHarnessusing the sameverify_*_for_gossippaths the network layer uses in production.The handler:
meta.yaml, preloaded blocks, and per-message fixtures.failedandpayload_status) before driving messages.verify_*_for_gossipAPI onBeaconChain.Expected::{Valid, Ignore, Reject}and asserts the EF-prescribed outcome.meta.finalized_checkpointoverrideThe EF format initialises the store's finalized checkpoint before importing preloaded blocks. This handler imports first and then overrides, which would otherwise let block imports either advance or fork finality away from the requested checkpoint. To keep semantics sound while staying on the harness's existing
build_genesis_state/ preload path, the override is reconciled against the current fork-choice finality with this decision table:current.epoch > requested.epoch, current descends from requestedcurrent.epoch > requested.epoch, sibling forkFailedToParseTestconflictFailedToParseTestconflictcurrent.epoch < requested.epoch, requested descends from currentcurrent.epoch < requested.epoch, sibling forkFailedToParseTestconflictThe override itself is a single test-only helper on
ForkChoice,override_finalized_checkpoint_for_testing, that updates all four checkpoint fields (finalized, justified, unrealized justified, unrealized finalized) atomically and validates that the override root is present inproto_array. It is only reachable from the EF handler.The override accepts only:
block.slot() == checkpoint.epoch.start_slot(slots_per_epoch)), to avoid silently using a pre-boundary block'sstate_rootfor a checkpoint whose state should be advanced to the boundary slot.Additional Info
Out of scope and explicitly rejected with descriptive errors (left for follow-up PRs):
The remaining external blocker is real EF vectors under
consensus-spec-tests/tests/.../networking/gossip_validation. Until those land, only the discovery shim test runs. Once present, the gate is: