Skip to content

Commit afd1f62

Browse files
authored
Merge branch 'unstable' into vm-voluntary-exit
2 parents cbf37d7 + 4b9c16f commit afd1f62

File tree

85 files changed

+2834
-2246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2834
-2246
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
arch: [aarch64-unknown-linux-gnu,
3434
x86_64-unknown-linux-gnu,
3535
x86_64-apple-darwin,
36+
aarch64-apple-darwin,
3637
x86_64-windows]
3738
include:
3839
- arch: aarch64-unknown-linux-gnu
@@ -44,6 +45,9 @@ jobs:
4445
- arch: x86_64-apple-darwin
4546
runner: macos-13
4647
profile: maxperf
48+
- arch: aarch64-apple-darwin
49+
runner: macos-14
50+
profile: maxperf
4751
- arch: x86_64-windows
4852
runner: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "windows", "release"]') || 'windows-2019' }}
4953
profile: maxperf
@@ -94,6 +98,10 @@ jobs:
9498
if: matrix.arch == 'x86_64-apple-darwin'
9599
run: cargo install --path lighthouse --force --locked --features portable,gnosis --profile ${{ matrix.profile }}
96100

101+
- name: Build Lighthouse for aarch64-apple-darwin
102+
if: matrix.arch == 'aarch64-apple-darwin'
103+
run: cargo install --path lighthouse --force --locked --features portable,gnosis --profile ${{ matrix.profile }}
104+
97105
- name: Build Lighthouse for Windows
98106
if: matrix.arch == 'x86_64-windows'
99107
run: cargo install --path lighthouse --force --locked --features portable,gnosis --profile ${{ matrix.profile }}
@@ -237,6 +245,7 @@ jobs:
237245
| System | Architecture | Binary | PGP Signature |
238246
|:---:|:---:|:---:|:---|
239247
| <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.simpleicons.org/apple/white" > <source media="(prefers-color-scheme: light)" srcset="https://cdn.simpleicons.org/apple" ><img src="https://cdn.simpleicons.org/apple" width="32" alt="Apple logo"> </picture> | x86_64 | [lighthouse-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz.asc) |
248+
| <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.simpleicons.org/apple/white" > <source media="(prefers-color-scheme: light)" srcset="https://cdn.simpleicons.org/apple" ><img src="https://cdn.simpleicons.org/apple" width="32" alt="Apple logo"> </picture> | aarch64 | [lighthouse-${{ env.VERSION }}-aarch64-apple-darwin.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-apple-darwin.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-apple-darwin.tar.gz.asc) |
240249
| <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.simpleicons.org/linux/white" > <source media="(prefers-color-scheme: light)" srcset="https://cdn.simpleicons.org/linux/black" ><img src="https://cdn.simpleicons.org/linux" width="32" alt="Linux logo"> </picture> | x86_64 | [lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz.asc) |
241250
| <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.simpleicons.org/raspberrypi/white" > <source media="(prefers-color-scheme: light)" srcset="https://cdn.simpleicons.org/raspberrypi/black" > <img src="https://cdn.simpleicons.org/raspberrypi" width="32" alt="Raspberrypi logo"> </picture> | aarch64 | [lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz.asc) |
242251
| <picture> <source media="(prefers-color-scheme: dark)" srcset="https://upload.wikimedia.org/wikipedia/commons/8/87/Windows_logo_-_2021.svg"> <source media="(prefers-color-scheme: light)" srcset="https://upload.wikimedia.org/wikipedia/commons/c/c4/Windows_logo_-_2021_%28Black%29.svg"> <img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/Windows_logo_-_2021_%28Black%29.svg" width="32" alt="Windows logo"> </picture> | x86_64 | [lighthouse-${{ env.VERSION }}-x86_64-windows.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-windows.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-windows.tar.gz.asc) |

