Don't log crits for missing EE before Bellatrix (#3150)
## Issue Addressed NA ## Proposed Changes Fixes an issue introduced in #3088 which was causing unnecessary `crit` logs on networks without Bellatrix enabled. ## Additional Info NA
This commit is contained in:
parent
fff4dd6311
commit
c8edeaff29
@ -3715,13 +3715,22 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
pub fn prepare_beacon_proposer_blocking(&self) -> 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())
|
||||
.block_on_generic(|_| self.prepare_beacon_proposer_async(current_slot))
|
||||
.map_err(Error::PrepareProposerBlockingFailed)?
|
||||
}
|
||||
|
||||
@ -3737,17 +3746,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
/// 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(&self) -> Result<(), Error> {
|
||||
let current_slot = self.slot()?;
|
||||
pub async fn prepare_beacon_proposer_async(&self, current_slot: Slot) -> Result<(), Error> {
|
||||
let prepare_slot = current_slot + 1;
|
||||
let prepare_epoch = prepare_slot.epoch(T::EthSpec::slots_per_epoch());
|
||||
|
||||
// There's no need to run the proposer preparation routine before the bellatrix fork.
|
||||
if self
|
||||
.spec
|
||||
.bellatrix_fork_epoch
|
||||
.map_or(true, |bellatrix| prepare_epoch < bellatrix)
|
||||
{
|
||||
if self.slot_is_prior_to_bellatrix(prepare_slot) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@ -3947,6 +3951,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
&self,
|
||||
current_slot: Slot,
|
||||
) -> Result<(), Error> {
|
||||
// Avoids raising an error before Bellatrix.
|
||||
//
|
||||
// See `Self::update_execution_engine_forkchoice_async` for more detail.
|
||||
if self.slot_is_prior_to_bellatrix(current_slot + 1) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let execution_layer = self
|
||||
.execution_layer
|
||||
.as_ref()
|
||||
@ -3972,9 +3983,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
// The reason for a fcU message in the slot prior to the Bellatrix fork is in case the
|
||||
// terminal difficulty has already been reached and a payload preparation message needs to
|
||||
// be issued.
|
||||
if self.spec.bellatrix_fork_epoch.map_or(true, |bellatrix| {
|
||||
next_slot.epoch(T::EthSpec::slots_per_epoch()) < bellatrix
|
||||
}) {
|
||||
if self.slot_is_prior_to_bellatrix(next_slot) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@ -4068,10 +4077,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let forkchoice_updated_response = self
|
||||
.execution_layer
|
||||
.as_ref()
|
||||
.ok_or(Error::ExecutionLayerMissing)?
|
||||
let forkchoice_updated_response = execution_layer
|
||||
.notify_forkchoice_updated(head_hash, finalized_hash, current_slot, head_block_root)
|
||||
.await
|
||||
.map_err(Error::ExecutionForkChoiceUpdateFailed);
|
||||
@ -4159,6 +4165,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if the given slot is prior to the `bellatrix_fork_epoch`.
|
||||
fn slot_is_prior_to_bellatrix(&self, slot: Slot) -> bool {
|
||||
self.spec.bellatrix_fork_epoch.map_or(true, |bellatrix| {
|
||||
slot.epoch(T::EthSpec::slots_per_epoch()) < bellatrix
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the status of the current head block, regarding the validity of the execution
|
||||
/// payload.
|
||||
pub fn head_safety_status(&self) -> Result<HeadSafetyStatus, BeaconChainError> {
|
||||
|
@ -50,12 +50,19 @@ async fn proposer_prep_service<T: BeaconChainTypes>(
|
||||
let inner_chain = chain.clone();
|
||||
executor.spawn(
|
||||
async move {
|
||||
if let Err(e) = inner_chain.prepare_beacon_proposer_async().await {
|
||||
error!(
|
||||
inner_chain.log,
|
||||
"Proposer prepare routine failed";
|
||||
"error" => ?e
|
||||
);
|
||||
if let Ok(current_slot) = inner_chain.slot() {
|
||||
if let Err(e) = inner_chain
|
||||
.prepare_beacon_proposer_async(current_slot)
|
||||
.await
|
||||
{
|
||||
error!(
|
||||
inner_chain.log,
|
||||
"Proposer prepare routine failed";
|
||||
"error" => ?e
|
||||
);
|
||||
}
|
||||
} else {
|
||||
debug!(inner_chain.log, "No slot for proposer prepare routine");
|
||||
}
|
||||
},
|
||||
"proposer_prep_update",
|
||||
|
Loading…
Reference in New Issue
Block a user