Add Electra fork boilerplate (#5122)

* Add Electra fork boilerplate

* Remove electra from spec tests

* Fix tests

* Remove sneaky log file

* Fix more tests

* Fix even more tests and add suggestions

* Remove unrelated lcli addition

* Update more tests

* Merge branch 'unstable' into electra

* Add comment for test-suite lcli override

* Merge branch 'unstable' into electra

* Cleanup

* Merge branch 'unstable' into electra

* Apply suggestions

* Merge branch 'unstable' into electra

* Merge sigp/unstable into electra

* Merge branch 'unstable' into electra
This commit is contained in:
Mac L
2024-04-02 23:35:02 +11:00
committed by GitHub
parent 3058b96f25
commit f8fdb71f50
105 changed files with 2079 additions and 405 deletions

View File

@@ -2,6 +2,7 @@ use crate::metrics;
use beacon_chain::{
capella_readiness::CapellaReadiness,
deneb_readiness::DenebReadiness,
electra_readiness::ElectraReadiness,
merge_readiness::{GenesisExecutionPayloadStatus, MergeConfig, MergeReadiness},
BeaconChain, BeaconChainTypes, ExecutionStatus,
};
@@ -321,6 +322,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
merge_readiness_logging(current_slot, &beacon_chain, &log).await;
capella_readiness_logging(current_slot, &beacon_chain, &log).await;
deneb_readiness_logging(current_slot, &beacon_chain, &log).await;
electra_readiness_logging(current_slot, &beacon_chain, &log).await;
}
};
@@ -512,8 +514,7 @@ async fn deneb_readiness_logging<T: BeaconChainTypes>(
error!(
log,
"Execution endpoint required";
"info" => "you need a Deneb enabled execution engine to validate blocks, see: \
https://lighthouse-book.sigmaprime.io/merge-migration.html"
"info" => "you need a Deneb enabled execution engine to validate blocks."
);
return;
}
@@ -542,6 +543,66 @@ async fn deneb_readiness_logging<T: BeaconChainTypes>(
),
}
}
/// Provides some helpful logging to users to indicate if their node is ready for Electra.
async fn electra_readiness_logging<T: BeaconChainTypes>(
current_slot: Slot,
beacon_chain: &BeaconChain<T>,
log: &Logger,
) {
// TODO(electra): Once Electra has features, this code can be swapped back.
let electra_completed = false;
//let electra_completed = beacon_chain
// .canonical_head
// .cached_head()
// .snapshot
// .beacon_block
// .message()
// .body()
// .execution_payload()
// .map_or(false, |payload| payload.electra_placeholder().is_ok());
let has_execution_layer = beacon_chain.execution_layer.is_some();
if electra_completed && has_execution_layer
|| !beacon_chain.is_time_to_prepare_for_electra(current_slot)
{
return;
}
if electra_completed && !has_execution_layer {
// When adding a new fork, add a check for the next fork readiness here.
error!(
log,
"Execution endpoint required";
"info" => "you need a Electra enabled execution engine to validate blocks."
);
return;
}
match beacon_chain.check_electra_readiness().await {
ElectraReadiness::Ready => {
info!(
log,
"Ready for Electra";
"info" => "ensure the execution endpoint is updated to the latest Electra/Prague release"
)
}
readiness @ ElectraReadiness::ExchangeCapabilitiesFailed { error: _ } => {
error!(
log,
"Not ready for Electra";
"hint" => "the execution endpoint may be offline",
"info" => %readiness,
)
}
readiness => warn!(
log,
"Not ready for Electra";
"hint" => "try updating the execution endpoint",
"info" => %readiness,
),
}
}
async fn genesis_execution_payload_logging<T: BeaconChainTypes>(
beacon_chain: &BeaconChain<T>,