.github/workflows/test-suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ jobs:
295295
with:
296296
channel: stable
297297
cache-target: release
298-
- name: Run a basic beacon chain sim that starts from Bellatrix
298+
- name: Run a basic beacon chain sim that starts from Deneb
299299
run: cargo run --release --bin simulator basic-sim
300300
fallback-simulator-ubuntu:
301301
name: fallback-simulator-ubuntu

Cargo.lock

Lines changed: 34 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ members = [
9696
"validator_client/http_api",
9797
"validator_client/http_metrics",
9898
"validator_client/initialized_validators",
99+
"validator_client/lighthouse_validator_store",
99100
"validator_client/signing_method",
100101
"validator_client/slashing_protection",
101102
"validator_client/validator_metrics",
102103
"validator_client/validator_services",
103-
"validator_client/validator_store",
104104

105105
"validator_manager",
106106
]
@@ -161,6 +161,7 @@ maplit = "1"
161161
milhouse = "0.5"
162162
mockito = "1.5.0"
163163
num_cpus = "1"
164+
once_cell = "1.17.1"
164165
parking_lot = "0.12"
165166
paste = "1"
166167
prometheus = { version = "0.13", default-features = false }
@@ -227,7 +228,6 @@ compare_fields = { path = "common/compare_fields" }
227228
deposit_contract = { path = "common/deposit_contract" }
228229
directory = { path = "common/directory" }
229230
doppelganger_service = { path = "validator_client/doppelganger_service" }
230-
validator_services = { path = "validator_client/validator_services" }
231231
environment = { path = "lighthouse/environment" }
232232
eth1 = { path = "beacon_node/eth1" }
233233
eth1_test_rig = { path = "testing/eth1_test_rig" }
@@ -249,6 +249,7 @@ int_to_bytes = { path = "consensus/int_to_bytes" }
249249
kzg = { path = "crypto/kzg" }
250250
metrics = { path = "common/metrics" }
251251
lighthouse_network = { path = "beacon_node/lighthouse_network" }
252+
lighthouse_validator_store = { path = "validator_client/lighthouse_validator_store" }
252253
lighthouse_version = { path = "common/lighthouse_version" }
253254
workspace_members = { path = "common/workspace_members" }
254255
lockfile = { path = "common/lockfile" }
@@ -280,6 +281,7 @@ validator_dir = { path = "common/validator_dir" }
280281
validator_http_api = { path = "validator_client/http_api" }
281282
validator_http_metrics = { path = "validator_client/http_metrics" }
282283
validator_metrics = { path = "validator_client/validator_metrics" }
284+
validator_services = { path = "validator_client/validator_services" }
283285
validator_store = { path = "validator_client/validator_store" }
284286
validator_test_rig = { path = "testing/validator_test_rig" }
285287
warp_utils = { path = "common/warp_utils" }

beacon_node/beacon_chain/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ logging = { workspace = true }
4747
lru = { workspace = true }
4848
merkle_proof = { workspace = true }
4949
metrics = { workspace = true }
50+
once_cell = { workspace = true }
5051
oneshot_broadcast = { path = "../../common/oneshot_broadcast/" }
5152
operation_pool = { workspace = true }
5253
parking_lot = { workspace = true }

