Skip to content

Add full epoch transition test to the EF tests#9275

Draft
chong-he wants to merge 11 commits into
sigp:unstablefrom
chong-he:ef-tests
Draft

Add full epoch transition test to the EF tests#9275
chong-he wants to merge 11 commits into
sigp:unstablefrom
chong-he:ef-tests

Conversation

@chong-he
Copy link
Copy Markdown
Member

@chong-he chong-he commented May 7, 2026

Issue Addressed

Additional Info

Thank you @michaelsproul for the help

Currently blocked pending a new release of the test vector:
ethereum/consensus-specs#5216
ethereum/consensus-specs#5217

The test passed on nightly: https://github.com/ethereum/consensus-specs/actions/runs/25586464266
Blocked pending a release of the new consensus spec [v1.7.0-alpha.8?]

Comment on lines +245 to +248
if state.current_epoch() == E::genesis_epoch() {
return Ok(());
}

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.

Return early if the epoch is at genesis_epoch, otherwise the test fails with:

Test Failure
Title: phase0/epoch_processing/participation_record_updates
1 tests, 1 failed, 0 skipped (known failure), 0 skipped (bls), 0 passed. (See below for errors)

-------
case 0 () from /home/ck/Github/lighthouse/testing/ef_tests/consensus-spec-tests/tests/minimal/phase0/epoch_processing/participation_record_updates/pyspec_tests/updated_participation_record failed with NotEqual:
Got BeaconStateError(InvalidBitfield) | Expected Base(BeaconStateBase { genesis_time: 0, genesis_validators_root: 0x0a08c27fe4ece2483f9e581f78c66379a06f96e9c24cd1390594ff939b26f95b, slot: Slot(7), fork: Fork { previous_version: [0, 0, 0, 1], current_version: [0, 0, 0, 1], epoch: Epoch(0) }, latest_block_header: BeaconBlockHeader { slot: Slot(0), proposer_index: 0, parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000, state_root: 0xb83ec62bfd92c791eac8f88af7a295f2e6908422829b9b8233548c7b5b32a487, body_root: 0xccb62460

This is from Claude.

We also have the process_rewards_and_penalties skipped at the genesis epoch:

pub fn process_rewards_and_penalties<E: EthSpec>(
state: &mut BeaconState<E>,
validator_statuses: &ValidatorStatuses,
spec: &ChainSpec,
) -> Result<(), Error> {
if state.current_epoch() == E::genesis_epoch() {
return Ok(());
}

So I think this is fine?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah it's ok, but I think we need a comment, because it's a bit subtle.

The validator_statuses are used in 3 functions:

  • process_justification_and_finalization
  • process_rewards_and_penalties
  • process_slashings

The first two functions are no-ops at genesis, so that is OK. And process_slashings only uses the total_balances.current_epoch(), which is filled in by ValidatorStatuses::new (i.e. it doesn't depend on process_attestations).

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.

added the comments, thanks

Comment on lines +457 to +458
// the committee_caches will be built in process_epoch function
// pre_epoch_state.build_all_committee_caches(spec).unwrap();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can just delete this comment

Comment on lines +461 to +463
if let Some(post_epoch_state) = expected_post_epoch_state.as_mut() {
post_epoch_state.build_all_committee_caches(spec).unwrap();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This probably isn't necessary seeing as we only compare without caches?

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.

deleted, also deleted for the sub-transition one as it looks like it doesn't need that

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants