Commit Graph

179 Commits

Author SHA1 Message Date
Michael Sproul
f5413c6e97 Remove useless let _ 2026-04-02 15:42:57 +11:00
Michael Sproul
727535bcc9 Remove spurious payload attestation condition 2026-04-02 11:50:16 +11:00
Michael Sproul
bc7864b076 Split out InvalidPayloadAttestation error 2026-04-02 11:44:02 +11:00
Michael Sproul
69d7250971 Tidy up payload attestation verification 2026-04-02 11:27:55 +11:00
Michael Sproul
1c5a7bed74 Clarify name of on_valid_payload_envelope_received 2026-04-02 10:56:34 +11:00
Michael Sproul
5aae563d84 Remove proposer boost weight during upgrade 2026-04-01 17:59:45 +11:00
Michael Sproul
f5b2445d09 Remove stupid GLOAS comments 2026-04-01 16:46:02 +11:00
Michael Sproul
ddff03d26f Store parent_payload_hash in ProtoNode 2026-04-01 16:42:49 +11:00
Michael Sproul
ad0f3cf89b Use None for post-Gloas payload hashes pre-Gloas 2026-04-01 12:10:11 +11:00
Michael Sproul
f6f9eae4ef More cleanup 2026-04-01 12:04:32 +11:00
Michael Sproul
51e78fd157 Fix queued attestation decoding from disk 2026-04-01 11:51:03 +11:00
Michael Sproul
4684d972e0 Remove TOCTOU early return 2026-04-01 11:31:51 +11:00
Michael Sproul
bc6cf0f882 Remove payload attestation queueing and more cleanups 2026-04-01 11:17:33 +11:00
Michael Sproul
1ee2ce4258 Fix schema migrations 2026-04-01 10:38:03 +11:00
dapplion
5353710e0a Fix compilation, clear best_child/best_descendant in migration
- Fix leaf detection in heads_descended_from_finalization (parent()
  method call, map away enumerate index)
- Clear best_child and best_descendant in v28->v29 migration (no
  longer used, replaced by virtual tree walk)
- Migration now rewrites fork choice data instead of being a no-op
2026-03-31 00:51:19 -05:00
dapplion
c7670ede02 Cleanup and spec parity fixes
- Add missing payload attestation slot check: spec returns early when
  data.slot != block.slot (PTC votes only for assigned block)
- Remove dead ignored tests (need mock EL Gloas support to run)
- Remove unused new_with_gloas and inspect_queued_payload_attestations
- Remove gloas entries from bin.rs (not part of this PR)
- Collapse nested if in payload attestation error handling (clippy)
- Rename env -> envelope in load_parent
- Add TODO(gloas) for parent_head_hash in re-org path
- Remove head_payload_status from ForkchoiceUpdateParameters (lives on
  CachedHead, sourced from get_head return)
2026-03-25 23:07:45 -05:00
dapplion
e676c33c92 Merge sigp/unstable into gloas-walk-always 2026-03-25 22:02:08 -05:00
dapplion
93f987f3cf Remove head_payload_status from ForkchoiceUpdateParameters
head_payload_status is internal fork choice state, not an EL
forkchoiceUpdated parameter. It already lives on CachedHead — source
it directly from get_head() return in recompute_head_at_slot instead
of threading through ForkchoiceUpdateParameters.