beacon_node/beacon_chain/src/beacon_proposer_cache.rs

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
use crate::{BeaconChain, BeaconChainError, BeaconChainTypes};
1212
use fork_choice::ExecutionStatus;
1313
use lru::LruCache;
14+
use once_cell::sync::OnceCell;
1415
use smallvec::SmallVec;
1516
use state_processing::state_advance::partial_state_advance;
1617
use std::cmp::Ordering;
1718
use std::num::NonZeroUsize;
19+
use std::sync::Arc;
1820
use types::non_zero_usize::new_non_zero_usize;
1921
use types::{
2022
BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, Fork, Hash256, Slot, Unsigned,
@@ -39,21 +41,21 @@ pub struct Proposer {
3941
/// their signatures.
4042
pub struct EpochBlockProposers {
4143
/// The epoch to which the proposers pertain.
42-
epoch: Epoch,
44+
pub(crate) epoch: Epoch,
4345
/// The fork that should be used to verify proposer signatures.
44-
fork: Fork,
46+
pub(crate) fork: Fork,
4547
/// A list of length `T::EthSpec::slots_per_epoch()`, representing the proposers for each slot
4648
/// in that epoch.
4749
///
4850
/// E.g., if `self.epoch == 1`, then `self.proposers[0]` contains the proposer for slot `32`.
49-
proposers: SmallVec<[usize; TYPICAL_SLOTS_PER_EPOCH]>,
51+
pub(crate) proposers: SmallVec<[usize; TYPICAL_SLOTS_PER_EPOCH]>,
5052
}
5153

5254
/// A cache to store the proposers for some epoch.
5355
///
5456
/// See the module-level documentation for more information.
5557
pub struct BeaconProposerCache {
56-
cache: LruCache<(Epoch, Hash256), EpochBlockProposers>,
58+
cache: LruCache<(Epoch, Hash256), Arc<OnceCell<EpochBlockProposers>>>,
5759
}
5860

5961
impl Default for BeaconProposerCache {
@@ -74,7 +76,8 @@ impl BeaconProposerCache {
7476
) -> Option<Proposer> {
7577
let epoch = slot.epoch(E::slots_per_epoch());
7678
let key = (epoch, shuffling_decision_block);
77-
if let Some(cache) = self.cache.get(&key) {
79+
let cache_opt = self.cache.get(&key).and_then(|cell| cell.get());
80+
if let Some(cache) = cache_opt {
7881
// This `if` statement is likely unnecessary, but it feels like good practice.
7982
if epoch == cache.epoch {
8083
cache
@@ -103,7 +106,26 @@ impl BeaconProposerCache {
103106
epoch: Epoch,
104107
) -> Option<&SmallVec<[usize; TYPICAL_SLOTS_PER_EPOCH]>> {
105108
let key = (epoch, shuffling_decision_block);
106-
self.cache.get(&key).map(|cache| &cache.proposers)
109+
self.cache
110+
.get(&key)
111+
.and_then(|cache_once_cell| cache_once_cell.get().map(|proposers| &proposers.proposers))
112+
}
113+
114+
/// Returns the `OnceCell` for the given `(epoch, shuffling_decision_block)` key,
115+
/// inserting an empty one if it doesn't exist.
116+
///
117+
/// The returned `OnceCell` allows the caller to initialise the value externally
118+
/// using `get_or_try_init`, enabling deferred computation without holding a mutable
119+
/// reference to the cache.
120+
pub fn get_or_insert_key(
121+
&mut self,
122+
epoch: Epoch,
123+
shuffling_decision_block: Hash256,
124+
) -> Arc<OnceCell<EpochBlockProposers>> {
125+
let key = (epoch, shuffling_decision_block);
126+
self.cache
127+
.get_or_insert(key, || Arc::new(OnceCell::new()))
128+
.clone()
107129
}
108130

109131
/// Insert the proposers into the cache.
@@ -120,14 +142,13 @@ impl BeaconProposerCache {
120142
) -> Result<(), BeaconStateError> {
121143
let key = (epoch, shuffling_decision_block);
122144
if !self.cache.contains(&key) {
123-
self.cache.put(
124-
key,
125-
EpochBlockProposers {
126-
epoch,
127-
fork,
128-
proposers: proposers.into(),
129-
},
130-
);
145+
let epoch_proposers = EpochBlockProposers {
146+
epoch,
147+
fork,
148+
proposers: proposers.into(),
149+
};
150+
self.cache
151+
.put(key, Arc::new(OnceCell::with_value(epoch_proposers)));
131152
}
132153

133154
Ok(())

beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ impl<E: EthSpec> PendingComponents<E> {
331331
format!(
332332
"block {} blobs {}/{}",
333333
block_count,
334-
self.verified_blobs.len(),
334+
self.verified_blobs.iter().flatten().count(),
335335
num_expected_blobs
336336
)
337337
}

0 commit comments

Comments
 (0)