3689 Commits

Author SHA1 Message Date
Jimmy Chen
4588971085 Add sync batch state metrics (#8847)
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-02-19 01:57:53 +00:00
Pawan Dhananjay
561898fc1c Process head_chains in descending order of number of peers (#8859)
N/A


  Another find by @gitToki. Sort the preferred_ids in descending order as originally intended from the comment in the function.


Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
2026-02-19 00:38:56 +00:00
Pawan Dhananjay
c5b4580e37 Return correct variant for snappy errors (#8841)
N/A


  Handle snappy crate errors as InvalidData instead of IoError.


Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
2026-02-18 04:17:07 +00:00
Jimmy Chen
691c8cf8e6 Fix duplicate data columns in DataColumnsByRange responses (#8843)
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-02-18 04:16:57 +00:00
Akihito Nakano
c61665b3a1 Penalize peers that send an invalid rpc request (#6986)
Since https://github.com/sigp/lighthouse/pull/6847, invalid `BlocksByRange`/`BlobsByRange` requests, which do not comply with the spec, are [handled in the Handler](3d16d1080f/beacon_node/lighthouse_network/src/rpc/handler.rs (L880-L911)). Any peer that sends an invalid request is penalized and disconnected.

However, other kinds of invalid rpc request, which result in decoding errors, are just dropped. No penalty is applied and the connection with the peer remains.


  I have added handling for the `ListenUpgradeError` event to notify the application of an `RPCError:InvalidData` error and disconnect to the peer that sent the invalid rpc request.

I also added tests for handling invalid rpc requests.


Co-Authored-By: ackintosh <sora.akatsuki@gmail.com>
2026-02-18 14:43:59 +11:00
0xMushow
9065e4a56e fix(beacon_node): add pruning of observed_column_sidecars (#8531)
None


  I noticed that `observed_column_sidecars` is missing its prune call in the finalization handler, which results in a memory leak on long-running nodes (very slow (**7MB/day**)) :

13dfa9200f/beacon_node/beacon_chain/src/canonical_head.rs (L940-L959)

Both caches use the same generic type `ObservedDataSidecars<T>:`
22ec4b3271/beacon_node/beacon_chain/src/beacon_chain.rs (L413-L416)

The type's documentation explicitly requires manual pruning:

>  "*The cache supports pruning based upon the finalized epoch. It does not automatically prune, you must call Self::prune manually.*"


b4704eab4a/beacon_node/beacon_chain/src/observed_data_sidecars.rs (L66-L74)

Currently:
- `observed_blob_sidecars` => pruned
- `observed_column_sidecars` => **NOT** pruned

Without pruning, the underlying HashMap accumulates entries indefinitely, causing continuous memory growth until the node restarts.


Co-Authored-By: Antoine James <antoine@ethereum.org>
2026-02-18 12:38:05 +11:00
hopinheimer
bd1966353a Use events API to eager send attestations (#7892)
Co-Authored-By: hopinheimer <knmanas6@gmail.com>

Co-Authored-By: hopinheimer <48147533+hopinheimer@users.noreply.github.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2026-02-04 01:40:16 +00:00
Michael Sproul
940fa81a5b Fast path for /eth/v1/beacon/blocks/head/root (#8729)
Closes:

- https://github.com/sigp/lighthouse/issues/8667


  Use the `early_attester_cache` to serve the head block root (if present). This should be faster than waiting for the head to finish importing.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-02-02 06:41:43 +00:00
Eitan Seri-Levi
3ecf964385 Replace INTERVALS_PER_SLOT with explicit slot component times (#7944)
https://github.com/ethereum/consensus-specs/pull/4476


  


Co-Authored-By: Barnabas Busa <barnabas.busa@ethereum.org>

Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-02-02 05:58:42 +00:00
Jimmy Chen
cd8049a696 Emit NewHead SSE event earlier in block import (#8718)
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-01-29 07:39:05 +00:00
Eitan Seri-Levi
b202e98dd9 Gloas gossip boilerplate (#8700)
All the required boilerplate for gloas gossip. We'll include the gossip message processing logic in a separate PR


  


Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-01-28 07:12:48 +00:00
Eitan Seri-Levi
f7b5c7ee3f Convert RpcBlock to an enum that indicates availability (#8424)
Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Mark Mackey <mark@sigmaprime.io>

Co-Authored-By: Eitan Seri-Levi <eserilev@gmail.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-01-28 05:59:32 +00:00
Eitan Seri-Levi
9bec8df37a Add Gloas data column support (#8682)
Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>
2026-01-28 04:52:12 +00:00
Mac L
1476c20cfc Remove data dependency from from core module in `consensus/types (#8694)
#8652


  Implements "simplified" versions of `max_blobs_by_root_request` and `max_data_columns_by_root_request` which do not depend on type information from the `data` module. I've also added tests which test the original implementation against the simplified one to ensure they don't deviate.

Also moves `all_data_column_sidecar_subnets` from a method on `ChainSpec` to a function which just takes `ChainSpec` as an argument.


Co-Authored-By: Mac L <mjladson@pm.me>
2026-01-26 19:25:39 +00:00
Jimmy Chen
7f065009a7 Implement custom OpenTelemetry sampler to filter uninstrumented traces (#8647)
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-01-22 05:11:26 +00:00
Jimmy Chen
21cabba1a2 Updated consensus types for Gloas 1.7.0-alpha.1 (#8688)
Pulling out consensus type changes from #8677.

This PR covers all type changes for spec 1.7.0-alpha.1 (except for `DataColumnSidecar` changes, which is covered in @eserilev's PR  #8682)


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-01-21 12:08:48 +00:00
João Oliveira
33e41d3f44 update libp2p dependency to upstream (#8200)
Co-Authored-By: João Oliveira <hello@jxs.pt>
2026-01-20 19:45:48 +00:00
Mac L
58b153cac5 Remove remaining facade module re-exports from consensus/types (#8672)
Removes the remaining facade re-exports from `consensus/types`.
I have left `graffiti` as I think it has some utility so am leaning towards keeping it in the final API design.


Co-Authored-By: Mac L <mjladson@pm.me>
2026-01-16 19:51:29 +00:00
Mac L
3903e1c67f More consensus/types re-export cleanup (#8665)
Remove more of the temporary re-exports from `consensus/types`


Co-Authored-By: Mac L <mjladson@pm.me>
2026-01-16 04:43:05 +00:00
Mac L
1abc41e337 Cleanup consensus/types re-exports (#8643)
Removes some of the temporary re-exports in `consensus/types`.

I am doing this in multiple parts to keep each diff small.


Co-Authored-By: Mac L <mjladson@pm.me>
2026-01-15 02:23:55 +00:00
Mac L
605ef8e8e6 Remove state dependency from core module in consensus/types (#8653)
#8652


  - This removes instances of `BeaconStateError` from `eth_spec.rs`, and replaces them directly with `ArithError` which can be trivially converted back to `BeaconStateError` at the call site.
- Also moves the state related methods on `ChainSpec` to be methods on `BeaconState` instead. I think this might be a more natural place for them to exist anyway.


Co-Authored-By: Mac L <mjladson@pm.me>
2026-01-15 02:16:40 +00:00
Pawan Dhananjay
c91345782a Get blobs v2 metrics (#8641)
N/A


  Add standardized metrics for getBlobsV2 from https://github.com/ethereum/beacon-metrics/pull/14.


Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
2026-01-13 07:50:40 +00:00
Pawan Dhananjay
57bbc93d75 Update buckets for metric (#8651)
N/A


  The `beacon_data_column_sidecar_computation_seconds` used to record the full kzg proof generation times before we changed getBlobsV2 to just return the full proofs + cells. This metric should be taking way less time than 100ms which was the minimum bucket previously.

Update the metric to use the default buckets for better granularity.


Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
2026-01-13 05:58:34 +00:00
Eitan Seri-Levi
3fac61e0c8 Re-introduce clearer variable names in beacon processor work queue (#8649)
#8648


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2026-01-12 23:36:01 +00:00
Eitan Seri-Levi
b8c386d38d Move beacon processor work queue implementation to its own file (#8141)
Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2026-01-11 01:22:28 +00:00
Lion - dapplion
6166ad2eb2 Replace tracing::debug! with debug! same for other levels (#8300)
Just visual clean-up, making logging statements look uniform. There's no reason to use `tracing::debug` instead of `debug`. If we ever need to migrate our logging lib in the future it would make things easier too.


  


Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2026-01-08 07:04:44 +00:00
0xMushow
0706e62f52 fix(peerdb): use start_slot instead of end_slot for safer actions (#8498)
Which issue # does this PR address?
None


  Discussed in private with @jimmygchen, Lighthouse's `earliest_available_slot` is guaranteed to always align with epoch boundaries, but as a safety implementation, we should use `start_slot` just in case other clients differ in their implementations.

At least we agreed it would be safer for `synced_peers_for_epoch`, I also made the change in `has_good_custody_range_sync_peer`, but this is to be reviewed please.


Co-Authored-By: Antoine James <antoine@ethereum.org>

Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io>
2026-01-08 06:17:46 +00:00
Akihito Nakano
79d314ddba Tweak a log message for mock-el (#8599)
```bash
$ lcli mock-el ....
...
...
Dec 15 11:52:06.002 INFO  Metrics HTTP server started                   listen_address: "127.0.0.1:8551"
...
```

The log message "Metrics HTTP server" was misleading, as the server is actually a Mock Execution Client that provides a JSON-RPC API for testing purposes, not a metrics server.


  


Co-Authored-By: ackintosh <sora.akatsuki@gmail.com>
2026-01-07 19:42:16 +00:00
Jimmy Chen
dbe474e132 Delete attester cache (#8469)
Fixes attester cache write lock contention. Alternative to #8463.


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-01-06 03:08:02 +00:00
Andrés David Ramírez Chiquillo
ea3a3da1a4 fix: improve error for insufficient blob data columns (#8595)
Closes #8569


  Updates the HTTP API error when the node cannot reconstruct blobs due to "Insufficient data columns".

Changes the response from 500 Internal Server Error to 400 Bad Request and adds a hint to run with --supernode or --semi-supernode.


Co-Authored-By: Andrurachi <andruvrch@gmail.com>
2026-01-05 06:16:52 +00:00
Abhivansh
9b3d7e3a54 refactor: remove service_name (#8606)
Which issue # does this PR address?
#8586


  Please list or describe the changes introduced by this PR.
Remove `service_name` from `TaskExecutor`


Co-Authored-By: Abhivansh <31abhivanshj@gmail.com>
2026-01-02 00:07:40 +00:00
Michael Sproul
4c268bc0d5 Delete PartialBeaconState (#8591)
While reviewing Gloas I noticed we were updating `PartialBeaconState`. This code isn't used since v7.1.0 introduced hdiffs, so we can delete it and stop maintaining it 🎉

Similarly the `chunked_vector`/`chunked_iter` code can also go!


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
2025-12-16 09:02:31 +00:00
ethDreamer
a39e991557 Gloas(EIP-7732): Containers / Constants (#7923)
* #7850

This is the first round of the conga line! 🎉

Just spec constants and container changes so far.


  


Co-Authored-By: shane-moore <skm1790@gmail.com>

Co-Authored-By: Mark Mackey <mark@sigmaprime.io>

Co-Authored-By: Shane K Moore <41407272+shane-moore@users.noreply.github.com>

Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: ethDreamer <37123614+ethDreamer@users.noreply.github.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>

Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2025-12-16 06:45:45 +00:00
chonghe
86c2b7cfbe Append client version info to graffiti (#7558)
* #7201


  


Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io>

Co-Authored-By: chonghe <44791194+chong-he@users.noreply.github.com>

Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io>

Co-Authored-By: Tan Chee Keong <tanck2005@gmail.com>
2025-12-16 03:19:28 +00:00
0xMushow
afa6457acf fix visual bug on visualize_batch_state leading to a non-wanted comma (#8499)
Which issue # does this PR address?
None


  The `visualize_batch_state`  functions uses the following loop `for mut batch_index in 0..BATCH_BUFFER_SIZE`, making it from `0` to `BATCH_BUFFER_SIZE - 1` (behind the scenes).

Hence we would never hit the following condition:

```rust
if batch_index != BATCH_BUFFER_SIZE {
visualization_string.push(',');
}
```

Replacing `!=` with `<` & `BATCH_BUFFER_SIZE -1` allows for the following change:

`[A,B,C,D,E,]` to become: `[A,B,C,D,E]`


Co-Authored-By: Antoine James <antoine@ethereum.org>
2025-12-15 05:14:15 +00:00
Mac L
6a3a32515f Update strum to 0.27 (#8564)
#8547


  Update our `strum` dependency to `0.27`. This unifies our strum dependencies and removes our duplication of `strum` (and by extension, `strum_macros`).


Co-Authored-By: Mac L <mjladson@pm.me>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2025-12-15 03:20:10 +00:00
Andrés David Ramírez Chiquillo
49e1112da2 Add regression test for unaligned checkpoint sync with payload pruning (#8458)
Closes #8426


  Added a new regression test: `reproduction_unaligned_checkpoint_sync_pruned_payload`.

This test reproduces the bug where unaligned checkpoint syncs (skipped slots at epoch boundaries) fail to import the anchor block's execution payload when `prune_payloads` is enabled.

The test simulates the failure mode by:
- Skipping if execution payloads are not applicable.
- Creating a harness with an unaligned checkpoint (gap of 3 slots).
- Configuring the client with prune_payloads = true.


It asserts that the Beacon Chain builds successfully (previously it panicked with `MissingFullBlockExecutionPayloadPruned`), confirming the fix logic in `try_get_full_block`.


Co-Authored-By: Andrurachi <andruvrch@gmail.com>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2025-12-15 02:33:29 +00:00
Eitan Seri-Levi
556e917092 Rust 1.92 lints (#8567)
Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2025-12-12 08:45:38 +00:00
Mac L
f3fd1f210b Remove consensus/types re-exports (#8540)
There are certain crates which we re-export within `types` which creates a fragmented DevEx, where there are various ways to import the same crates.

```rust
// consensus/types/src/lib.rs
pub use bls::{
AggregatePublicKey, AggregateSignature, Error as BlsError, Keypair, PUBLIC_KEY_BYTES_LEN,
PublicKey, PublicKeyBytes, SIGNATURE_BYTES_LEN, SecretKey, Signature, SignatureBytes,
get_withdrawal_credentials,
};
pub use context_deserialize::{ContextDeserialize, context_deserialize};
pub use fixed_bytes::FixedBytesExtended;
pub use milhouse::{self, List, Vector};
pub use ssz_types::{BitList, BitVector, FixedVector, VariableList, typenum, typenum::Unsigned};
pub use superstruct::superstruct;
```

This PR removes these re-exports and makes it explicit that these types are imported from a non-`consensus/types` crate.


Co-Authored-By: Mac L <mjladson@pm.me>
2025-12-09 07:13:41 +00:00
Mac L
7bfcc03520 Reduce eth2 dependency space (#8524)
Remove certain dependencies from `eth2`, and feature-gate others which are only used by certain endpoints.

| Removed | Optional | Dev only |
| -------- | -------- | -------- |
| `either` `enr` `libp2p-identity` `multiaddr` | `protoarray` `eth2_keystore` `eip_3076` `zeroize` `reqwest-eventsource` `futures` `futures-util` | `rand` `test_random_derive` |

This is done by adding an `events` feature which enables the events endpoint and its associated dependencies.
The `lighthouse` feature also enables its associated dependencies making them optional.

The networking-adjacent dependencies were removed by just having certain fields use a `String` instead of an explicit network type. This means the user should handle conversion at the call site instead. This is a bit spicy, but I believe `PeerId`, `Enr` and `Multiaddr` are easily converted to and from `String`s so I think it's fine and reduces our dependency space by a lot. The alternative is to feature gate these types behind a `network` feature instead.


Co-Authored-By: Mac L <mjladson@pm.me>
2025-12-08 05:37:23 +00:00
Jimmy Chen
2afa87879b Move beacon pool http api to its own separate module (#8543)
Continuation of:
* #8536

Moving `/beacon/pool` endpoints out of `http_api` to a separation module. This should improve code maintainability, incremental compilation time and rust analyzer performance.

This is a tedious but straight forward change, so we're going with a pair & insta-merge approach to avoid painful & slow async review


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2025-12-05 10:59:42 +00:00
Jimmy Chen
e27f31648f Move validator http endpoints to a separate module (#8536)
Continuation of:
* #8529

Moving `/validator` endpoints out of `http_api` to a separation module. This should improve code maintainability, incremental compilation time and rust analyzer performance.

This is a tedious but straight forward change, so we're going with a pair & insta-merge approach to avoid painful & slow async review. @michaelsproul and I paired on the first commit - I believe we are almost done, will pair with @pawanjay176 tomorrow to wrap it up and merge tomorrow. (cc @macladson )


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2025-12-05 10:08:38 +00:00
Mac L
4e958a92d3 Refactor consensus/types (#7827)
Organize and categorize `consensus/types` into modules based on their relation to key consensus structures/concepts.
This is a precursor to a sensible public interface.

While this refactor is very opinionated, I am open to suggestions on module names, or type groupings if my current ones are inappropriate.


Co-Authored-By: Mac L <mjladson@pm.me>
2025-12-04 09:28:52 +00:00
Jimmy Chen
51d0336020 Move beacon state endpoints to a separate module. (#8529)
Part of the http api refactor to move endpoint handlers to separate modules.

This should improve code maintainability, incremental compilation time and rust analyzer performance.


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2025-12-04 06:58:57 +00:00
0xMushow
4fbe517491 Fix data columns sorting when reconstructing blobs (#8510)
Closes https://github.com/sigp/lighthouse/issues/8509


  


Co-Authored-By: Antoine James <antoine@ethereum.org>
2025-12-02 03:06:29 +00:00
Jimmy Chen
7cee5d6090 Optimise pubkey cache initialisation during beacon node startup (#8451)
Instrument beacon node startup and parallelise pubkey cache initialisation.

I instrumented beacon node startup and noticed that pubkey cache takes a long time to initialise, mostly due to decompressing all the validator pubkeys.

This PR uses rayon to parallelize the decompression on initial checkpoint sync. The pubkeys are stored uncompressed, so the decopression time is not a problem on subsequent restarts. On restarts, we still deserialize pubkeys, but the timing is quite minimal on Sepolia so I didn't investigate further.

`validator_pubkey_cache_new` timing on Sepolia:
* before: 109.64ms
* with parallelization: 21ms

on Hoodi:
* before: times out with Kurtosis after 120s
* with parallelization: 12.77s to import keys

**UPDATE**: downloading checkpoint state + genesis state takes about 2 minutes on my laptop, so it seems like the BN managed to start the http server just before timing out (after the optimisation).

<img width="1380" height="625" alt="image" src="https://github.com/user-attachments/assets/4c548c14-57dd-4b47-af9a-115b15791940" />


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2025-11-28 04:30:49 +00:00
sashass1315
9394663155 fix: compare bls changes in op-pool (#8465)
Co-Authored-By: sashass1315 <sashass1315@gmail.com>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2025-11-28 04:09:13 +00:00
Daniel
e291955400 Integration tests ergonomics (#7836)
Fixes #7785


  - [x] Update all integration tests with >1 files to follow the `main` pattern.
- [x] `crypto/eth2_key_derivation/tests`
- [x] `crypto/eth2_keystore/tests`
- [x] `crypto/eth2_wallet/tests`
- [x] `slasher/tests`
- [x] `common/eth2_interop_keypairs/tests`
- [x] `beacon_node/lighthouse_network/tests`
- [x] Set `debug_assertions` to false on `.vscode/settings.json`.
- [x] Document how to make rust analyzer work on integration tests files. In `book/src/contributing_setup.md`

---

Tracking a `rust-analyzer.toml` with settings like the one provided in `.vscode/settings.json` would be nicer. But this is not possible yet. For now, that config should be a good enough indicator for devs using editors different to VSCode.


Co-Authored-By: Daniel Ramirez-Chiquillo <hi@danielrachi.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2025-11-27 05:53:57 +00:00
Michael Sproul
070e395714 Remove quickcheck in favour of proptest (#8471)
Consolidate our property-testing around `proptest`. This PR was written with Copilot and manually tweaked.


Co-Authored-By: Michael Sproul <michael@sproul.xyz>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2025-11-27 05:53:55 +00:00
Michael Sproul
e21a433748 Allow manual checkpoint sync without blobs (#8470)
Since merging this PR, we don't need `--checkpoint-blobs`, even prior to Fulu:

- https://github.com/sigp/lighthouse/pull/8417

This PR removes the mandatory check for blobs prior to Fulu, enabling simpler manual checkpoint sync.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io>
2025-11-26 23:00:21 +00:00