Skip to content

Add gossip validation spec tests for beacon block#9372

Open
jimmygchen wants to merge 11 commits into
sigp:unstablefrom
jimmygchen:ef-tests-gossip-block
Open

Add gossip validation spec tests for beacon block#9372
jimmygchen wants to merge 11 commits into
sigp:unstablefrom
jimmygchen:ef-tests-gossip-block

Conversation

@jimmygchen
Copy link
Copy Markdown
Member

Issue Addressed

Addresses #9232 partially. This PR covers the beacon_block topic test vectors.

The vectors provide a state.ssz_snappy, a set of blocks and gossip messages with expected outcomes.

The gossip block validation depends on many beacon chain components, so to keep the test close to produciton behaviour, BeaconChainHarness is used and we pass the gossip messages through the gossip_methods.rs functions.

Proposed Changes

  • Update block gossip processing to return MessageAcceptance, so the EF tests can assert the gossip result.
  • Add a test-only beacon chain builder helper for starting an ephemeral chain from a known setup block and its post-state.
  • Import blocks through normal block import path before validating gossip messages.

AI Assistance Disclosure

Tools used (required — write none if no AI was used): codex for the test boilerplate. Rewrote most of the production changes manually.

Attestation (required):

  • I have read every line of this diff, understand what it does, and can explain it in review.

Additional Info

I still need to review the test setup more carefully in builder.rs & gossip_validation.rs.

There's also some failing tests which expose an existing mismatch for gossip_beacon_block__ignore_parent_execution_verified_invalid: the vector expects IGNORE, while Lighthouse currently returns REJECT for ParentExecutionPayloadInvalid.

@jimmygchen jimmygchen added test improvement Improve tests work-in-progress PR is a work-in-progress labels May 29, 2026
"gossip_block_mid",
);
return None;
(None, MessageAcceptance::Ignore)
Copy link
Copy Markdown
Member Author

@jimmygchen jimmygchen May 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behaviour change here - we are currently not propagating gossip validation results on some of these error match arms

let block_slot = verified_block.block.slot();
let block_root = verified_block.block_root;
if let Some(verified_block) = verified_block_opt {
metrics::inc_counter(&metrics::BEACON_PROCESSOR_GOSSIP_BLOCK_VERIFIED_TOTAL);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

section below is just whitespace change and can be ignored on github

Comment thread testing/ef_tests/tests/tests.rs Outdated
@jimmygchen jimmygchen self-assigned this May 29, 2026
@jimmygchen jimmygchen marked this pull request as ready for review June 3, 2026 04:04
@jimmygchen jimmygchen requested a review from jxs as a code owner June 3, 2026 04:04
@jimmygchen jimmygchen added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review The code is ready for review test improvement Improve tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant