mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Merge remote-tracking branch 'origin/release-v7.0.0' into unstable
This commit is contained in:
@@ -144,11 +144,6 @@ pub const FORK_CHOICE_DB_KEY: Hash256 = Hash256::ZERO;
|
||||
/// Defines how old a block can be before it's no longer a candidate for the early attester cache.
|
||||
const EARLY_ATTESTER_CACHE_HISTORIC_SLOTS: u64 = 4;
|
||||
|
||||
/// Defines a distance between the head block slot and the current slot.
|
||||
///
|
||||
/// If the head block is older than this value, don't bother preparing beacon proposers.
|
||||
const PREPARE_PROPOSER_HISTORIC_EPOCHS: u64 = 4;
|
||||
|
||||
/// If the head is more than `MAX_PER_SLOT_FORK_CHOICE_DISTANCE` slots behind the wall-clock slot, DO NOT
|
||||
/// run the per-slot tasks (primarily fork choice).
|
||||
///
|
||||
@@ -4848,7 +4843,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
let proposer_index = if let Some(proposer) = cached_proposer {
|
||||
proposer.index as u64
|
||||
} else {
|
||||
if head_epoch + 2 < proposal_epoch {
|
||||
if head_epoch + self.config.sync_tolerance_epochs < proposal_epoch {
|
||||
warn!(
|
||||
self.log,
|
||||
"Skipping proposer preparation";
|
||||
@@ -6079,19 +6074,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
// Use a blocking task since blocking the core executor on the canonical head read lock can
|
||||
// block the core tokio executor.
|
||||
let chain = self.clone();
|
||||
let tolerance_slots = self.config.sync_tolerance_epochs * T::EthSpec::slots_per_epoch();
|
||||
let maybe_prep_data = self
|
||||
.spawn_blocking_handle(
|
||||
move || {
|
||||
let cached_head = chain.canonical_head.cached_head();
|
||||
|
||||
// Don't bother with proposer prep if the head is more than
|
||||
// `PREPARE_PROPOSER_HISTORIC_EPOCHS` prior to the current slot.
|
||||
// `sync_tolerance_epochs` prior to the current slot.
|
||||
//
|
||||
// This prevents the routine from running during sync.
|
||||
let head_slot = cached_head.head_slot();
|
||||
if head_slot + T::EthSpec::slots_per_epoch() * PREPARE_PROPOSER_HISTORIC_EPOCHS
|
||||
< current_slot
|
||||
{
|
||||
if head_slot + tolerance_slots < current_slot {
|
||||
debug!(
|
||||
chain.log,
|
||||
"Head too old for proposer prep";
|
||||
|
||||
@@ -171,7 +171,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
return BellatrixReadiness::NotSynced;
|
||||
}
|
||||
let params = MergeConfig::from_chainspec(&self.spec);
|
||||
let current_difficulty = el.get_current_difficulty().await.ok();
|
||||
let current_difficulty = el.get_current_difficulty().await.ok().flatten();
|
||||
BellatrixReadiness::Ready {
|
||||
config: params,
|
||||
current_difficulty,
|
||||
|
||||
@@ -16,6 +16,9 @@ pub const DEFAULT_PREPARE_PAYLOAD_LOOKAHEAD_FACTOR: u32 = 3;
|
||||
/// Fraction of a slot lookahead for fork choice in the state advance timer (500ms on mainnet).
|
||||
pub const FORK_CHOICE_LOOKAHEAD_FACTOR: u32 = 24;
|
||||
|
||||
/// Default sync tolerance epochs.
|
||||
pub const DEFAULT_SYNC_TOLERANCE_EPOCHS: u64 = 2;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
|
||||
pub struct ChainConfig {
|
||||
/// Maximum number of slots to skip when importing an attestation.
|
||||
@@ -94,6 +97,9 @@ pub struct ChainConfig {
|
||||
/// The delay in milliseconds applied by the node between sending each blob or data column batch.
|
||||
/// This doesn't apply if the node is the block proposer.
|
||||
pub blob_publication_batch_interval: Duration,
|
||||
/// The max distance between the head block and the current slot at which Lighthouse will
|
||||
/// consider itself synced and still serve validator-related requests.
|
||||
pub sync_tolerance_epochs: u64,
|
||||
/// Artificial delay for block publishing. For PeerDAS testing only.
|
||||
pub block_publishing_delay: Option<Duration>,
|
||||
/// Artificial delay for data column publishing. For PeerDAS testing only.
|
||||
@@ -133,6 +139,7 @@ impl Default for ChainConfig {
|
||||
enable_sampling: false,
|
||||
blob_publication_batches: 4,
|
||||
blob_publication_batch_interval: Duration::from_millis(300),
|
||||
sync_tolerance_epochs: DEFAULT_SYNC_TOLERANCE_EPOCHS,
|
||||
block_publishing_delay: None,
|
||||
data_column_publishing_delay: None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user