diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index bed2b98557b..e6c26e539c8 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -3659,26 +3659,6 @@ impl BeaconChain { self.canonical_head.read().fork_choice.contains_block(root) } - pub fn prepare_beacon_proposer_blocking(self: &Arc) -> Result<(), Error> { - let current_slot = self.slot()?; - - // Avoids raising an error before Bellatrix. - // - // See `Self::prepare_beacon_proposer_async` for more detail. - if self.slot_is_prior_to_bellatrix(current_slot + 1) { - return Ok(()); - } - - let execution_layer = self - .execution_layer - .as_ref() - .ok_or(Error::ExecutionLayerMissing)?; - - execution_layer - .block_on_generic(|_| self.prepare_beacon_proposer_async(current_slot)) - .map_err(Error::PrepareProposerBlockingFailed)? - } - /// Determines the beacon proposer for the next slot. If that proposer is registered in the /// `execution_layer`, provide the `execution_layer` with the necessary information to produce /// `PayloadAttributes` for future calls to fork choice. @@ -3691,7 +3671,7 @@ impl BeaconChain { /// 1. We're in the tail-end of the slot (as defined by PAYLOAD_PREPARATION_LOOKAHEAD_FACTOR) /// 2. The head block is one slot (or less) behind the prepare slot (e.g., we're preparing for /// the next slot and the block at the current slot is already known). - pub async fn prepare_beacon_proposer_async( + pub async fn prepare_beacon_proposer( self: &Arc, current_slot: Slot, ) -> Result<(), Error> { @@ -3897,14 +3877,14 @@ impl BeaconChain { // Use the blocking method here so that we don't form a queue of these functions when // routinely calling them. - self.update_execution_engine_forkchoice_async(current_slot, forkchoice_update_params) + self.update_execution_engine_forkchoice(current_slot, forkchoice_update_params) .await?; } Ok(()) } - pub async fn update_execution_engine_forkchoice_async( + pub async fn update_execution_engine_forkchoice( self: &Arc, current_slot: Slot, params: ForkchoiceUpdateParameters, diff --git a/beacon_node/beacon_chain/src/proposer_prep_service.rs b/beacon_node/beacon_chain/src/proposer_prep_service.rs index 18abbc8c5bf..9cd177b3409 100644 --- a/beacon_node/beacon_chain/src/proposer_prep_service.rs +++ b/beacon_node/beacon_chain/src/proposer_prep_service.rs @@ -51,9 +51,7 @@ async fn proposer_prep_service( executor.spawn( async move { if let Ok(current_slot) = inner_chain.slot() { - if let Err(e) = inner_chain - .prepare_beacon_proposer_async(current_slot) - .await + if let Err(e) = inner_chain.prepare_beacon_proposer(current_slot).await { error!( inner_chain.log, diff --git a/beacon_node/beacon_chain/src/recompute_head.rs b/beacon_node/beacon_chain/src/recompute_head.rs index 575f846d7a9..aeaa7fc2beb 100644 --- a/beacon_node/beacon_chain/src/recompute_head.rs +++ b/beacon_node/beacon_chain/src/recompute_head.rs @@ -517,16 +517,13 @@ fn spawn_execution_layer_updates( async move { // Avoids raising an error before Bellatrix. // - // See `Self::prepare_beacon_proposer_async` for more detail. + // See `Self::prepare_beacon_proposer` for more detail. if chain.slot_is_prior_to_bellatrix(current_slot + 1) { return; } if let Err(e) = chain - .update_execution_engine_forkchoice_async( - current_slot, - forkchoice_update_params, - ) + .update_execution_engine_forkchoice(current_slot, forkchoice_update_params) .await { crit!( @@ -544,7 +541,7 @@ fn spawn_execution_layer_updates( // // This seems OK. It's not a significant waste of EL<>CL bandwidth or resources, as far as I // know. - if let Err(e) = chain.prepare_beacon_proposer_async(current_slot).await { + if let Err(e) = chain.prepare_beacon_proposer(current_slot).await { crit!( chain.log, "Failed to prepare proposers after fork choice"; diff --git a/beacon_node/beacon_chain/tests/payload_invalidation.rs b/beacon_node/beacon_chain/tests/payload_invalidation.rs index 0c3ac776aa7..83fdc1b0128 100644 --- a/beacon_node/beacon_chain/tests/payload_invalidation.rs +++ b/beacon_node/beacon_chain/tests/payload_invalidation.rs @@ -991,7 +991,8 @@ async fn payload_preparation() { rig.harness .chain - .prepare_beacon_proposer_blocking() + .prepare_beacon_proposer(rig.harness.chain.slot().unwrap()) + .await .unwrap(); let payload_attributes = PayloadAttributes { @@ -1116,7 +1117,7 @@ async fn payload_preparation_before_transition_block() { rig.harness .chain - .prepare_beacon_proposer_async(current_slot) + .prepare_beacon_proposer(current_slot) .await .unwrap(); let forkchoice_update_params = rig @@ -1129,7 +1130,7 @@ async fn payload_preparation_before_transition_block() { .unwrap(); rig.harness .chain - .update_execution_engine_forkchoice_async(current_slot, forkchoice_update_params) + .update_execution_engine_forkchoice(current_slot, forkchoice_update_params) .await .unwrap();