Gloas fork choice redux (#9025)

Co-Authored-By: hopinheimer <knmanas6@gmail.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: hopinheimer <48147533+hopinheimer@users.noreply.github.com>

Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>

Co-Authored-By: Daniel Knopik <107140945+dknopik@users.noreply.github.com>
This commit is contained in:
Michael Sproul
2026-04-03 19:35:02 +11:00
committed by GitHub
parent 99f5a92b98
commit 65c2e01612
40 changed files with 4061 additions and 834 deletions

View File

@@ -2098,52 +2098,66 @@ pub fn serve<T: BeaconChainTypes>(
.nodes
.iter()
.map(|node| {
let execution_status = if node.execution_status.is_execution_enabled() {
Some(node.execution_status.to_string())
let execution_status = if node
.execution_status()
.is_ok_and(|status| status.is_execution_enabled())
{
node.execution_status()
.ok()
.map(|status| status.to_string())
} else {
None
};
let execution_status_string = node
.execution_status()
.map_or_else(|_| "irrelevant".to_string(), |s| s.to_string());
ForkChoiceNode {
slot: node.slot,
block_root: node.root,
slot: node.slot(),
block_root: node.root(),
parent_root: node
.parent
.parent()
.and_then(|index| proto_array.nodes.get(index))
.map(|parent| parent.root),
justified_epoch: node.justified_checkpoint.epoch,
finalized_epoch: node.finalized_checkpoint.epoch,
weight: node.weight,
.map(|parent| parent.root()),
justified_epoch: node.justified_checkpoint().epoch,
finalized_epoch: node.finalized_checkpoint().epoch,
weight: node.weight(),
validity: execution_status,
execution_block_hash: node
.execution_status
.block_hash()
.execution_status()
.ok()
.and_then(|status| status.block_hash())
.map(|block_hash| block_hash.into_root()),
extra_data: ForkChoiceExtraData {
target_root: node.target_root,
justified_root: node.justified_checkpoint.root,
finalized_root: node.finalized_checkpoint.root,
target_root: node.target_root(),
justified_root: node.justified_checkpoint().root,
finalized_root: node.finalized_checkpoint().root,
unrealized_justified_root: node
.unrealized_justified_checkpoint
.unrealized_justified_checkpoint()
.map(|checkpoint| checkpoint.root),
unrealized_finalized_root: node
.unrealized_finalized_checkpoint
.unrealized_finalized_checkpoint()
.map(|checkpoint| checkpoint.root),
unrealized_justified_epoch: node
.unrealized_justified_checkpoint
.unrealized_justified_checkpoint()
.map(|checkpoint| checkpoint.epoch),
unrealized_finalized_epoch: node
.unrealized_finalized_checkpoint
.unrealized_finalized_checkpoint()
.map(|checkpoint| checkpoint.epoch),
execution_status: node.execution_status.to_string(),
execution_status: execution_status_string,
best_child: node
.best_child
.best_child()
.ok()
.flatten()
.and_then(|index| proto_array.nodes.get(index))
.map(|child| child.root),
.map(|child| child.root()),
best_descendant: node
.best_descendant
.best_descendant()
.ok()
.flatten()
.and_then(|index| proto_array.nodes.get(index))
.map(|descendant| descendant.root),
.map(|descendant| descendant.root()),
},
}
})

View File

@@ -671,7 +671,7 @@ pub fn post_validator_prepare_beacon_proposer<T: BeaconChainTypes>(
.await;
// TODO(gloas): verify this is correct. We skip proposer preparation for
// GLOAS because the execution payload is no longer embedded in the beacon
// Gloas because the execution payload is no longer embedded in the beacon
// block (it's in the payload envelope), so the head block's
// execution_payload() is unavailable.
let next_slot = current_slot + 1;