Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/stable' into unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Aug 13, 2024
2 parents 22ccdb6 + d6ba8c3 commit 3a996fb
Show file tree
Hide file tree
Showing 19 changed files with 146 additions and 89 deletions.
11 changes: 5 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bytes = "1"
clap = { version = "4.5.4", features = ["derive", "cargo", "wrap_help"] }
# Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable
# feature ourselves when desired.
c-kzg = { version = "1", default-features = false }
c-kzg = { version = "1", default-features = false }
compare_fields_derive = { path = "common/compare_fields_derive" }
criterion = "0.5"
delay_map = "0.3"
Expand Down Expand Up @@ -240,6 +240,9 @@ validator_client = { path = "validator_client" }
validator_dir = { path = "common/validator_dir" }
warp_utils = { path = "common/warp_utils" }

[patch.crates-io]
quick-protobuf = { git = "https://github.com/sigp/quick-protobuf.git", rev = "681f413312404ab6e51f0b46f39b0075c6f4ebfd" }

[profile.maxperf]
inherits = "release"
lto = "fat"
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beacon_node"
version = "5.2.1"
version = "5.3.0"
authors = [
"Paul Hauner <paul@paulhauner.com>",
"Age Manning <Age@AgeManning.com",
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/src/canonical_head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use fork_choice::{
};
use itertools::process_results;
use parking_lot::{Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard};
use slog::{crit, debug, error, warn, Logger};
use slog::{crit, debug, error, info, warn, Logger};
use slot_clock::SlotClock;
use state_processing::AllCaches;
use std::sync::Arc;
Expand Down Expand Up @@ -1212,7 +1212,7 @@ fn detect_reorg<E: EthSpec>(
&metrics::FORK_CHOICE_REORG_DISTANCE,
reorg_distance.as_u64() as i64,
);
warn!(
info!(
log,
"Beacon chain re-org";
"previous_head" => ?old_block_root,
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/eth1/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ impl Service {

Ok(BlockCacheUpdateOutcome {
blocks_imported,
head_block_number: self.inner.block_cache.read().highest_block_number(),
head_block_number: block_cache.highest_block_number(),
})
}
}
Expand Down
12 changes: 4 additions & 8 deletions beacon_node/network/src/sync/range_sync/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ pub struct SyncingChain<T: BeaconChainTypes> {
/// The current processing batch, if any.
current_processing_batch: Option<BatchId>,

/// Batches validated by this chain.
validated_batches: u64,

/// The chain's log.
log: slog::Logger,
}
Expand Down Expand Up @@ -161,7 +158,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
attempted_optimistic_starts: HashSet::default(),
state: ChainSyncingState::Stopped,
current_processing_batch: None,
validated_batches: 0,
log: log.new(o!("chain" => id)),
}
}
Expand All @@ -182,8 +178,10 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
}

