Implement get_filtered_block_tree and fix remaining test failures

- Add get_filtered_block_tree/filter_block_tree matching the spec's
  recursive viability pre-filter for get_head
- Skip invalid execution status nodes in the filter (they aren't in
  store.blocks in the spec)
- Fix attestation_score for V17 nodes: fall back to weight() for
  Empty/Full since pre-Gloas has no payload separation
- Include head_payload_status in ForkChoiceView so CachedHead updates
  when payload status changes
- Update votes test: branch with incompatible finalized leaf is now
  correctly excluded by the recursive filter
- Update execution_status test_03: stored weights no longer include
  proposer boost

All 30 proto_array/fork_choice tests pass.
All 9 EF fork_choice test suites pass.
This commit is contained in:
dapplion
2026-03-25 17:12:17 -05:00
parent 93ef1e395c
commit 324c61d2e2
2 changed files with 115 additions and 18 deletions

View File

@@ -357,17 +357,18 @@ pub fn get_votes_test_definition() -> ForkChoiceTestDefinition {
execution_payload_block_hash: None,
});
// Ensure that 5 is filtered out and the head stays at 4.
// Block 5 has incompatible finalized checkpoint, so `get_filtered_block_tree`
// excludes the entire 1->3->4->5 branch (no viable leaf). Head moves to 2.
//
// 0
// / \
// 2 1
// head-> 2 1
// |
// 3
// |
// 4 <- head
// 4
// /
// 5
// 5 <- incompatible finalized checkpoint
ops.push(Operation::FindHead {
justified_checkpoint: Checkpoint {
epoch: Epoch::new(1),
@@ -378,7 +379,7 @@ pub fn get_votes_test_definition() -> ForkChoiceTestDefinition {
root: get_root(0),
},
justified_state_balances: balances.clone(),
expected_head: get_root(4),
expected_head: get_root(2),
current_slot: Slot::new(0),
expected_payload_status: None,
});