From 3645d57099d3356d17ac5c42afe7b43ec46bf4bc Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Tue, 11 Mar 2025 16:14:58 +1100 Subject: [PATCH] Fix descent from split check (#7105) --- beacon_node/beacon_chain/src/block_verification.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index d500845222..a7e255ad49 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -1783,10 +1783,17 @@ pub fn check_block_is_finalized_checkpoint_or_descendant< block: B, ) -> Result { // If we have a split block newer than finalization then we also ban blocks which are not - // descended from that split block. + // descended from that split block. It's important not to try checking `is_descendant` if + // finality is ahead of the split and the split block has been pruned, as `is_descendant` will + // return `false` in this case. + let finalized_slot = fork_choice + .finalized_checkpoint() + .epoch + .start_slot(T::EthSpec::slots_per_epoch()); let split = chain.store.get_split_info(); - let is_descendant_from_split_block = - split.slot == 0 || fork_choice.is_descendant(split.block_root, block.parent_root()); + let is_descendant_from_split_block = split.slot == 0 + || split.slot <= finalized_slot + || fork_choice.is_descendant(split.block_root, block.parent_root()); if fork_choice.is_finalized_checkpoint_or_descendant(block.parent_root()) && is_descendant_from_split_block