Skip to content

Commit

Permalink
Merge branch 'unstable' of https://github.com/sigp/lighthouse into un…
Browse files Browse the repository at this point in the history
…stable
  • Loading branch information
eserilev committed Feb 27, 2024
2 parents 3ea8476 + abd9965 commit 7c13a8f
Show file tree
Hide file tree
Showing 25 changed files with 226 additions and 381 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang
run: sudo apt update && sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang
- name: Use Rust beta
run: rustup override set beta
- name: Run make
Expand Down
73 changes: 26 additions & 47 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ resolver = "2"
edition = "2021"

[workspace.dependencies]
anyhow = "1"
arbitrary = { version = "1", features = ["derive"] }
bincode = "1"
bitvec = "1"
Expand Down
5 changes: 3 additions & 2 deletions beacon_node/beacon_chain/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::light_client_server_cache::LightClientServerCache;
use crate::migrate::{BackgroundMigrator, MigratorConfig};
use crate::persisted_beacon_chain::PersistedBeaconChain;
use crate::shuffling_cache::{BlockShufflingIds, ShufflingCache};
use crate::snapshot_cache::{SnapshotCache, DEFAULT_SNAPSHOT_CACHE_SIZE};
use crate::snapshot_cache::SnapshotCache;
use crate::timeout_rw_lock::TimeoutRwLock;
use crate::validator_monitor::{ValidatorMonitor, ValidatorMonitorConfig};
use crate::validator_pubkey_cache::ValidatorPubkeyCache;
Expand Down Expand Up @@ -870,6 +870,7 @@ where
let head_for_snapshot_cache = head_snapshot.clone();
let canonical_head = CanonicalHead::new(fork_choice, Arc::new(head_snapshot));
let shuffling_cache_size = self.chain_config.shuffling_cache_size;
let snapshot_cache_size = self.chain_config.snapshot_cache_size;

// Calculate the weak subjectivity point in which to backfill blocks to.
let genesis_backfill_slot = if self.chain_config.genesis_backfill {
Expand Down Expand Up @@ -946,7 +947,7 @@ where
event_handler: self.event_handler,
head_tracker,
snapshot_cache: TimeoutRwLock::new(SnapshotCache::new(
DEFAULT_SNAPSHOT_CACHE_SIZE,
snapshot_cache_size,
head_for_snapshot_cache,
)),
shuffling_cache: TimeoutRwLock::new(ShufflingCache::new(
Expand Down
3 changes: 3 additions & 0 deletions beacon_node/beacon_chain/src/chain_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ pub struct ChainConfig {
pub optimistic_finalized_sync: bool,
/// The size of the shuffling cache,
pub shuffling_cache_size: usize,
/// The size of the snapshot cache.
pub snapshot_cache_size: usize,
/// If using a weak-subjectivity sync, whether we should download blocks all the way back to
/// genesis.
pub genesis_backfill: bool,
Expand Down Expand Up @@ -112,6 +114,7 @@ impl Default for ChainConfig {
// This value isn't actually read except in tests.
optimistic_finalized_sync: true,
shuffling_cache_size: crate::shuffling_cache::DEFAULT_CACHE_SIZE,
snapshot_cache_size: crate::snapshot_cache::DEFAULT_SNAPSHOT_CACHE_SIZE,
genesis_backfill: false,
always_prepare_payload: false,
progressive_balances_mode: ProgressiveBalancesMode::Fast,
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mod pre_finalization_cache;
pub mod proposer_prep_service;
pub mod schema_change;
pub mod shuffling_cache;
mod snapshot_cache;
pub mod snapshot_cache;
pub mod state_advance_timer;
pub mod sync_committee_rewards;
pub mod sync_committee_verification;
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/snapshot_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use types::{
};

/// The default size of the cache.
pub const DEFAULT_SNAPSHOT_CACHE_SIZE: usize = 4;
pub const DEFAULT_SNAPSHOT_CACHE_SIZE: usize = 3;

/// The minimum block delay to clone the state in the cache instead of removing it.
/// This helps keep block processing fast during re-orgs from late blocks.
Expand Down Expand Up @@ -174,6 +174,7 @@ impl<T: EthSpec> SnapshotCache<T> {
self.snapshots.iter().map(|s| s.beacon_block_root).collect()
}

#[allow(clippy::len_without_is_empty)]
/// The number of snapshots contained in `self`.
pub fn len(&self) -> usize {
self.snapshots.len()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> {
///
/// https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/beacon-chain.md#modified-verify_and_notify_new_payload
pub fn perform_optimistic_sync_verifications(&self) -> Result<(), Error> {
self.verfiy_payload_block_hash()?;
self.verify_payload_block_hash()?;
self.verify_versioned_hashes()?;

Ok(())
Expand All @@ -98,7 +98,7 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> {
///
/// Equivalent to `is_valid_block_hash` in the spec:
/// https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/beacon-chain.md#is_valid_block_hash
pub fn verfiy_payload_block_hash(&self) -> Result<(), Error> {
pub fn verify_payload_block_hash(&self) -> Result<(), Error> {
let payload = self.execution_payload_ref();
let parent_beacon_block_root = self.parent_beacon_block_root().ok().cloned();

Expand Down
1 change: 1 addition & 0 deletions beacon_node/execution_layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use crate::payload_cache::PayloadCache;
use arc_swap::ArcSwapOption;
use auth::{strip_prefix, Auth, JwtKey};
pub use block_hash::calculate_execution_block_hash;
use builder_client::BuilderHttpClient;
pub use engine_api::EngineCapabilities;
use engine_api::Error as ApiError;
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ quick-protobuf-codec = "0.3"
[dependencies.libp2p]
version = "0.53"
default-features = false
features = ["identify", "yamux", "noise", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa", "metrics", "quic"]
features = ["identify", "yamux", "noise", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa", "metrics", "quic", "upnp"]

[dev-dependencies]
slog-term = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/lighthouse_network/src/peer_manager/peerdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,8 @@ impl<TSpec: EthSpec> PeerDB<TSpec> {

// Update the connection state
match direction {
ConnectionDirection::Incoming => info.connect_ingoing(Some(seen_address)),
ConnectionDirection::Outgoing => info.connect_outgoing(Some(seen_address)),
ConnectionDirection::Incoming => info.connect_ingoing(seen_address),
ConnectionDirection::Outgoing => info.connect_outgoing(seen_address),
}
}

Expand Down
Loading

0 comments on commit 7c13a8f

Please sign in to comment.