Commit Graph

925 Commits

Author SHA1 Message Date
dapplion
d3416ccc8a Fix fork choice compliance tests 2026-06-08 21:48:20 +02:00
dapplion
c1b60f1c80 Call core proto-array in compliance check 2026-06-08 15:40:34 +02:00
dapplion
2a938715eb Reuse fork-choice child traversal for compliance leaves 2026-06-08 15:34:16 +02:00
dapplion
0223d7ac43 Merge remote-tracking branch 'sigp/unstable' into 9295
# Conflicts:
#	testing/ef_tests/src/cases/fork_choice.rs
2026-06-08 13:31:46 +02:00
Alleysira
abe7ca20a9 fix(network): clear ENR nfd field when no next fork is scheduled during runtime transitions (#9131)
No. But related to #9009 and #8996


  - Change the `ForkContext::next_fork_digest()` to return `[u8; 4]` (returning `[0u8; 4]` for "no next fork").
- Update the initialization path and runtime fork transition path accordingly.

Added tests:
- [x] `test_next_fork_digest` — existing test passes with non-Option return type
- [x] `test_next_fork_digest_returns_zero_when_no_next_fork` — init at last BPO fork returns `[0u8; 4]`
- [x] `test_next_fork_digest_zero_after_runtime_transition_to_last_fork` — simulates `update_current_fork` to last fork, then verifies zero


Co-Authored-By: alleysira <1367108378@qq.com>

Co-Authored-By: Alleysira <56925051+Alleysira@users.noreply.github.com>

Co-Authored-By: chonghe <44791194+chong-he@users.noreply.github.com>
2026-06-05 20:16:28 +00:00
Lion - dapplion
494b00a349 Fix O(n²) find_head and stack overflow in filter_block_tree (#9090)
Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2026-06-05 01:24:49 +00:00
Lion - dapplion
d98de9f8dd Reject importing Gloas block until parent's payload is imported (#9382)
Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-06-04 15:53:05 +00:00
Lion - dapplion
cf259e7c50 Make proposer_score_boost non-optional in ChainSpec (#9386)
Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
2026-06-01 08:43:40 +00:00
Michael Sproul
74a5609ab1 Delete bogus InvalidBestNode error (#9364)
On Glamsterdam devnets we started seeing Lighthouse nodes unable to start with errors like:

> May 26 04:34:01.582 CRIT  Failed to start beacon node                   reason: "Unable to load fork choice from disk: ForkChoiceError(ProtoArrayStringError(\"find_head failed: InvalidBestNode(InvalidBestNodeInfo { current_slot: Slot(23550), start_root: 0x2c70b1641c29ec46360c99f9a8512f077862cbbc603e16f4a423007d210b0c5f, justified_checkpoint: Checkpoint { epoch: Epoch(712), root: 0x2c70b1641c29ec46360c99f9a8512f077862cbbc603e16f4a423007d210b0c5f }, finalized_checkpoint: Checkpoint { epoch: Epoch(710), root: 0xede5e0b09b51bdb5445ade3398e685bd193b845e0b0ffb827f0c3fec8277ea51 }, head_root: 0x2c70b1641c29ec46360c99f9a8512f077862cbbc603e16f4a423007d210b0c5f, head_justified_checkpoint: Checkpoint { epoch: Epoch(710), root: 0xede5e0b09b51bdb5445ade3398e685bd193b845e0b0ffb827f0c3fec8277ea51 }, head_finalized_checkpoint: Checkpoint { epoch: Epoch(709), root: 0xbb243eff616ff362c52b83113e7c536d0a68cb9ca3d6a1cb1055e732219d9736 } })\"))"

This error was the result of an overly-strict sanity check, based on assumptions that are not true under extreme network conditions.


  Completely remove the `InvalidBestNode` failure path: it is not compliant with the spec, and is actively harmful when triggered (it prevents Lighthouse from starting at all). The error was reachable in any situation where all leaf nodes of fork choice were ineligible to be the head. The payload invalidation tests show some examples of cases where this would happen, and the [newly-added regression test](9a5df1d982) shows a contrived case where it can happen on a Gloas network without _any_ slashings or invalid blocks. There are probably many more cases where it can happen.

We do not lose anything by removing it. The spec's implementation of `get_head` _always_ returns something (unless it crashes), and in these cases it is correct to return the starting node of the traversal: the justified checkpoint block. This is what we now do, and what the new test verifies.

I've also added some facilities to the harness for injecting attestations with fixed `payload_present` fields. @hopinheimer found himself needing something similar when messing with reorg tests, so I think these are probably useful. It might be possible to do without them by juggling the payload reveal timing in just the right way, but I think this approach is just way simpler.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-06-01 00:46:58 +00:00
Pawan Dhananjay
ba3abf943f Rust 1.96 lints (#9368)
N/A


  A rare single line lint update .


Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
2026-05-29 00:17:53 +00:00
Michael Sproul
0a91b63c25 Merge remote-tracking branch 'origin/unstable' into fc-compliance 2026-05-25 15:42:29 +10:00
Michael Sproul
cc55c9ef5e Merge remote-tracking branch 'michael/payload-attestation-committee-cache' into fc-compliance 2026-05-25 15:35:03 +10:00
Michael Sproul
4903fff430 Fix non-canonical payload attestation processing (#9305)
Breakout from:

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

We currently do not handle the verification of payload attestations on non-canonical side chains, we always attempt to use the head. The included regression test demonstrates this, and there is _also_ a fork choice compliance test in #9295 that triggers it.


  This PR is a bit opinionated, but I'll explain my judgements:

- We need a way to get the PTC for an arbitrary slot from an arbitrary state. This involves potential state advances, database lookups, etc. There is some fiddly logic required to check that states are in range/etc.
- We _already have_ a cache with the exact same lifecycle as the PTCs, namely the attester shuffling cache. Therefore, we can de-duplicate a lot of the complexity by storing the PTCs for a given epoch (and decision block) in this cache.

The other opinionated change is in the tests. The previous tests were set up kind of nicely to avoid instantiating a `BeaconChainHarness`. However they were not using mocking, which made testing the non-canonical chain case kind of infeasible. To remedy this, I've changed them to just use a beacon chain harness and create two chains using its relatively easy to use methods for doing this. The running time of the tests goes from something like 2.6s for 8 tests to 3.3s for 9 tests, which is only an increase of 0.04s/test. Negligible. Another plus to using the `BeaconChainHarness` is that it avoids a bunch of the cruft to create synthetic non-mocked beacon chain bits.

At the same time, I've made some attempt to improve modularity (and fit with the `GossipVerificationContext`) by pulling out the guts of `with_committee_cache` into a new function (`with_cached_shuffling`) that clearly shows its dependency surface.


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

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
2026-05-25 05:06:27 +00:00
chonghe
9b961960c4 Deprecate some reorg-related CLI flags and read from spec (#9177)
- #9123


  


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

Co-Authored-By: chonghe <44791194+chong-he@users.noreply.github.com>
2026-05-25 02:11:27 +00:00
Mac L
89ee020330 Add macro to simplify into_full_block implementations (#9294)
Use a macro to remove the repetitive fork variant boilerplate in `signed_beacon_block.rs` when implementing `into_full_block` for the various `SignedBeaconBlock` variants


Co-Authored-By: Mac L <mjladson@pm.me>
2026-05-25 01:29:34 +00:00
Michael Sproul
d7dcf58257 Merge remote-tracking branch 'origin/unstable' into payload-attestation-committee-cache 2026-05-24 22:01:42 +10:00
Eitan Seri-Levi
5693d86002 Ensure we use the right fork when calculating payload attestation sig domain (#9342)
Using `state.fork` is a bit sketchy at the fork boundary. It's safer to just use the payload attestations slot


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2026-05-22 17:50:45 +00:00
Eitan Seri-Levi
60abd4b5b9 Gloas alpha spec 8 (#9315)
https://github.com/ethereum/consensus-specs/releases/tag/v1.7.0-alpha.8


  


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

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-05-22 06:21:20 +00:00
dapplion
52115542c1 Merge remote-tracking branch 'sigp/unstable' into payload-attestation-committee-cache
# Conflicts:
#	beacon_node/beacon_chain/src/payload_attestation_verification/tests.rs
2026-05-21 21:02:34 +02:00
Lion - dapplion
1caaa10fa8 Drop unused EthSpec generic from Stores (#9281)
Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
2026-05-21 08:35:35 +00:00
Michael Sproul
ece4bc0fa8 Fix proto_array tests 2026-05-21 16:21:47 +10:00
Daniel Knopik
a9637c1650 Partial columns cleanup (#9321)
#8314 left a few ugly potentially panicking location behind - all of them believed to be unreachable, but this PR fixes them regardless for good hygiene.


  Update to `ethereum_ssz 0.10.4` for two new helpers: `not_inplace` and `clone_zeroed`.

Remove remaining `expect` and `todo!` in favour of these helpers and one new fallible (but practically infallible) method.


Co-Authored-By: Daniel Knopik <daniel@dknopik.de>
2026-05-21 03:25:02 +00:00
Michael Sproul
4f2b393edb Remove future slot rejection 2026-05-18 13:53:14 +10:00
Michael Sproul
26098446db Merge branch 'payload-attestation-committee-cache' into fc-compliance 2026-05-18 12:57:19 +10:00
Michael Sproul
c03c045f8b Fix non-canonical payload attestation processing 2026-05-14 22:30:24 +10:00
Michael Sproul
c65ed44d50 Clean up 2026-05-14 14:55:54 +10:00
Michael Sproul
c87522411c Pass make lint-full 2026-05-14 13:24:01 +10:00
Daniel Knopik
1a68631180 Gloas payload cache (#9209)
In Gloas, beacon blocks are imported into fork choice immediately - the payload envelope and data columns arrive
separately. KZG commitments moved from the column sidecar into the execution payload bid, so the existing
`DataAvailabilityChecker` (which assumes block and data are coupled) can't be used for Gloas.


  * Introduced `PendingPayloadCache` to keep track of payload and data columns per block root.
* Added gossip column verification
* Added support for Gloas data column reconstruction
* Payload envelope verification simplified: removed `MaybeAvailableEnvelope`, `ExecutedEnvelope`, `EnvelopeImportData`

Not yet implemented (tracked with TODOs):
- Proper lookup sync for Gloas columns arriving before blocks
- Partial column merging for Gloas
- Moving `load_gloas_payload_bid` disk reads off the async runtime
- Backfill/range sync for Gloas

Based on @eserilev's PR and work in progress. See also #9202 for verification.


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

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

Co-Authored-By: Daniel Knopik <daniel@dknopik.de>

Co-Authored-By: Daniel Knopik <107140945+dknopik@users.noreply.github.com>

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

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-05-13 07:03:34 +00:00
Michael Sproul
715d6bfa0c All tests bar invalid_message passing, changes might be dubious 2026-05-13 09:26:27 +10:00
hopinheimer
757873200b Fix stale beacon_state_root in test helpers (#9289)
Test helpers `add_attested_block_at_slot` and `add_attested_blocks_at_slot` accepted `state_root` argument which was computed before applying the block.


  


Co-Authored-By: hopinheimer <knmanas6@gmail.com>
2026-05-12 06:24:18 +00:00
Michael Sproul
e9ae5babc8 Passing 3/6 compliance tests, but a bit sketchy 2026-05-12 15:31:06 +10:00
Michael Sproul
d77c23bcfb Reject future attestations with an error 2026-05-12 11:47:46 +10:00
Michael Sproul
14a4de41e0 Move payload status validation prior to mutations! 2026-05-12 11:47:16 +10:00
Michael Sproul
df9399e957 Fix more issues (mainly payload attestation application) 2026-05-11 22:04:24 +10:00
parithosh
8eed94e64a ef_tests: wire fork-choice compliance suites
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 15:17:03 +10:00
Mac L
3351db1ba8 Remove TestRandom (#9006)
We  have a legacy `TestRandom` trait which generates random types for testing and fuzzing.
This function overlaps with `arbitrary` which is used very commonly in the ecosystem.


  Remove `TestRandom` and generate random type instances using `Arbitrary`.


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

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-05-05 06:35:57 +00:00
Michael Sproul
8b8124d4a4 Avoid 0x00 block hashes in fcU (#9233)
- Avoid sending 0x00 block hashes for the safe and finalized block hashes post-Gloas.
- Add code to check this inside the mock EL, which will be reached in all Gloas beacon chain tests


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-05-01 09:12:11 +00:00
Eitan Seri-Levi
effcd08223 Gloas proposer preferences alpha 7 (#9239)
We yolo'd to alpha 7. We're just changing the proposer preference to include dependent root, instead of checkpoint root. This way we can actually construct it within the VC without needing a view of fork choice.


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2026-04-30 09:36:45 +00:00
Michael Sproul
f406e9c3fb Update proposer boost calculation (#9215)
Closes:

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


  - Calculate the proposer index on the canonical chain (from canonical head) at `slot` and plumb it through to fork choice so it can be used to determine whether or not to apply the proposer boost. We use the proposer cache to handle state advances and avoid duplicate work.
- Update our FC tests to use `block.message().proposer_index()` (always pass), we are not attempting to test this feature in those tests. The EF tests use the correct canonical proposer idnex via `on_block`, except for invalid blocks which just auto-pass this check (these blocks get rejected by other checks in `on_block` anyway).


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-04-29 12:19:44 +00:00
jking-aus
16132a3694 Spec v1.7.0-alpha.6 and Gloas genesis (#9190)
Co-Authored-By: Josh King <josh@sigmaprime.io>

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

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-04-29 08:23:24 +00:00
Mac L
949c027dfd Add method to Hash256 to display shortened hashes (#9118)
#6689


  Inspired by the initial implementation of #9108, credit to @chong-he.
This adds an extension trait to `Hash256` and add a `short` method to provide smaller formatted hashes for logging.


Co-Authored-By: Mac L <mjladson@pm.me>
2026-04-28 07:01:13 +00:00
hopinheimer
6ab48a76f0 Gloas PayloadAttestation gossip verification (#9145)
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: Jimmy Chen <jchen.tc@gmail.com>
2026-04-27 09:51:20 +00:00
Shane K Moore
fae7941b2d Gloas ptc duties beacon node response (#8415)
Co-Authored-By: shane-moore <skm1790@gmail.com>

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

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

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
2026-04-26 15:25:00 +00:00
Eitan Seri-Levi
276c4d5ff3 Gloas set AttestationData.index (#9100)
For gloas `attestation.data.index` should be set to 1 if we are attesting to a block whose slot is not the attestation duty slot and slot payload_status is `FULL`


  


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

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

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
2026-04-26 13:40:22 +00:00
Eitan Seri-Levi
6323cd3827 Fix builder exit signature batch verification logic and small refactor (#9173)
We had a bug when performing batch builder exit signature verification. The EF spec tests cover this case, but the EF tests only calls  individual signature verification (which is a separate code path). This PR unifies the two code paths. We should probably spend some time reviewing EF test code coverage and make sure we don't have separate code paths that do similar things.


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2026-04-25 23:51:02 +00:00
hopinheimer
df764ffa9a Re-issue ForkchoiceUpdate based on updated PayloadStatus (#9102)
Co-Authored-By: hopinheimer <knmanas6@gmail.com>

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

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
2026-04-25 08:04:09 +00:00
Daniel Knopik
8a384ff445 Cell Dissemination (Partial messages) (#8314)
- https://github.com/ethereum/consensus-specs/pull/4558
- https://eips.ethereum.org/EIPS/eip-8136


  


Co-Authored-By: Daniel Knopik <daniel@dknopik.de>

Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
2026-04-23 18:52:28 +00:00
Eitan Seri-Levi
82dc8b4edc Ensure payload envelope streamer always serves canonical envelopes after the split slot (#9085)
Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2026-04-23 11:32:26 +00:00
Michael Sproul
cf3d5e285e Gloas spec v1.7.0-alpha.5 and beacon_chain tests (#8998)
Fix database pruning post-Gloas


  - Fix DB pruning logic (and state summaries DAG)
- Get the `beacon_chain` tests running with `FORK_NAME=gloas` 🎉


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

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

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

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

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
2026-04-21 06:29:15 +00:00
Michael Sproul
9b08e1ad63 Fix total_effective_balance=0 in PreEpochCache (#9106)
Fix a **consensus fault** in `PreEpochCache` 🙀

Fortunately it's only reachable on a network with `total_active_balance=0`, i.e. a network that's already completely dead. As such this PR is not time-sensitive in any way.


  Add the floor on `total_effective_balance` when converting from `PreEpochCache` to `EpochCache`. An alternative would be to add the floor inside `PreEpochCache::get_total_active_balance`, however that would be redundant, as the only place this function is called outside this file is in single-pass epoch processing:

176cce585c/consensus/state_processing/src/per_epoch_processing/single_pass.rs (L461-L462)

The `set_total_active_balance` call already handles the floor.

A regression test is included.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
2026-04-20 00:59:39 +00:00