mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +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| {
|
||||
|
||||
Reference in New Issue
Block a user