Remove head_payload_status from ForkchoiceUpdateParameters

head_payload_status is internal fork choice state, not an EL
forkchoiceUpdated parameter. It already lives on CachedHead — source
it directly from get_head() return in recompute_head_at_slot instead
of threading through ForkchoiceUpdateParameters.

Also add TODO(gloas) for parent_head_hash in re-org path (V29 nodes
don't carry execution_status).
This commit is contained in:
dapplion
2026-03-25 21:16:06 -05:00
parent bc28e63585
commit 93f987f3cf
6 changed files with 13 additions and 22 deletions

View File

@@ -4898,6 +4898,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
return Err(Box::new(DoNotReOrg::HeadNotLate.into()));
}
// TODO(gloas): V29 nodes don't carry execution_status, so this returns
// None for post-Gloas re-orgs. Need to source the EL block hash from
// the bid's block_hash instead. Re-org is disabled for Gloas for now.
let parent_head_hash = info
.parent_node
.execution_status()
@@ -4905,7 +4908,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.and_then(|execution_status| execution_status.block_hash());
let forkchoice_update_params = ForkchoiceUpdateParameters {
head_root: info.parent_node.root(),
head_payload_status: canonical_forkchoice_params.head_payload_status,
head_hash: parent_head_hash,
justified_hash: canonical_forkchoice_params.justified_hash,
finalized_hash: canonical_forkchoice_params.finalized_hash,

View File

@@ -229,7 +229,6 @@ impl<E: EthSpec> CachedHead<E> {
pub fn forkchoice_update_parameters(&self) -> ForkchoiceUpdateParameters {
ForkchoiceUpdateParameters {
head_root: self.snapshot.beacon_block_root,
head_payload_status: self.head_payload_status,
head_hash: self.head_hash,
justified_hash: self.justified_hash,
finalized_hash: self.finalized_hash,
@@ -276,7 +275,7 @@ impl<T: BeaconChainTypes> CanonicalHead<T> {
snapshot,
justified_checkpoint: fork_choice_view.justified_checkpoint,
finalized_checkpoint: fork_choice_view.finalized_checkpoint,
head_payload_status: forkchoice_update_params.head_payload_status,
head_payload_status: proto_array::PayloadStatus::Pending,
head_hash: forkchoice_update_params.head_hash,
justified_hash: forkchoice_update_params.justified_hash,
finalized_hash: forkchoice_update_params.finalized_hash,
@@ -337,7 +336,7 @@ impl<T: BeaconChainTypes> CanonicalHead<T> {
snapshot: Arc::new(snapshot),
justified_checkpoint: fork_choice_view.justified_checkpoint,
finalized_checkpoint: fork_choice_view.finalized_checkpoint,
head_payload_status: forkchoice_update_params.head_payload_status,
head_payload_status: proto_array::PayloadStatus::Pending,
head_hash: forkchoice_update_params.head_hash,
justified_hash: forkchoice_update_params.justified_hash,
finalized_hash: forkchoice_update_params.finalized_hash,
@@ -615,15 +614,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// was last run.
let old_view = ForkChoiceView {
head_block_root: old_cached_head.head_block_root(),
head_payload_status: old_cached_head.head_payload_status(),
justified_checkpoint: old_cached_head.justified_checkpoint(),
finalized_checkpoint: old_cached_head.finalized_checkpoint(),
};
let old_payload_status = old_cached_head.head_payload_status();
let mut fork_choice_write_lock = self.canonical_head.fork_choice_write_lock();
// Recompute the current head via the fork choice algorithm.
let _ = fork_choice_write_lock.get_head(current_slot, &self.spec)?;
let (_, new_payload_status) = fork_choice_write_lock.get_head(current_slot, &self.spec)?;
// Downgrade the fork choice write-lock to a read lock, without allowing access to any
// other writers.
@@ -668,9 +667,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
});
}
// Exit early if the head or justified/finalized checkpoints have not changed, there's
// nothing to do.
if new_view == old_view {
// Exit early if the head, checkpoints, and payload status have not changed.
if new_view == old_view && new_payload_status == old_payload_status {
debug!(
head = ?new_view.head_block_root,
"No change in canonical head"
@@ -727,7 +725,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
snapshot: Arc::new(new_snapshot),
justified_checkpoint: new_view.justified_checkpoint,
finalized_checkpoint: new_view.finalized_checkpoint,
head_payload_status: new_forkchoice_update_parameters.head_payload_status,
head_payload_status: new_payload_status,
head_hash: new_forkchoice_update_parameters.head_hash,
justified_hash: new_forkchoice_update_parameters.justified_hash,
finalized_hash: new_forkchoice_update_parameters.finalized_hash,
@@ -755,7 +753,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
snapshot: old_cached_head.snapshot.clone(),
justified_checkpoint: new_view.justified_checkpoint,
finalized_checkpoint: new_view.finalized_checkpoint,
head_payload_status: new_forkchoice_update_parameters.head_payload_status,
head_payload_status: new_payload_status,
head_hash: new_forkchoice_update_parameters.head_hash,
justified_hash: new_forkchoice_update_parameters.justified_hash,
finalized_hash: new_forkchoice_update_parameters.finalized_hash,

View File

@@ -12,7 +12,7 @@ use eth2::{
BeaconNodeHttpClient, CONSENSUS_VERSION_HEADER, CONTENT_TYPE_HEADER, SSZ_CONTENT_TYPE_HEADER,
Timeouts,
};
use fork_choice::{ForkchoiceUpdateParameters, PayloadStatus as FcPayloadStatus};
use fork_choice::ForkchoiceUpdateParameters;
use parking_lot::RwLock;
use sensitive_url::SensitiveUrl;
use ssz::Encode;
@@ -934,7 +934,6 @@ impl<E: EthSpec> MockBuilder<E> {
finalized_hash: Some(finalized_execution_hash),
justified_hash: Some(justified_execution_hash),
head_root: head_block_root,
head_payload_status: FcPayloadStatus::Pending,
};
let _status = self

View File

@@ -92,7 +92,6 @@ impl<E: EthSpec> MockExecutionLayer<E> {
let head_block_root = Hash256::repeat_byte(42);
let forkchoice_update_params = ForkchoiceUpdateParameters {
head_root: head_block_root,
head_payload_status: fork_choice::PayloadStatus::Pending,
head_hash: Some(parent_hash),
justified_hash: None,
finalized_hash: None,

View File

@@ -342,7 +342,6 @@ pub enum AttestationFromBlock {
pub struct ForkchoiceUpdateParameters {
/// The most recent result of running `ForkChoice::get_head`.
pub head_root: Hash256,
pub head_payload_status: PayloadStatus,
pub head_hash: Option<ExecutionBlockHash>,
pub justified_hash: Option<ExecutionBlockHash>,
pub finalized_hash: Option<ExecutionBlockHash>,
@@ -351,7 +350,6 @@ pub struct ForkchoiceUpdateParameters {
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ForkChoiceView {
pub head_block_root: Hash256,
pub head_payload_status: PayloadStatus,
pub justified_checkpoint: Checkpoint,
pub finalized_checkpoint: Checkpoint,
}
@@ -483,7 +481,6 @@ where
finalized_hash: None,
// These will be updated during the next call to `Self::get_head`.
head_root: Hash256::zero(),
head_payload_status: PayloadStatus::Pending,
},
_phantom: PhantomData,
};
@@ -588,7 +585,6 @@ where
.and_then(|b| b.execution_status.block_hash());
self.forkchoice_update_parameters = ForkchoiceUpdateParameters {
head_root,
head_payload_status,
head_hash,
justified_hash,
finalized_hash,
@@ -684,7 +680,6 @@ where
pub fn cached_fork_choice_view(&self) -> ForkChoiceView {
ForkChoiceView {
head_block_root: self.forkchoice_update_parameters.head_root,
head_payload_status: self.forkchoice_update_parameters.head_payload_status,
justified_checkpoint: self.justified_checkpoint(),
finalized_checkpoint: self.finalized_checkpoint(),
}
@@ -1769,7 +1764,6 @@ where
finalized_hash: None,
// Will be updated in the following call to `Self::get_head`.
head_root: Hash256::zero(),
head_payload_status: PayloadStatus::Pending,
},
_phantom: PhantomData,
};

View File

@@ -13,7 +13,7 @@ use execution_layer::{
LATEST_TAG, PayloadAttributes, PayloadParameters, PayloadStatus,
};
use fixed_bytes::FixedBytesExtended;
use fork_choice::{ForkchoiceUpdateParameters, PayloadStatus as FcPayloadStatus};
use fork_choice::ForkchoiceUpdateParameters;
use reqwest::{Client, header::CONTENT_TYPE};
use sensitive_url::SensitiveUrl;
use serde_json::{Value, json};
@@ -294,7 +294,6 @@ impl<Engine: GenericExecutionEngine> TestRig<Engine> {
let finalized_block_hash = ExecutionBlockHash::zero();
let forkchoice_update_params = ForkchoiceUpdateParameters {
head_root,
head_payload_status: FcPayloadStatus::Pending,
head_hash: Some(parent_hash),
justified_hash: Some(justified_block_hash),
finalized_hash: Some(finalized_block_hash),