Skip to content

Add more FCR tests - #5400

Merged
jtraglia merged 3 commits into
ethereum:masterfrom
mkalinin:moar-fcr-tests
Jun 29, 2026
Merged

Add more FCR tests#5400
jtraglia merged 3 commits into
ethereum:masterfrom
mkalinin:moar-fcr-tests

Conversation

@mkalinin

Copy link
Copy Markdown
Contributor

Introduces more FCR tests, focused on edge case testing:

  • Temporal asynchrony at epoch boundary
  • Reorgs around capturing current_slot_head
  • No restart happens if the head block doesn’t have GU in its chain of justified checkpoints
  • Large validator creating an imbalance between maximum_support and support
  • Validator supporting parent block during parent’s block slot is assigned to the committee of an empty slot (parent_slot + 1) preceding a block that is about to be confirmed
  • Recently activated validator isn’t yet active in the balance_source but already active in the head’s state and supporting a block about to be confirmed

The following changes are introduced to the testing framework:

  • payload_index added to get_valid_attestations_for_block_at_slot helper, otherwise, post-Gloas attesters always support empty payload status when there is an empty slot following the block they vote for
  • state.payload_expected_withdrawals are assigned to paylod.withdrawals in build_signed_execution_payload_envelope, this fixes the case when envelope cannot be processed because withdrawals don’t match

@github-actions github-actions Bot added the testing CI, actions, tests, testing infra label Jun 26, 2026

@jtraglia jtraglia left a comment

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.

I skimmed over the changes and the changes look good to me!

@jtraglia
jtraglia enabled auto-merge (squash) June 29, 2026 20:08
@jtraglia
jtraglia merged commit bb85898 into ethereum:master Jun 29, 2026
16 checks passed
mkalinin added a commit that referenced this pull request Aug 4, 2026
Share similar problem (FCR should run **once** per slot) with #5498, but
this PR actually *deduplicates* FCR run unlike #5498.

- `test_fcr_no_restart_if_head_gu_is_stale`

This test runs FCR twice when slot number is 24. Line 459-463 advances
the store and updates FCR variables until slot 24 (`3 * S`). After that,
the store never advances, but at line 483 it runs FCR update *again*
which makes `previous_slot_head == current_slot_head` because:

```python
def update_fast_confirmation_variables(fcr_store: FastConfirmationStore) -> None:
    # Update prev and curr slot head
    store = fcr_store.store
    fcr_store.previous_slot_head = fcr_store.current_slot_head
    fcr_store.current_slot_head = get_head(store).root
    
    # omit after...
```

which is not a state we want:

```
  Slot 23 FCR: previous=A, current=B
  Slot 24 FCR: previous=B, current=HEAD
  Slot 24 again: previous=HEAD, current=HEAD
```

Related to #5400 as this test was added there.

Co-authored-by: Mikhail Kalinin <noblesse.knight@gmail.com>
mkalinin added a commit that referenced this pull request Aug 4, 2026
This PR fixes the following test regarding FCR:
-
`test_is_one_confirmed_passes_with_empty_slot_and_attester_in_two_consecutive`

as it doesn't run `on_fast_confirmation` in **56**.

Test flow:
1. Process FCR to the target slot (= 55) by applying block AND
`on_fast_confirmation`.
2. Advance one more slot (Line 1470) - Current slot is now 56.
3. Advance one more slot again (Line 1482) after setting the condition
(Only validator V attests to the parent block) - Current slot is now 57.

Between step 2 and 3, we need to update FCR store as per spec, which
means `update_fast_confirmation_variables` was omitted for slot 56
(which is the first slot of the epoch).

Prysm fails to pass this test by complaining
`previous_epoch_observed_justified_checkpoint epoch mismatch, want 4 got
5`, and I believe this is a bug when generating test vectors.

Related to #5400 as this test is added there.

Co-authored-by: Mikhail Kalinin <noblesse.knight@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing CI, actions, tests, testing infra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants