Use fork choice to ensure that the execution envelope snapshot is populated in most cases

This commit is contained in:
Eitan Seri-Levi
2026-05-25 17:11:57 +03:00
parent 309719d2c6
commit eead95f112
5 changed files with 104 additions and 6 deletions

View File

@@ -1276,6 +1276,29 @@ impl ProtoArray {
}
}
/// Returns the latest ancestor of `block_root` whose `PayloadStatus` is `Full`.
pub(crate) fn latest_parent_full_block<E: EthSpec>(
&self,
block_root: Hash256,
proposer_boost_root: Hash256,
justified_balances: &JustifiedBalances,
spec: &ChainSpec,
) -> Result<Option<Hash256>, Error> {
for node in self.iter_nodes(&block_root) {
if self.get_canonical_payload_status::<E>(
node.root(),
node.slot(),
proposer_boost_root,
justified_balances,
spec,
)? == PayloadStatus::Full
{
return Ok(Some(node.root()));
}
}
Ok(None)
}
/// Returns the canonical payload status of a block, matching the decision
/// `get_head` would make between `(root, FULL)` and `(root, EMPTY)`.
pub(crate) fn get_canonical_payload_status<E: EthSpec>(

View File

@@ -1083,6 +1083,21 @@ impl ProtoArrayForkChoice {
.unwrap_or(false)
}
/// Returns the latest ancestor of `block_root` whose `PayloadStatus` is `Full`.
pub fn latest_parent_full_block<E: EthSpec>(
&self,
block_root: Hash256,
proposer_boost_root: Hash256,
spec: &ChainSpec,
) -> Result<Option<Hash256>, Error> {
self.proto_array.latest_parent_full_block::<E>(
block_root,
proposer_boost_root,
&self.balances,
spec,
)
}
/// Returns the canonical payload status of a block, matching the decision
/// `get_head` would make between `(root, FULL)` and `(root, EMPTY)`.
pub fn get_canonical_payload_status<E: EthSpec>(