/// Progress in epochs made by the chain
pub fn validated_epochs(&self) -> u64 {
self.validated_batches * EPOCHS_PER_BATCH
pub fn processed_epochs(&self) -> u64 {
self.processing_target
.saturating_sub(self.start_epoch)
.into()
}

/// Returns the total count of pending blocks in all the batches of this chain
Expand Down Expand Up @@ -655,7 +653,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
let removed_batches = std::mem::replace(&mut self.batches, remaining_batches);

for (id, batch) in removed_batches.into_iter() {
self.validated_batches = self.validated_batches.saturating_add(1);
// only for batches awaiting validation can we be sure the last attempt is
// right, and thus, that any different attempt is wrong
match batch.state() {
Expand Down Expand Up @@ -1212,7 +1209,6 @@ impl<T: BeaconChainTypes> slog::KV for SyncingChain<T> {
)?;
serializer.emit_usize("batches", self.batches.len())?;
serializer.emit_usize("peers", self.peers.len())?;
serializer.emit_u64("validated_batches", self.validated_batches)?;
serializer.emit_arguments("state", &format_args!("{:?}", self.state))?;
slog::Result::Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions beacon_node/network/src/sync/range_sync/chain_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use types::{Epoch, Hash256, Slot};
const PARALLEL_HEAD_CHAINS: usize = 2;

/// Minimum work we require a finalized chain to do before picking a chain with more peers.
const MIN_FINALIZED_CHAIN_VALIDATED_EPOCHS: u64 = 10;
const MIN_FINALIZED_CHAIN_PROCESSED_EPOCHS: u64 = 10;

/// The state of the long range/batch sync.
#[derive(Clone)]
Expand Down Expand Up @@ -273,8 +273,8 @@ impl<T: BeaconChainTypes, C: BlockStorage> ChainCollection<T, C> {
// chains are different, check that they don't have the same number of peers
if let Some(syncing_chain) = self.finalized_chains.get_mut(&syncing_id) {
if max_peers > syncing_chain.available_peers()
&& syncing_chain.validated_epochs()
> MIN_FINALIZED_CHAIN_VALIDATED_EPOCHS
&& syncing_chain.processed_epochs()
> MIN_FINALIZED_CHAIN_PROCESSED_EPOCHS
{
syncing_chain.stop_syncing();
old_id = Some(Some(syncing_id));
Expand Down
4 changes: 2 additions & 2 deletions book/src/late-block-re-orgs.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ A pair of messages at `INFO` level will be logged if a re-org opportunity is det
> INFO Proposing block to re-org current head head_to_reorg: 0xf64f…2b49, slot: 1105320
This should be followed shortly after by a `WARN` log indicating that a re-org occurred. This is
This should be followed shortly after by a `INFO` log indicating that a re-org occurred. This is
expected and normal:

> WARN Beacon chain re-org reorg_distance: 1, new_slot: 1105320, new_head: 0x72791549e4ca792f91053bc7cf1e55c6fbe745f78ce7a16fc3acb6f09161becd, previous_slot: 1105319, previous_head: 0xf64f8e5ed617dc18c1e759dab5d008369767c3678416dac2fe1d389562842b49
> INFO Beacon chain re-org reorg_distance: 1, new_slot: 1105320, new_head: 0x72791549e4ca792f91053bc7cf1e55c6fbe745f78ce7a16fc3acb6f09161becd, previous_slot: 1105319, previous_head: 0xf64f8e5ed617dc18c1e759dab5d008369767c3678416dac2fe1d389562842b49
In case a re-org is not viable (which should be most of the time), Lighthouse will just propose a
block as normal and log the reason the re-org was not attempted at debug level:
Expand Down
2 changes: 1 addition & 1 deletion boot_node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "boot_node"
version = "5.2.1"
version = "5.3.0"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = { workspace = true }

Expand Down
9 changes: 8 additions & 1 deletion common/eth2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ impl fmt::Display for Error {
pub struct Timeouts {
pub attestation: Duration,
pub attester_duties: Duration,
pub attestation_subscriptions: Duration,
pub liveness: Duration,
pub proposal: Duration,
pub proposer_duties: Duration,
Expand All @@ -137,6 +138,7 @@ impl Timeouts {
Timeouts {
attestation: timeout,
attester_duties: timeout,
attestation_subscriptions: timeout,
liveness: timeout,
proposal: timeout,
proposer_duties: timeout,
Expand Down Expand Up @@ -2540,7 +2542,12 @@ impl BeaconNodeHttpClient {
.push("validator")
.push("beacon_committee_subscriptions");

self.post(path, &subscriptions).await?;
self.post_with_timeout(
path,
&subscriptions,
self.timeouts.attestation_subscriptions,
)
.await?;

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions common/lighthouse_version/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub const VERSION: &str = git_version!(
// NOTE: using --match instead of --exclude for compatibility with old Git
"--match=thiswillnevermatchlol"
],
prefix = "Lighthouse/v5.2.1-",
fallback = "Lighthouse/v5.2.1"
prefix = "Lighthouse/v5.3.0-",
fallback = "Lighthouse/v5.3.0"
);

/// Returns the first eight characters of the latest commit hash for this build.
Expand Down
15 changes: 15 additions & 0 deletions consensus/types/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,10 +1372,13 @@ pub struct Config {
#[serde(with = "serde_utils::quoted_u64")]
max_per_epoch_activation_exit_churn_limit: u64,

#[serde(default = "default_custody_requirement")]
#[serde(with = "serde_utils::quoted_u64")]
custody_requirement: u64,
#[serde(default = "default_data_column_sidecar_subnet_count")]
#[serde(with = "serde_utils::quoted_u64")]
data_column_sidecar_subnet_count: u64,
#[serde(default = "default_number_of_columns")]
#[serde(with = "serde_utils::quoted_u64")]
number_of_columns: u64,
}
Expand Down Expand Up @@ -1516,6 +1519,18 @@ const fn default_maximum_gossip_clock_disparity_millis() -> u64 {
500
}

const fn default_custody_requirement() -> u64 {
1
}

const fn default_data_column_sidecar_subnet_count() -> u64 {
32
}

const fn default_number_of_columns() -> u64 {
128
}

fn max_blocks_by_root_request_common(max_request_blocks: u64) -> usize {
let max_request_blocks = max_request_blocks as usize;
RuntimeVariableList::<Hash256>::from_vec(
Expand Down
2 changes: 1 addition & 1 deletion lcli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "lcli"
description = "Lighthouse CLI (modeled after zcli)"
version = "5.2.1"
version = "5.3.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion lighthouse/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lighthouse"
version = "5.2.1"
version = "5.3.0"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = { workspace = true }
autotests = false
Expand Down
6 changes: 5 additions & 1 deletion slasher/src/database/lmdb_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ impl<'env> Cursor<'env> {
}

pub fn get_current(&mut self) -> Result<Option<(Key<'env>, Value<'env>)>, Error> {
// FIXME: lmdb has an extremely broken API which can mutate the SHARED REFERENCE
// `value` after `get_current` is called. We need to convert it to a Vec here in order
// to avoid `value` changing after another cursor operation. I think this represents a bug
// in the LMDB bindings, as shared references should be immutable.
if let Some((Some(key), value)) = self.cursor.get(None, None, MDB_GET_CURRENT).optional()? {
Ok(Some((Cow::Borrowed(key), Cow::Borrowed(value))))
Ok(Some((Cow::Borrowed(key), Cow::Owned(value.to_vec()))))
} else {
Ok(None)
}
Expand Down
5 changes: 5 additions & 0 deletions slasher/tests/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,8 @@ fn no_crash_blocks_example1() {
},
);
}

#[test]
fn no_crash_aug_24() {
random_test(13519442335106054152, TestConfig::default())
}
Loading

0 comments on commit 3a996fb

Please sign in to comment.