Add full epoch transition test to the EF tests#9275
Conversation
| if state.current_epoch() == E::genesis_epoch() { | ||
| return Ok(()); | ||
| } | ||
|
|
There was a problem hiding this comment.
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:
So I think this is fine?
There was a problem hiding this comment.
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_finalizationprocess_rewards_and_penaltiesprocess_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).
There was a problem hiding this comment.
added the comments, thanks
| // the committee_caches will be built in process_epoch function | ||
| // pre_epoch_state.build_all_committee_caches(spec).unwrap(); |
There was a problem hiding this comment.
Can just delete this comment
| if let Some(post_epoch_state) = expected_post_epoch_state.as_mut() { | ||
| post_epoch_state.build_all_committee_caches(spec).unwrap(); | ||
| } |
There was a problem hiding this comment.
This probably isn't necessary seeing as we only compare without caches?
There was a problem hiding this comment.
deleted, also deleted for the sub-transition one as it looks like it doesn't need that
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?]