Merge branch 'unstable' into gloas-head-block-number

This commit is contained in:
Eitan Seri-Levi
2026-06-11 08:04:01 -07:00
committed by GitHub
92 changed files with 6037 additions and 3172 deletions

View File

@@ -207,6 +207,18 @@ pub enum InvalidPayloadAttestation {
},
}
/// The import status of a block's parent, as seen by fork choice.
#[allow(clippy::large_enum_variant)]
pub enum ParentImportStatus {
/// The parent block is imported and the child's bid commits to a parent payload known to fork
/// choice.
Imported(ProtoBlock),
/// The parent block is not known to fork choice.
UnknownBlock,
/// The parent block is known, but the child's bid commits to a payload not known to fork choice.
UnknownPayload,
}
impl<T> From<String> for Error<T> {
fn from(e: String) -> Self {
Error::ProtoArrayStringError(e)
@@ -1537,6 +1549,37 @@ where
&& self.is_finalized_checkpoint_or_descendant(*block_root)
}
/// Returns `true` if the block's parent is imported (and, for a post-Gloas FULL child, its
/// parent's payload is imported too). See [`Self::get_parent_import_status`].
pub fn is_parent_imported(&self, block: &SignedBeaconBlock<E>) -> bool {
matches!(
self.get_parent_import_status(block),
ParentImportStatus::Imported(_)
)
}
/// Returns the import status of the parent of `block`.
///
/// A post-Gloas FULL child also requires the parent's payload (committed to by the child's bid)
/// to have been received by fork choice.
pub fn get_parent_import_status(&self, block: &SignedBeaconBlock<E>) -> ParentImportStatus {
if let Some(parent_block) = self.get_block(&block.parent_root()) {
let Some(parent_block_hash) = parent_block.execution_payload_block_hash else {
// Pre-Gloas parent: payload is embedded in the block, so treat as imported.
return ParentImportStatus::Imported(parent_block);
};
if block.is_parent_block_full(parent_block_hash)
&& !self.is_payload_received(&block.parent_root())
{
ParentImportStatus::UnknownPayload
} else {
ParentImportStatus::Imported(parent_block)
}
} else {
ParentImportStatus::UnknownBlock
}
}
/// Called by the proposer to decide whether to build on the full or empty parent.
pub fn should_build_on_full(
&self,

View File

@@ -4,9 +4,9 @@ mod metrics;
pub use crate::fork_choice::{
AttestationFromBlock, Error, ForkChoice, ForkChoiceView, ForkchoiceUpdateParameters,
InvalidAttestation, InvalidBlock, InvalidPayloadAttestation, PayloadVerificationStatus,
PersistedForkChoice, PersistedForkChoiceV28, PersistedForkChoiceV29, QueuedAttestation,
ResetPayloadStatuses,
InvalidAttestation, InvalidBlock, InvalidPayloadAttestation, ParentImportStatus,
PayloadVerificationStatus, PersistedForkChoice, PersistedForkChoiceV28, PersistedForkChoiceV29,
QueuedAttestation, ResetPayloadStatuses,
};
pub use fork_choice_store::ForkChoiceStore;
pub use proto_array::{