Skip to content

added an executor for Gossip beacon attestation reftests#10546

Open
rolfyone wants to merge 1 commit intoConsensys:masterfrom
rolfyone:attestation-test
Open

added an executor for Gossip beacon attestation reftests#10546
rolfyone wants to merge 1 commit intoConsensys:masterfrom
rolfyone:attestation-test

Conversation

@rolfyone
Copy link
Copy Markdown
Contributor

@rolfyone rolfyone commented Apr 2, 2026

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

Note

Low Risk
Test-only change that adds a new reference-test executor and wires it into the test-type registry; no production logic is modified.

Overview
Adds a new reference-test executor, GossipBeaconAttestationTestExecutor, to run networking/gossip_beacon_attestation vectors by building an in-memory chain (genesis + optional imported blocks) and validating gossiped attestations against expected accept/reject/ignore outcomes.

Registers the new executor in Eth2ReferenceTestCase so the test runner can dispatch this new networking test type.

Written by Cursor Bugbot for commit 04ad22c. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

testDefinition,
message.getMessage() + ".ssz_snappy",
spec.getGenesisSchemaDefinitions().getAttestationSchema());
final Bytes32 attestationRoot = attestation.hashTreeRoot();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong attestation schema used to deserialize SSZ

High Severity

The test loads gossip attestation SSZ files using spec.getGenesisSchemaDefinitions().getAttestationSchema(), which returns AttestationPhase0Schema. However, in Electra/Fulu the beacon_attestation_{subnet_id} gossip topic was changed to carry SingleAttestation objects, whose SSZ layout (committee_index: uint64, attester_index: uint64, data, signature) is entirely different from the phase0 layout (aggregation_bits: bitlist, data, signature). Deserializing a SingleAttestation blob with the phase0 schema will produce corrupted data or a deserialization error, causing every Fulu gossip attestation reftest to fail or silently produce wrong results. The correct schema to use is getSingleAttestationSchema() from SchemaDefinitionsElectra (as already used in SszTestExecutor).

Fix in Cursor Fix in Web

new GossipValidationHelper(spec, recentChainData, metricsSystem));

// Track seen attestations (by hash tree root) for "already seen" duplicate detection
final Set<Bytes32> seenAttestationRoots = new HashSet<>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

so this is required to simulate the fact that, at low level in libp2p, we ignore already seen messages (done via sha256). Am I correct?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if true, we should add them to the seenCache regardless of its validity

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

im actually not sure... :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it currently passes the test cases so probably academic i guess

Copy link
Copy Markdown
Contributor

@tbenr tbenr left a comment

Choose a reason for hiding this comment

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

I'd just move the seenAttestationRoots.add regardless the validation result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants