diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 9fa32d5dcc..3c8ea30779 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -4898,6 +4898,9 @@ impl BeaconChain { 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 BeaconChain { .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, diff --git a/beacon_node/beacon_chain/src/canonical_head.rs b/beacon_node/beacon_chain/src/canonical_head.rs index 2715567cb3..d74f162ded 100644 --- a/beacon_node/beacon_chain/src/canonical_head.rs +++ b/beacon_node/beacon_chain/src/canonical_head.rs @@ -229,7 +229,6 @@ impl CachedHead { 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 CanonicalHead { 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 CanonicalHead { 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 BeaconChain { // 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 BeaconChain { }); } - // 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 BeaconChain { 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 BeaconChain { 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, diff --git a/beacon_node/execution_layer/src/test_utils/mock_builder.rs b/beacon_node/execution_layer/src/test_utils/mock_builder.rs index aa7e309f2c..7b6c4e8310 100644 --- a/beacon_node/execution_layer/src/test_utils/mock_builder.rs +++ b/beacon_node/execution_layer/src/test_utils/mock_builder.rs @@ -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 MockBuilder { 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 diff --git a/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs b/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs index 0aee30dff0..91966ff65e 100644 --- a/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs +++ b/beacon_node/execution_layer/src/test_utils/mock_execution_layer.rs @@ -92,7 +92,6 @@ impl MockExecutionLayer { 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, diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index 8fcf1373e1..16bccc0618 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -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, pub justified_hash: Option, pub finalized_hash: Option, @@ -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, }; diff --git a/testing/execution_engine_integration/src/test_rig.rs b/testing/execution_engine_integration/src/test_rig.rs index 2c20a41489..6bf4a1aa52 100644 --- a/testing/execution_engine_integration/src/test_rig.rs +++ b/testing/execution_engine_integration/src/test_rig.rs @@ -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 TestRig { 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),