Also add TODO(gloas) for parent_head_hash in re-org path (V29 nodes
don't carry execution_status).
2026-03-25 21:16:06 -05:00
Michael Sproul
bd34bb1430 Remove schema migrations for v28 and earlier (#9031)
With LH v8.1.3 supporting Fulu-on-Gnosis, we no longer need these DB migrations. All Lighthouse nodes running in prod will soon be updated to LH v8.0.0+ and schema v28+.

This PR helps with Gloas fork choice changes, by allowing us to avoid updating old schema migrations when adding V29 for Gloas:

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


  


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-03-26 02:10:34 +00:00
dapplion
a34b7c99dc Fix CI: collapse nested if, ignore payload attestation test
- Collapse nested if in build_children_index (clippy::collapsible_if)
- Ignore payload_attestation_for_previous_slot_is_accepted_at_next_slot
  — test uses pre-Gloas blocks (V17) but on_payload_attestation requires
  V29 nodes. Needs mock EL Gloas block support.
2026-03-25 20:33:17 -05:00
dapplion
f31a93697e Fix test review issues
- Remove wrong latest_message assertions from payload attestation test
  (on_payload_attestation writes to PTC bitfields, not vote tracker)
- Fix corrupted comment: "votes.gloas_enabled() to the genesis block"
  → "votes to the genesis block"
- Fix http_api test fallback string: "n/a" → "irrelevant" to match
  production code
- Add issue link to #[ignore] test
- Add comment explaining head_payload_status as u8 cast
2026-03-25 20:08:43 -05:00
Michael Sproul
f1b261f336 Safeguard attestation index check 2026-03-26 11:00:08 +11:00
Michael Sproul
9f1f68c3ee Add back AttestationFromBlock 2026-03-26 10:39:57 +11:00
dapplion
93ef1e395c Include head_payload_status in ForkChoiceView comparison
The early exit check in recompute_head_at_slot compared only
head_block_root and checkpoints. When on_execution_payload changed
the payload status from Empty to Full without changing the head root,
the CachedHead was not updated. Add head_payload_status to
ForkChoiceView so the change is detected.
2026-03-25 17:47:49 -05:00
dapplion
845831ce56 Align GLOAS fork choice with spec
- Move proposer boost from apply_score_changes to get_weight, matching
  the spec's structure where get_weight adds boost via is_supporting_vote
- Implement is_supporting_vote and get_ancestor_node spec functions
- Fix should_extend_payload: return true when proposer_boost_root is zero
- Compute record_block_timeliness from time_into_slot instead of hardcoding false
- Fix anchor block_timeliness to [true, true] per get_forkchoice_store spec
- Add equivocating_attestation_score for is_head_weak monotonicity
- Use payload-aware weight in is_parent_strong
- Add with_status helper on IndexedForkChoiceNode
- Simplify find_head_walk to return IndexedForkChoiceNode directly
2026-03-25 17:47:49 -05:00
Michael Sproul
8b448864f0 Re-do head_payload_status 2026-03-25 14:05:11 +11:00
hopinheimer
cc8466dfa5 fixing recursive calls with caching 2026-03-20 16:10:43 -04:00
hopinheimer
0df749f0a2 completing should_extend_payload implementation 2026-03-16 05:53:47 -04:00
hopinheimer
f747696113 bitfield for PTC votes 2026-03-16 02:30:35 -04:00
hopinheimer
5679994285 addressing comments 2026-03-13 10:55:16 -04:00
hopinheimer
9c6f25cf36 fix migration SszContainer scripts 2026-03-09 19:06:50 -04:00
hopinheimer
275ac11200 test fixes 2026-03-02 15:33:53 -05:00
hopinheimer
6f6da5b393 lint 2026-03-02 13:27:45 -05:00
hopinheimer
e68cc03114 vote sanity and genesis epoch fix 2026-03-02 13:25:03 -05:00
hopinheimer
59033a5092 lint 2026-02-26 04:46:26 -05:00
hopinheimer
eb1b81063d fixing test 2026-02-26 04:38:45 -05:00
hopinheimer
e04a8c31ea adding tests and payload changes 2026-02-26 03:14:57 -05:00
hopinheimer
d5c5077a31 implement scoring mechanisms and plumbing 2026-02-24 17:40:11 -05:00
Michael Sproul
3e3ccba1a6 adding michael commits 2026-02-19 23:13:19 -05:00
hopinheimer
491b69f364 proto node versioning 2026-02-19 23:07:31 -05: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
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
Lion - dapplion
53e73fa376 Remove duplicate state in ProtoArray (#8324)
Part of a fork-choice tech debt clean-up https://github.com/sigp/lighthouse/issues/8325

https://github.com/sigp/lighthouse/issues/7089 (non-finalized checkpoint sync) changes the meaning of the checkpoints inside fork-choice. It turns out that we persist the justified and finalized checkpoints **twice** in fork-choice
1. Inside the fork-choice store
2. Inside the proto-array

There's no reason for 2. except for making the function signature of some methods smallers. It's not consistent with the rest of the crate, because in some functions we pass the external variable of time (current_slot) via args, but then read the finalized checkpoint from the internal state. Passing both variables as args makes fork-choice easier to reason about at the cost of a few extra lines.


  Remove the unnecessary state (`justified_checkpoint`, `finalized_checkpoint`) inside `ProtoArray`, to make it easier to reason about.


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

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2025-11-12 03:42:17 +00:00
Mac L
f5809aff87 Bump ssz_types to v0.12.2 (#8032)
https://github.com/sigp/lighthouse/issues/8012


  Replace all instances of `VariableList::from` and `FixedVector::from` to their `try_from` variants.

While I tried to use proper error handling in most cases, there were certain situations where adding an `expect` for situations where `try_from` can trivially never fail avoided adding a lot of extra complexity.


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

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

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2025-10-28 04:01:09 +00:00
Jimmy Chen
8a4f6cf0d5 Instrument tracing on block production code path (#8017)
Partially #7814. Instrument block production code path.

New root spans:
* `produce_block_v3`
* `produce_block_v2`

Example traces:

<img width="518" height="432" alt="image" src="https://github.com/user-attachments/assets/a9413d25-501c-49dc-95cc-623db5988981" />


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2025-09-10 03:30:51 +00:00
Michael Sproul
836c39efaa Shrink persisted fork choice data (#7805)
Closes:

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


  - [x] Remove `balances_cache` from `PersistedForkChoiceStore` (~65 MB saving on mainnet)
- [x] Remove `justified_balances` from `PersistedForkChoiceStore` (~16 MB saving on mainnet)
- [x] Remove `balances` from `ProtoArray`/`SszContainer`.
- [x] Implement zstd compression for votes
- [x] Fix bug in justified state usage
- [x] Bump schema version to V28 and implement migration.
2025-08-18 06:03:28 +00:00
chonghe
522bd9e9c6 Update Rust Edition to 2024 (#7766)
* #7749

Thanks @dknopik and @michaelsproul for your help!
2025-08-13 03:04:31 +00:00
Jimmy Chen
40c2fd5ff4 Instrument tracing spans for block processing and import (#7816)
#7815

- removes all existing spans, so some span fields that appear in logs like `service_name` may be lost.
- instruments a few key code paths in the beacon node, starting from **root spans** named below:

* Gossip block and blobs
* `process_gossip_data_column_sidecar`
* `process_gossip_blob`
* `process_gossip_block`
* Rpc block and blobs
* `process_rpc_block`
* `process_rpc_blobs`
* `process_rpc_custody_columns`
* Rpc blocks (range and backfill)
* `process_chain_segment`
* `PendingComponents` lifecycle
* `pending_components`

To test locally:
* Run Grafana and Tempo with https://github.com/sigp/lighthouse-metrics/pull/57
* Run Lighthouse BN with `--telemetry-collector-url http://localhost:4317`

Some captured traces can be found here: https://hackmd.io/@jimmygchen/r1sLOxPPeg

Removing the old spans seem to have reduced the memory usage quite a lot - i think we were using them on long running tasks and too excessively:
<img width="910" height="495" alt="image" src="https://github.com/user-attachments/assets/5208bbe4-53b2-4ead-bc71-0b782c788669" />
2025-08-08 05:32:22 +00:00
Eitan Seri-Levi
6786b9d12a Single attestation "Full" implementation (#7444)
#6970


  This allows for us to receive `SingleAttestation` over gossip and process it without converting. There is still a conversion to `Attestation` as a final step in the attestation verification process, but by then the `SingleAttestation` is fully verified.

I've also fully removed the `submitPoolAttestationsV1` endpoint as its been deprecated

I've also pre-emptively deprecated supporting `Attestation` in `submitPoolAttestationsV2` endpoint. See here for more info: https://github.com/ethereum/beacon-APIs/pull/531

I tried to the minimize the diff here by only making the "required" changes. There are some unnecessary complexities with the way we manage the different attestation verification wrapper types. We could probably consolidate this to one wrapper type and refactor this even further. We could leave that to a separate PR if we feel like cleaning things up in the future.

Note that I've also updated the test harness to always submit `SingleAttestation` regardless of fork variant. I don't see a problem in that approach and it allows us to delete more code :)
2025-06-17 09:01:26 +00:00
Eitan Seri-Levi
cbf1c04a14 resolve merge conflicts between untstable and release-v7.0.0 2025-03-23 11:09:02 -06:00