Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - v2.2.1 #3149

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion beacon_node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beacon_node"
version = "2.2.0"
version = "2.2.1"
authors = ["Paul Hauner <paul@paulhauner.com>", "Age Manning <Age@AgeManning.com"]
edition = "2021"

Expand Down
43 changes: 28 additions & 15 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
}

Expand All @@ -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(());
}

Expand Down Expand Up @@ -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()
Expand All @@ -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(());
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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> {
Expand Down
19 changes: 13 additions & 6 deletions beacon_node/beacon_chain/src/proposer_prep_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion boot_node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "boot_node"
version = "2.2.0"
version = "2.2.1"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion common/lighthouse_version/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub const VERSION: &str = git_version!(
// NOTE: using --match instead of --exclude for compatibility with old Git
"--match=thiswillnevermatchlol"
],
prefix = "Lighthouse/v2.2.0-",
prefix = "Lighthouse/v2.2.1-",
fallback = "unknown"
);

Expand Down
2 changes: 1 addition & 1 deletion lcli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "lcli"
description = "Lighthouse CLI (modeled after zcli)"
version = "2.2.0"
version = "2.2.1"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion lighthouse/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lighthouse"
version = "2.2.0"
version = "2.2.1"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = "2021"
autotests = false
Expand Down