mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
resolve merge conflicts
This commit is contained in:
@@ -42,6 +42,6 @@ types = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
operation_pool = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
state_processing = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
yaml_serde = { workspace = true }
|
||||
|
||||
@@ -43,7 +43,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use store::database::interface::BeaconNodeBackend;
|
||||
use timer::spawn_timer;
|
||||
use tracing::{debug, info, instrument, warn};
|
||||
use types::data_column_custody_group::compute_ordered_custody_column_indices;
|
||||
use types::data::compute_ordered_custody_column_indices;
|
||||
use types::{
|
||||
BeaconState, BlobSidecarList, ChainSpec, EthSpec, ExecutionBlockHash, Hash256,
|
||||
SignedBeaconBlock, test_utils::generate_deterministic_keypairs,
|
||||
@@ -281,7 +281,7 @@ where
|
||||
validator_count,
|
||||
genesis_time,
|
||||
} => {
|
||||
let execution_payload_header = generate_genesis_header(&spec, true);
|
||||
let execution_payload_header = generate_genesis_header(&spec);
|
||||
let keypairs = generate_deterministic_keypairs(validator_count);
|
||||
let genesis_state = interop_genesis_state(
|
||||
&keypairs,
|
||||
@@ -315,7 +315,7 @@ where
|
||||
let deneb_time = genesis_time
|
||||
+ (deneb_fork_epoch.as_u64()
|
||||
* E::slots_per_epoch()
|
||||
* spec.seconds_per_slot);
|
||||
* spec.get_slot_duration().as_secs());
|
||||
|
||||
// Shrink the blob availability window so users don't start
|
||||
// a sync right before blobs start to disappear from the P2P
|
||||
@@ -325,7 +325,7 @@ where
|
||||
.saturating_sub(BLOB_AVAILABILITY_REDUCTION_EPOCHS);
|
||||
let blob_availability_window = reduced_p2p_availability_epochs
|
||||
* E::slots_per_epoch()
|
||||
* spec.seconds_per_slot;
|
||||
* spec.get_slot_duration().as_secs();
|
||||
|
||||
if now > deneb_time + blob_availability_window {
|
||||
return Err(
|
||||
@@ -592,17 +592,17 @@ where
|
||||
.network_globals
|
||||
.clone()
|
||||
.ok_or("slot_notifier requires a libp2p network")?;
|
||||
let seconds_per_slot = self
|
||||
let slot_duration = self
|
||||
.chain_spec
|
||||
.as_ref()
|
||||
.ok_or("slot_notifier requires a chain spec")?
|
||||
.seconds_per_slot;
|
||||
.get_slot_duration();
|
||||
|
||||
spawn_notifier(
|
||||
context.executor,
|
||||
beacon_chain,
|
||||
network_globals,
|
||||
seconds_per_slot,
|
||||
slot_duration,
|
||||
)
|
||||
.map_err(|e| format!("Unable to start slot notifier: {}", e))?;
|
||||
|
||||
@@ -721,10 +721,9 @@ where
|
||||
if let Some(execution_layer) = beacon_chain.execution_layer.as_ref() {
|
||||
// Only send a head update *after* genesis.
|
||||
if let Ok(current_slot) = beacon_chain.slot() {
|
||||
let params = beacon_chain
|
||||
.canonical_head
|
||||
.cached_head()
|
||||
.forkchoice_update_parameters();
|
||||
let cached_head = beacon_chain.canonical_head.cached_head();
|
||||
let head_payload_status = cached_head.head_payload_status();
|
||||
let params = cached_head.forkchoice_update_parameters();
|
||||
if params
|
||||
.head_hash
|
||||
.is_some_and(|hash| hash != ExecutionBlockHash::zero())
|
||||
@@ -737,6 +736,7 @@ where
|
||||
.update_execution_engine_forkchoice(
|
||||
current_slot,
|
||||
params,
|
||||
head_payload_status,
|
||||
Default::default(),
|
||||
)
|
||||
.await;
|
||||
@@ -906,7 +906,7 @@ where
|
||||
let slot_clock = SystemTimeSlotClock::new(
|
||||
spec.genesis_slot,
|
||||
Duration::from_secs(genesis_time),
|
||||
Duration::from_secs(spec.seconds_per_slot),
|
||||
spec.get_slot_duration(),
|
||||
);
|
||||
|
||||
self.slot_clock = Some(slot_clock);
|
||||
|
||||
@@ -236,7 +236,7 @@ mod tests {
|
||||
fn serde() {
|
||||
let config = Config::default();
|
||||
let serialized =
|
||||
serde_yaml::to_string(&config).expect("should serde encode default config");
|
||||
serde_yaml::from_str::<Config>(&serialized).expect("should serde decode default config");
|
||||
yaml_serde::to_string(&config).expect("should serde encode default config");
|
||||
yaml_serde::from_str::<Config>(&serialized).expect("should serde decode default config");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
use crate::metrics;
|
||||
use beacon_chain::{
|
||||
BeaconChain, BeaconChainTypes, ExecutionStatus,
|
||||
bellatrix_readiness::{
|
||||
BellatrixReadiness, GenesisExecutionPayloadStatus, MergeConfig, SECONDS_IN_A_WEEK,
|
||||
},
|
||||
bellatrix_readiness::GenesisExecutionPayloadStatus,
|
||||
};
|
||||
use execution_layer::{
|
||||
EngineCapabilities,
|
||||
http::{
|
||||
ENGINE_FORKCHOICE_UPDATED_V2, ENGINE_FORKCHOICE_UPDATED_V3, ENGINE_GET_PAYLOAD_V2,
|
||||
ENGINE_GET_PAYLOAD_V3, ENGINE_GET_PAYLOAD_V4, ENGINE_GET_PAYLOAD_V5, ENGINE_NEW_PAYLOAD_V2,
|
||||
ENGINE_NEW_PAYLOAD_V3, ENGINE_NEW_PAYLOAD_V4,
|
||||
ENGINE_GET_PAYLOAD_V3, ENGINE_GET_PAYLOAD_V4, ENGINE_GET_PAYLOAD_V5, ENGINE_GET_PAYLOAD_V6,
|
||||
ENGINE_NEW_PAYLOAD_V2, ENGINE_NEW_PAYLOAD_V3, ENGINE_NEW_PAYLOAD_V4, ENGINE_NEW_PAYLOAD_V5,
|
||||
},
|
||||
};
|
||||
use lighthouse_network::{NetworkGlobals, types::SyncState};
|
||||
@@ -36,6 +34,7 @@ const SPEEDO_OBSERVATIONS: usize = 4;
|
||||
/// The number of slots between logs that give detail about backfill process.
|
||||
const BACKFILL_LOG_INTERVAL: u64 = 5;
|
||||
|
||||
const SECONDS_IN_A_WEEK: u64 = 604800;
|
||||
pub const FORK_READINESS_PREPARATION_SECONDS: u64 = SECONDS_IN_A_WEEK * 2;
|
||||
pub const ENGINE_CAPABILITIES_REFRESH_INTERVAL: u64 = 300;
|
||||
|
||||
@@ -44,10 +43,8 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
executor: task_executor::TaskExecutor,
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
network: Arc<NetworkGlobals<T::EthSpec>>,
|
||||
seconds_per_slot: u64,
|
||||
slot_duration: Duration,
|
||||
) -> Result<(), String> {
|
||||
let slot_duration = Duration::from_secs(seconds_per_slot);
|
||||
|
||||
let speedo = Mutex::new(Speedo::default());
|
||||
|
||||
// Keep track of sync state and reset the speedo on specific sync state changes.
|
||||
@@ -72,7 +69,6 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
wait_time = estimated_time_pretty(Some(next_slot.as_secs() as f64)),
|
||||
"Waiting for genesis"
|
||||
);
|
||||
bellatrix_readiness_logging(Slot::new(0), &beacon_chain).await;
|
||||
post_bellatrix_readiness_logging(Slot::new(0), &beacon_chain).await;
|
||||
genesis_execution_payload_logging(&beacon_chain).await;
|
||||
sleep(slot_duration).await;
|
||||
@@ -364,7 +360,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
let block_info = if current_slot > head_slot {
|
||||
" … empty".to_string()
|
||||
} else {
|
||||
head_root.to_string()
|
||||
head_root.short().to_string()
|
||||
};
|
||||
|
||||
let block_hash = match beacon_chain.canonical_head.head_execution_status() {
|
||||
@@ -378,7 +374,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
warn!(
|
||||
info = "chain not fully verified, \
|
||||
block and attestation production disabled until execution engine syncs",
|
||||
execution_block_hash = ?hash,
|
||||
execution_block_hash = ?hash,
|
||||
"Head is optimistic"
|
||||
);
|
||||
format!("{} (unverified)", hash)
|
||||
@@ -397,7 +393,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
info!(
|
||||
peers = peer_count_pretty(connected_peer_count),
|
||||
exec_hash = block_hash,
|
||||
finalized_root = %finalized_checkpoint.root,
|
||||
finalized_root = %finalized_checkpoint.root.short(),
|
||||
finalized_epoch = %finalized_checkpoint.epoch,
|
||||
epoch = %current_epoch,
|
||||
block = block_info,
|
||||
@@ -408,7 +404,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
metrics::set_gauge(&metrics::IS_SYNCED, 0);
|
||||
info!(
|
||||
peers = peer_count_pretty(connected_peer_count),
|
||||
finalized_root = %finalized_checkpoint.root,
|
||||
finalized_root = %finalized_checkpoint.root.short(),
|
||||
finalized_epoch = %finalized_checkpoint.epoch,
|
||||
%head_slot,
|
||||
%current_slot,
|
||||
@@ -416,7 +412,6 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
);
|
||||
}
|
||||
|
||||
bellatrix_readiness_logging(current_slot, &beacon_chain).await;
|
||||
post_bellatrix_readiness_logging(current_slot, &beacon_chain).await;
|
||||
}
|
||||
};
|
||||
@@ -427,78 +422,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Provides some helpful logging to users to indicate if their node is ready for the Bellatrix
|
||||
/// fork and subsequent merge transition.
|
||||
async fn bellatrix_readiness_logging<T: BeaconChainTypes>(
|
||||
current_slot: Slot,
|
||||
beacon_chain: &BeaconChain<T>,
|
||||
) {
|
||||
let merge_completed = beacon_chain
|
||||
.canonical_head
|
||||
.cached_head()
|
||||
.snapshot
|
||||
.beacon_block
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.is_ok_and(|payload| payload.parent_hash() != ExecutionBlockHash::zero());
|
||||
|
||||
let has_execution_layer = beacon_chain.execution_layer.is_some();
|
||||
|
||||
if merge_completed && has_execution_layer
|
||||
|| !beacon_chain.is_time_to_prepare_for_bellatrix(current_slot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
match beacon_chain.check_bellatrix_readiness(current_slot).await {
|
||||
BellatrixReadiness::Ready {
|
||||
config,
|
||||
current_difficulty,
|
||||
} => match config {
|
||||
MergeConfig {
|
||||
terminal_total_difficulty: Some(ttd),
|
||||
terminal_block_hash: None,
|
||||
terminal_block_hash_epoch: None,
|
||||
} => {
|
||||
info!(
|
||||
terminal_total_difficulty = %ttd,
|
||||
current_difficulty = current_difficulty
|
||||
.map(|d| d.to_string())
|
||||
.unwrap_or_else(|| "??".into()),
|
||||
"Ready for Bellatrix"
|
||||
)
|
||||
}
|
||||
MergeConfig {
|
||||
terminal_total_difficulty: _,
|
||||
terminal_block_hash: Some(terminal_block_hash),
|
||||
terminal_block_hash_epoch: Some(terminal_block_hash_epoch),
|
||||
} => {
|
||||
info!(
|
||||
info = "you are using override parameters, please ensure that you \
|
||||
understand these parameters and their implications.",
|
||||
?terminal_block_hash,
|
||||
?terminal_block_hash_epoch,
|
||||
"Ready for Bellatrix"
|
||||
)
|
||||
}
|
||||
other => error!(
|
||||
config = ?other,
|
||||
"Inconsistent merge configuration"
|
||||
),
|
||||
},
|
||||
readiness @ BellatrixReadiness::NotSynced => warn!(
|
||||
info = %readiness,
|
||||
"Not ready Bellatrix"
|
||||
),
|
||||
readiness @ BellatrixReadiness::NoExecutionEndpoint => warn!(
|
||||
info = %readiness,
|
||||
"Not ready for Bellatrix"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
/// Provides some helpful logging to users to indicate if their node is ready for Capella
|
||||
/// Provides some helpful logging to users to indicate if their node is ready for upcoming forks
|
||||
async fn post_bellatrix_readiness_logging<T: BeaconChainTypes>(
|
||||
current_slot: Slot,
|
||||
beacon_chain: &BeaconChain<T>,
|
||||
@@ -568,8 +492,8 @@ fn find_next_fork_to_prepare<T: BeaconChainTypes>(
|
||||
// Find the first fork that is scheduled and close to happen
|
||||
if let Some(fork_epoch) = fork_epoch {
|
||||
let fork_slot = fork_epoch.start_slot(T::EthSpec::slots_per_epoch());
|
||||
let preparation_slots =
|
||||
FORK_READINESS_PREPARATION_SECONDS / beacon_chain.spec.seconds_per_slot;
|
||||
let preparation_slots = FORK_READINESS_PREPARATION_SECONDS
|
||||
/ beacon_chain.spec.get_slot_duration().as_secs();
|
||||
let in_fork_preparation_period = current_slot + preparation_slots > fork_slot;
|
||||
if in_fork_preparation_period {
|
||||
return Some(*fork);
|
||||
@@ -640,11 +564,11 @@ fn methods_required_for_fork(
|
||||
}
|
||||
}
|
||||
ForkName::Gloas => {
|
||||
if !capabilities.get_payload_v5 {
|
||||
missing_methods.push(ENGINE_GET_PAYLOAD_V5);
|
||||
if !capabilities.get_payload_v6 {
|
||||
missing_methods.push(ENGINE_GET_PAYLOAD_V6);
|
||||
}
|
||||
if !capabilities.new_payload_v4 {
|
||||
missing_methods.push(ENGINE_NEW_PAYLOAD_V4);
|
||||
if !capabilities.new_payload_v5 {
|
||||
missing_methods.push(ENGINE_NEW_PAYLOAD_V5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user