O(n) children index, fix load_parent for gloas blocks

- Build parent->children index once per find_head call, replacing O(n)
  scans in filter_block_tree and get_node_children with O(1) lookups.
- Skip zero block_hash in is_parent_block_full check — default/zero
  hashes don't indicate a real payload relationship.
- Fall back to block state_root for genesis when envelope not stored.
- Store execution payload envelope in EF test harness during
  on_execution_payload step.
This commit is contained in:
dapplion
2026-03-25 19:36:14 -05:00
parent d58df3a656
commit e7f027badd
3 changed files with 88 additions and 35 deletions

View File

@@ -449,8 +449,7 @@ impl<E: EthSpec> Case for ForkChoiceTest<E> {
execution_payload,
valid,
} => {
tester
.process_execution_payload(execution_payload.beacon_block_root(), *valid)?;
tester.process_execution_payload(execution_payload, *valid)?;
}
}
}
@@ -993,7 +992,27 @@ impl<E: EthSpec> Tester<E> {
check_equal("proposer_head", proposer_head, expected_proposer_head)
}
pub fn process_execution_payload(&self, block_root: Hash256, valid: bool) -> Result<(), Error> {
pub fn process_execution_payload(
&self,
signed_envelope: &SignedExecutionPayloadEnvelope<E>,
valid: bool,
) -> Result<(), Error> {
let block_root = signed_envelope.message.beacon_block_root;
// Store the envelope in the database so that child blocks extending
// the FULL path can load the parent's post-payload state.
if valid {
self.harness
.chain
.store
.put_payload_envelope(&block_root, signed_envelope.clone())
.map_err(|e| {
Error::InternalError(format!(
"Failed to store payload envelope for {block_root:?}: {e:?}",
))
})?;
}
let result = self
.harness
.chain