mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Merge branch 'unstable' of https://github.com/sigp/lighthouse into gloas-block-and-bid-production
This commit is contained in:
@@ -41,7 +41,7 @@ use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use store::{Error as StoreError, HotColdDB, ItemStore, KeyValueStoreOp};
|
||||
use task_executor::{ShutdownReason, TaskExecutor};
|
||||
use tracing::{debug, error, info};
|
||||
use tracing::{debug, error, info, warn};
|
||||
use tree_hash::TreeHash;
|
||||
use types::data::CustodyIndex;
|
||||
use types::{
|
||||
@@ -848,6 +848,33 @@ where
|
||||
));
|
||||
}
|
||||
|
||||
// Check if the head snapshot is within the weak subjectivity period
|
||||
let head_state = &head_snapshot.beacon_state;
|
||||
let Ok(ws_period) = head_state.compute_weak_subjectivity_period(&self.spec) else {
|
||||
return Err(format!(
|
||||
"Unable to compute the weak subjectivity period at the head snapshot slot: {:?}",
|
||||
head_state.slot()
|
||||
));
|
||||
};
|
||||
if current_slot.epoch(E::slots_per_epoch())
|
||||
> head_state.slot().epoch(E::slots_per_epoch()) + ws_period
|
||||
{
|
||||
if self.chain_config.ignore_ws_check {
|
||||
warn!(
|
||||
head_slot=%head_state.slot(),
|
||||
%current_slot,
|
||||
"The current head state is outside the weak subjectivity period. You are currently running a node that is susceptible to long range attacks. \
|
||||
It is highly recommended to purge your db and checkpoint sync. For more information please \
|
||||
read this blog post: https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity"
|
||||
)
|
||||
}
|
||||
return Err(
|
||||
"The current head state is outside the weak subjectivity period. A node in this state is susceptible to long range attacks. You should purge your db and \
|
||||
checkpoint sync. For more information please read this blog post: https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity \
|
||||
If you understand the risks, it is possible to ignore this error with the --ignore-ws-check flag.".to_string()
|
||||
);
|
||||
}
|
||||
|
||||
let validator_pubkey_cache = self
|
||||
.validator_pubkey_cache
|
||||
.map(|mut validator_pubkey_cache| {
|
||||
|
||||
@@ -117,6 +117,8 @@ pub struct ChainConfig {
|
||||
/// On Holesky there is a block which is added to this set by default but which can be removed
|
||||
/// by using `--invalid-block-roots ""`.
|
||||
pub invalid_block_roots: HashSet<Hash256>,
|
||||
/// When set to true, the beacon node can be started even if the head state is outside the weak subjectivity period.
|
||||
pub ignore_ws_check: bool,
|
||||
/// Disable the getBlobs optimisation to fetch blobs from the EL mempool.
|
||||
pub disable_get_blobs: bool,
|
||||
/// The node's custody type, determining how many data columns to custody and sample.
|
||||
@@ -160,6 +162,7 @@ impl Default for ChainConfig {
|
||||
block_publishing_delay: None,
|
||||
data_column_publishing_delay: None,
|
||||
invalid_block_roots: HashSet::new(),
|
||||
ignore_ws_check: false,
|
||||
disable_get_blobs: false,
|
||||
node_custody_type: NodeCustodyType::Fullnode,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user