Skip to content

fix(test): avoid duplicate slot in test_head_with_two_competing_forks#471

Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom
latifkasuli:fix/470-competing-forks-unique-slots
Mar 24, 2026
Merged

fix(test): avoid duplicate slot in test_head_with_two_competing_forks#471
tcoratger merged 1 commit intoleanEthereum:mainfrom
latifkasuli:fix/470-competing-forks-unique-slots

Conversation

@latifkasuli
Copy link
Contributor

Summary

Fixes one of the test cases identified in #470 (Avoid multiple-blocks-same-slot in all test cases).

  • test_head_with_two_competing_forks previously created two blocks at slot 2 (fork_a and fork_b), violating the one-block-per-slot protocol constraint.
  • Moved fork_b from slot 2 to slot 3 so each block occupies a unique slot while keeping the same parent (common).
  • Both forks still have equal weight (1 proposer attestation each), preserving the original test intent.
  • Replaced the hardcoded head_root_label check with lexicographic_head_among=["fork_a", "fork_b"] since the forks are now at different slots and the winner depends on root ordering.

Test plan

  • uv run fill tests/consensus/devnet/fc/test_fork_choice_head.py::test_head_with_two_competing_forks --fork=Devnet -v passes
  • All 6 tests in test_fork_choice_head.py pass (no regressions)

Addresses #470

Move fork_b from slot 2 to slot 3 so each block occupies a unique slot,
respecting the one-block-per-slot protocol constraint.

Both forks still have equal weight (1 proposer attestation each) and
the head is validated via the lexicographic_head_among check.

Addresses leanEthereum#470
Copy link
Collaborator

@tcoratger tcoratger left a comment

Choose a reason for hiding this comment

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

LGTM

@tcoratger tcoratger merged commit 0cd62a3 into leanEthereum:main Mar 24, 2026
12 checks passed
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