Correct unrealized justification for blocks with slashings (#9471)

Fix a bug in fork choice whereby the unrealized justified and finalized checkpoints from a parent block would be incorrectly carried over to a child block in the same epoch. The documented optimisation in `fork_choice.rs` was wrong because it failed to account for slashings.

This bug is not considered to be sensitive due to the difficulty of triggering it, and the low payoff for doing so (fleeting divergence).


  Keep the optimisation, updating it to correctly skip reusing the parent checkpoints when slashings are present.

A more minimal alternative would be to scrap the optimisation altogether (always compute the checkpoints), however this would come with a minor performance downside. I think the updated optimisation is simple enough to be worth retaining.

There are 3 regression tests added which confirm the correct behaviour. Temporarily setting `has_slashings` to `false` causes all 3 tests to fail.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
Michael Sproul
2026-06-17 23:40:07 +10:00
committed by GitHub
parent a46620155b
commit 716528f44e
3 changed files with 354 additions and 4 deletions

View File

@@ -12,4 +12,5 @@ mod schema_stability;
mod store_tests;
mod sync_committee_verification;
mod tests;
mod unrealized_checkpoints;
mod validator_monitor;