Skip to content

chore: v1.40.0 release#8875

Draft
nflaig wants to merge 70 commits intostablefrom
rc/v1.40.0
Draft

chore: v1.40.0 release#8875
nflaig wants to merge 70 commits intostablefrom
rc/v1.40.0

Conversation

@nflaig
Copy link
Member

@nflaig nflaig commented Feb 6, 2026

No description provided.

twoeths and others added 30 commits January 22, 2026 10:11
**Motivation**

- the function isValidBlsToExecutionChange() requires a state which is
used to get config and validator from
- but we'll not have `CachedBeaconStateAllForks` after #8650

**Description**

- pass config and validator to this function instead

part of #8657

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
…lashing() (#8744)

**Motivation**

- the 2 functions `assertValidAttesterSlashing()` and
`assertValidProposerSlashing()` requrie the full
`CachedBeaconStateAllForks` but we don't need to
- this PR simplifies it so that it'll work with the future
BeaconStateView when we integrate the native state-transition, see #8650

**Description**

pass required properties from state instead
- `assertValidAttesterSlashing()`: pass config, stateSlot, validators
length instead of the whole `CachedBeaconStateAllForks`
- `assertValidProposerSlashing()`: config, index2pubkey, stateSlot,
proposer instead of the whole `CachedBeaconStateAllForks`

part of #8657

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
**Motivation**

- the code to get attestations to include to a pre-electra block is
complex and it makes it hard for a migration to `IBeaconStateView`, we
need to remove it
- it's a good chance to upgrade some e2e tests to run from `electra` to
`fulu` which is a good preparation for `gloas`

**Description**

- throw error for `getAttestationsForBlockPreElectra()` in
`AggregatedAttestationPool`
- e2e tests to start from electra
- dev command to start from electra

part of #8658

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
…8742)

**Motivation**
Enables tests that need DB persistence and state resumption across node
restarts.

**Description**
- Use `options.db?.name ?? tmpDir.name` instead of hardcoded
`tmpDir.name` in `getDevBeaconNode()`.
- Added `resumeFromDb` option that loads anchor state from existing DB
via `initStateFromDb()` instead of creating fresh genesis. This
preserves the finalized epoch from previous runs.

**Use case**: Backfill sync tests that restart nodes mid-sync need to
resume from persisted state, not start fresh from epoch 0.
**Motivation**

- When `lodestar-z` happens, `BeaconStateAllForks` will be a blocker and
The `build()` method in `ShufflingCache` depends on it.
- Post-Fulu proposer lookahead is stored in `BeaconState`, requiring
shufflings synchronously during epoch transitions—making the async
`build()` pattern no longer viable.

**Description**
- Remove `build()` method from `IShufflingCache` interface and
`ShufflingCache` class
- Add `set()` to `IShufflingCache` interface to add shufflings 
- Remove `asyncShufflingCalculation`

Closes #8653 

**AI Assistance Disclosure**

- [x] External Contributors: I have read the [contributor
guidelines](https://github.com/ChainSafe/lodestar/blob/unstable/CONTRIBUTING.md#ai-assistance-notice)
and disclosed my usage of AI below.
use claude to understand how ShufflingCache avoids recomputation 
<!-- Insert any AI assistance disclosure here -->

---------

Co-authored-by: matthewkeil <me@matthewkeil.com>
**Motivation**

- we never mutate state inside beacon-node so we should not do the
clone() there, same to commit()
- it's not a problem for ts BeaconStateView, even not a big performance
issue for the native BeaconStateView, it's just that we don't have to
because it's a principle to not to mutate any BeaconStates in
beacon-node
- this helps us not having to implement `clone()` and `commit()` in the
BeaconStateView interface

**Description**

- remove `clone()` in state caches and `regen.getState()` api
- remove `commit()`
- remove unused functions
- do `state.clone()` of rewards api to inside its implementation
- simplify `computeBlockRewards()`

Closes #8725

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
## Summary

Backport of #8781 to unstable branch.

- Fix JavaScript falsy check bug where `!0 === true` caused slot 0 to
incorrectly fail validation
- Fix inverted blobsCount logic in dataColumnResponseValidation.ts

## Problem

During custody backfill for epoch 0 (slots 0-7), the
`data_column_sidecars_by_range` RPC handler was throwing:
```
Can not parse the slot from block bytes
```

This was caused by the slot parsing check using JavaScript's falsy
check:
```typescript
if (!slot) throw new Error("Can not parse the slot from block bytes");
```

Since `!0 === true` in JavaScript, slot 0 (genesis block) incorrectly
triggered this error.

## Changes

1. **Root cause fix** (`sszBytes.ts`): Changed `if (!slot)` to `if (slot
=== null)` for explicit null check
2. **Logic fix** (`dataColumnResponseValidation.ts`): Changed
`blobsCount > 0` to `blobsCount === 0`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Ubuntu <ubuntu@ethereum-node1.local>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
All the files inside `node_modules/.bin` are shell scripts since we
switched to pnpm which can't be executed via `node`.
**Motivation**

Support single db operation to delete/put in a single repository. Will
partially covers #8244 and
enable next step for the across db repositories atomic write.

**Description**

- Allow bundle `put` and `delete` in a single batch


**Steps to test or reproduce**

- Run all tests

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
**Motivation**

- after we migrate to the native state-transition, we're not able to
query EpochCache methods anymore

**Description**

- use our ShufflingCache to query for these methods instead, the list
includes:
  - getIndexedAttestation()
  - getAttestingIndices()
  - getBeaconCommittee()
  - getBeaconCommittees()

Closes #8655

blocked by #8721

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
**Motivation**

- our benchmark is super flaky and I rarely see we have CI green
- our snappy benchmark is only useful in scope of a PR #6483, it's not
worth to keeps running it on CI
- we want to only run benchmark for functions developed by us to save CI
time, see #8664

**Description**

- skip snappy benchmark

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
**Motivation**

- found failed benchmark in
[CI](https://github.com/ChainSafe/lodestar/actions/runs/21348436170/job/61440256289?pr=8732)
but that's not lodestar code
- see also #8786

**Description**

- skip Map benchmark

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
**Motivation**

This PR adds a directory with specification references. These are used
to map specification items (configs, presets, functions, etc) to client
implementations (code in Lodestar). These specification references are
meant to (1) help developers keep track of specification changes and (2)
make it easier for third-parties (eg EF Protocol Security) to verify
clients adhere to the specifications.

Our team is working to do this for all clients.

* Consensys/teku#9731
* OffchainLabs/prysm#15592
* sigp/lighthouse#8549

*Note*: The function mappings are the only weak-spot. It's quite
difficult to map some of these because of implementation differences &
the fact that not everything is implemented (eg Gloas functions). The
specref functions will most likely require some additional work, but
this PR does identify most functions.

**AI Assistance Disclosure**

- [x] External Contributors: I have read the [contributor
guidelines](https://github.com/ChainSafe/lodestar/blob/unstable/CONTRIBUTING.md#ai-assistance-notice)
and disclosed my usage of AI below.

Yes, I used Claude Code to identify/map most of these.

Fixes: #7477

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
**Motivation**

This PR is follow up from:

* #8778

**Description**

This PR enables a few optional features:

* `auto_add_missing_entries`: Add missing spec items to the relevant
mapping files. It _will not_ add missing spec items if there's an
exception for that spec item.
* `auto_standardize_names`: Automatically add `#fork` tags to specref
names, for explicitness.
* `require_exceptions_have_fork`: Require exceptions include a `#fork`
tag.

It also removes the KZG functions (which clients do not implement) from
the `functions.yml` file. @ensi321 could you give me a list of other
items we want to remove?

And it also
[fixes](da91b29)
the search query for `get_committee_assignment` which was moved before
the first PR was merged.

**AI Assistance Disclosure**

- [x] External Contributors: I have read the [contributor
guidelines](https://github.com/ChainSafe/lodestar/blob/unstable/CONTRIBUTING.md#ai-assistance-notice)
and disclosed my usage of AI below.

I used AI to remove the KZG functions.
**Motivation**

- currently state repositories (StateArchiveRepository +
CheckpointStateRepository) tightly coupled with `BeaconStateAllForks`
which make it hard when we migrate to a generic BeaconStateView (to be
come later, see #8650)
- so we need to let these repos to work with Uint8Array and let
consumers decide how to create a type/view of BeaconState from there

**Description**

- separate the abstract repository to be extended from a newly created
`BinaryRepository`
- then let `StateArchiveRepository + CheckpointStateRepository` to be
extended from `BinaryRepository`
- the benefit is consumer can only use methods in `BinaryRepository`,
it's a compile time check, vs calling methods in `Repository` and throw
runtime error which make it harder to detect errors
- so we only need to validate this PR via compilation instead of having
to launch a node to confirm, and it's tricky to detect error there
- update consumers accordingly

Closes  #8729

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
**Motivation**

- it's not easy to find logs of `archiveBlocks` for a specified current
epoch or finalized epoch

**Description**

- add log context to it

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
- Introduce builder entity to beacon state
- add builder deposit, withdrawal and withdrawal sweep
- bump spec test version to `v1.7.0-alpha.1`
- skipping certain fork choice spec test as there are retroactive change
to the proposer boost spec.

Basically covers gloas beacon-chain spec change from v1.6.1 to
v1.7.0-alpha.1


https://github.com/ethereum/consensus-specs/compare/v1.6.0...v1.7.0-alpha.1?path=specs/gloas/beacon-chain.md

Spec ref: ethereum/consensus-specs#4788

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
This just adds assertions to check prior withdrawals against limit which
is done in the spec
[here](https://github.com/ethereum/consensus-specs/blob/ee5d067abf6486b77753e7c2928a81cf50972c75/specs/gloas/beacon-chain.md?plain=1#L862).

This shouldn't happen unless there is a bug in our implementation but
it's good to have them as sanity checks.
**Motivation**

During v1.39.0 release, we decided it should be clear that release notes
should be clearly added on the Github release page.

**Description**

This PR is just to more clearly outline the required step of release for
publishing the release notes to the Github release page also.

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wemeetagain <1348242+wemeetagain@users.noreply.github.com>
Closes #8698

**Motivation**

Infrastructure operators want to easily see which validator indices are
connected to their beacon node at a glance.

**Description**

- Add `GET /eth/v1/lodestar/monitored_validators` API endpoint that
returns array of validator indices currently being monitored
- Add info-level logs when validators register/unregister from the
monitor, including the full list of monitored indices:
- `Validator registered to monitor index=X, total=Y, indices=0,1,2,...`
  - `Validator removed from monitor index=X, total=Y, indices=0,1,3,...`

**Usage**

API endpoint:
```bash
curl http://localhost:9596/eth/v1/lodestar/monitored_validators
# Response: {"data":[0,1,2,3,4,5,6,7]}
```

For dashboard integration (e.g., Grafana), you can use the JSON API
datasource plugin to poll this endpoint and display the validator
indices.

***Design decisions***
- Used debug namespace instead of lodestar because it's enabled by
default (no need for --rest.namespace all)
- Used API + logs approach instead of metrics to avoid cardinality
issues with validator index labels
- Logs include full indices list so operators can see the complete state
at each change without calling the API
- add static metric with validator indices as label

<img width="810" height="134" alt="image"
src="https://github.com/user-attachments/assets/3f5e3ed6-2e23-470f-bf4e-7692cc744cc2"
/>
<img width="696" height="31" alt="image"
src="https://github.com/user-attachments/assets/cf0addfc-58cf-4efb-8638-6d94df61948e"
/>

[link to issue](#8698)

Closes #8698

**AI Assistance Disclosure**

- [x] External Contributors: I have read the [contributor
guidelines](https://github.com/ChainSafe/lodestar/blob/unstable/CONTRIBUTING.md#ai-assistance-notice)
and disclosed my usage of AI below.

Used Claude Code to assist with implementation and code exploration.

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
**Motivation**

- towards #8408 

**Description**

- Make `writeBlockInputToDb` async with block import/head update
- Add a job queue to trigger trigger writes (one at a time)
- For serving unfinalized blocks, check the block input cache first,
before checking hot db
- For serving unfinalized block blob sidecars, check the block input
cache first, before checking hot db
- see new `chain.getBlobSidecars` and `chain.getSerializedBlobSidecars`
-- note: only serves all or none
  - new chain methods used in API and reqresp
  - note: old db method still used in by_range
- For serving unfinalized block data column sidecars, check the block
input cache first, before checking hot db
- see new `chain.getDataColumnSidecars` and
`chain.getSerializedDataColumnSidecars`
- Let the `writeBlockInputToDb` process prune the block input cache
after its run
- Remove the `eagerPersistBlock` option, since it's now irrelevant
lodekeeper and others added 22 commits February 2, 2026 10:08
## Description

Fixes the failing lightclient e2e test after upgrading to electra.

### Root Cause

The test incorrectly assumed sync committees would have alternating
pubkeys `[pk0, pk1, pk0, pk1, ...]`:

```typescript
const committeePubkeys = Array.from({length: SYNC_COMMITTEE_SIZE}, (_, i) =>
  i % 2 === 0 ? pubkeys[0] : pubkeys[1]
);
```

However, sync committees are computed using a **weighted random
shuffle** based on:
- A seed derived from the state
- Validator effective balances

### Why it broke post-electra

In `getNextSyncCommitteeIndices()`, the shuffle parameters changed for
electra:

```typescript
if (fork >= ForkSeq.electra) {
  maxEffectiveBalance = MAX_EFFECTIVE_BALANCE_ELECTRA;  // Different!
  randByteCount = 2;  // Different! (was 1)
}
```

The shuffle algorithm now uses 2 random bytes instead of 1, producing a
completely different committee distribution even with the same
validators.

### Fix

Get the actual sync committee root from the head state instead of
constructing an incorrect expected committee.

Closes #8723

---

> [!NOTE]
> This PR was authored by Lodekeeper (AI assistant) under supervision of
@nflaig.

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
…#8841)

## Description

Fixes flaky lightclient e2e test failures introduced in #8825.

### Root Cause

The `waitForBestUpdate()` function can take up to **7000ms**:
- 5 slots waiting for `lightClientOptimisticUpdate` event (5000ms)  
- 2 slots sleep (2000ms)

But the default vitest timeout is **5000ms**, causing race condition
failures on slower CI machines.

### Evidence

Local test run showed `getLightClientUpdatesByRange()` taking
**7384ms**:
```
✓ getLightClientUpdatesByRange() 7384ms
✓ getLightClientOptimisticUpdate() 5982ms  
✓ getLightClientCommitteeRoot() for the 1st period 6003ms
```

### Fix

Increases timeout to 10s for tests using `waitForBestUpdate()`.

---

> [!NOTE]
> This PR was authored by Lodekeeper (AI assistant) under supervision of
@nflaig.

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
…8829)

## Description

Fixes an uncaughtException crash when connecting to a peer with a
malformed public key.

### Error

```
uncaughtException: Point of length 294 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes
    at fromBytes (node_modules/@noble/curves/esm/abstract/weierstrass.js:594:23)
    at uncompressPublicKey (node_modules/@chainsafe/enr/lib/defaultCrypto.js:17:38)
    at computeNodeId (packages/beacon-node/lib/network/subnets/interface.js:12:37)
    at PeerManager.onLibp2pPeerConnect (packages/beacon-node/lib/network/peers/peerManager.js:117:28)
```

### Fix

Wrap `computeNodeId(remotePeer)` in a try-catch. If computing the node
ID fails (due to invalid public key), log at debug level and disconnect
the peer gracefully with a GOODBYE.

### Notes

This is a defensive fix - we shouldn't crash the node because one peer
has malformed crypto data. The peer is simply disconnected.

Closes #8302

---

*This PR was authored with AI assistance (lodekeeper using Claude Opus
4).*

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
**Motivation**

- it takes effort to maintain the obsolete unused state caches, because
we gonna need to enhance them for both BeaconStateView and glamsterdam

**Description**

- remove in-memory state caches
- remove nHistoricalState flag, its usage is only to instantiate the
correct state caches. This flag is defaulted to true for a long time
anyway.

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
**Motivation**

- Resolves #8404
- Replaces #8408

**Description**

- Add condition to `blockInput.hasAllData` to trigger if the number of
columns is enough to reconstruct (gte `NUMBER_OF_COLUMNS / 2`)
- Add `blockInputColumns.hasComputedAllData`, used to await full
reconstruction during `writeBlockInputToDb`
**Motivation**

Discussed in Bun discord thread that since we are no longer targeting
Bun currently in our main development path, we can disabled unit tests
until there's a bit more maturity upstream. This was also discussed on
standup Feb 3, 2026: #8843

**Description**

This PR disables `test-bun.yml` by commenting out the yaml.
Adds local development artifacts to .gitignore:

- `.venv/` - Python virtual environments (used for spec tools like
ethspecify)
- `checkpoint_states/` - Checkpoint state files from local testing

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Add support for GossipSub direct peers, allowing nodes to maintain
permanent mesh connections without GRAFT/PRUNE negotiation. This enables
proper peering agreements with other clients like Nimbus.

Direct peers can be configured via CLI:
  --directPeers /ip4/192.168.1.1/tcp/9000/p2p/16Uiu2HAm...

Both peers must configure each other as direct peers for the feature to
work properly (reciprocal configuration).

**Motivation**

Direct peers are not supposed to send GRAFT/PRUNE messages. Pointing
other CLs to Lodestar makes the other CLs receive these messages. Nimbus
in response spams its logs with warning on each GRAFT/PRUNE message.

**Description**

<!-- A clear and concise general description of the changes of this pull
request. -->

The underlying p2p library already support direct peers. The PR is
plumbing this feature to the a cmdline.

**AI Assistance Disclosure**

- [x] External Contributors: I have read the [contributor
guidelines](https://github.com/ChainSafe/lodestar/blob/unstable/CONTRIBUTING.md#ai-assistance-notice)
and disclosed my usage of AI below.

<!-- Insert any AI assistance disclosure here -->

This code was generated by Claude as disclosed in the Co-Author line.
Frankly, given that this is mostly plumbing there wasn't much to object
to. More importantly, I pushed a modified binary to my production
environment and verified that:
* Lodestar launches with the new cmdline
* Lodestar prints "Adding direct peer" for each peer given.
* Lodestar syncs and produces attestations.
* Nimbus stops complaining that Lodestar GRAFT/PRUNE messages.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
## Description

Fix two lint warnings in the codebase:

1. **packages/beacon-node/src/chain/chain.ts:343** - `let` → `const` for
`checkpointStateCache` since it's only assigned once

2. **packages/light-client/test/unit/webEsmBundle.browser.test.ts:3** -
Remove unused `biome-ignore` comment (the rule it was suppressing is no
longer triggered)

---

*This PR was authored with AI assistance (Lodekeeper 🔥)*

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
## Description

Addresses multiple flaky test failures observed in CI runs.

### Changes

1. **Health check timeout (30s -> 60s)** in crucible runners
   - `childProcessRunner.ts`
   - `dockerRunner.ts`

2. **Test timeouts increased:**
   - `cachedBeaconState.test.ts`: 20s -> 30s
- `unknownBlockSync.test.ts`: 40s -> 60s (also added retry for
`db.block.get`)
   - `syncInMemory.test.ts`: 20s -> 30s
   - `sync.node.test.ts`: 30s -> 45s

3. **Prover e2e tests:**
   - `minFinalizedTimeMs`: 64s -> 90s (hookTimeout)
   - `start.test.ts` beforeAll: 50s -> 80s

### Motivation

These tests have been failing intermittently in CI due to:
- Slow CI runner startup (health check timeout exceeded)
- Slow execution environment causing test timeouts
- Race conditions in database persistence (unknownBlockSync)

### Testing

- Build passes locally
- Lint passes locally

The increased timeouts help tests pass on slow CI runners without
affecting correctness.

---

*This PR was authored with AI assistance. The changes were reviewed
before submission.*

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
…setups (#8849)

## Description

Fixes #8848

In multi-beacon-node setups (DVT, fallback configurations,
high-availability validators), the same block may be published to
multiple beacon nodes simultaneously. When this happens, a race
condition can occur:

1. Validator client (e.g., Vero) requests an unsigned block from Node A
2. Validator signs the block
3. Validator publishes the signed block to **multiple nodes** (Node A
and Node B)
4. Node A receives the publish first and starts gossiping the block +
data columns
5. Node B receives columns via gossip from Node A
6. Node B's API publish handler tries to add columns that already exist
in the cache
7. `publishBlockV2` throws `BLOCK_INPUT_ERROR_INVALID_CONSTRUCTION` with
message "Cannot addColumn to BlockInputColumns with duplicate column
index"

The same issue can occur with blobs in pre-Fulu forks.

## Solution

Pass `{throwOnDuplicateAdd: false}` to `addColumn()` and `addBlob()` in
`publishBlock`. This option already exists and is used correctly in
`seenGossipBlockInput.ts` when handling gossip-received data. Receiving
the same columns/blobs from both gossip and API is valid behavior in
multi-BN setups and should not throw an error.

## Testing

The fix uses an existing, well-tested code path. The
`throwOnDuplicateAdd: false` option causes `addColumn`/`addBlob` to
silently return when a duplicate is detected, which is the correct
behavior when the same data arrives from multiple sources.

---

*This PR was developed with AI assistance (disclosure per project
contribution guidelines).*

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
## Description

Update `@vekexasia/bigint-buffer2` to v1.0.5 and re-enable the Bun CI
workflow.

### Changes

1. **Update bigint-buffer2 to v1.0.5**
- Fixes native bindings issue in Bun runtime
(vekexasia/bigint-swissknife#3)
- The maintainer fixed unsafe code that was causing buffer mutations in
Bun

2. **Add minimumReleaseAgeExclude**
- v1.0.5 was released today, so we need to exclude it from the 48h
release age check

3. **Re-enable Bun CI workflow**
   - Uncommented `.github/workflows/test-bun.yml`
   - Runs unit tests for compatible packages under Bun runtime

### Local Testing

Ran `bun run --bun test:unit` on `@lodestar/utils` package - all 225
tests pass ✅

### Related

- Fixes: vekexasia/bigint-swissknife#3
- Related to: #8789

---

*This PR was authored with AI assistance (Lodekeeper 🔥)*

---------

Signed-off-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
#8840)

## Motivation

Follow-up from #8821 — adds a manually triggered workflow for ad-hoc
Docker image tagging.

## Description

Adds a `workflow_dispatch` workflow that allows building and tagging
Docker images from any git ref with a custom tag name.

### Features

- **Git ref input**: Build from any commit SHA, branch, or tag
- **Custom tag**: Apply any custom Docker tag (with validation to
prevent overwriting `latest`, `next`, etc.)
- **Push toggle**: Option to push to Docker Hub or just build locally
for testing
- **Multi-platform**: Builds for amd64/arm64 when pushing
- **Sanity checks**: Runs `--help` and displays image history
- **Job summary**: Shows pull command after successful push

### Usage

1. Go to Actions → "Publish ad-hoc Docker image"
2. Click "Run workflow"
3. Enter:
   - Git ref (e.g., `abc1234`, `unstable`, `v1.24.0`)
   - Docker tag (e.g., `test-feature`, `debug-issue-123`)
   - Whether to push to Docker Hub
4. Pull with `docker pull chainsafe/lodestar:<your-tag>`

---

*This PR was authored by an AI contributor (Lodekeeper) with human
supervision.*

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
…8862)

## Summary

Follow-up to #8840 per [review
feedback](#8840 (comment)).

### Changes

- **Renamed** `publish-adhoc.yml` → `publish-manual.yml`
- **Added** optional `ref` input to `docker.yml` for building from
specific commits
- **Refactored** manual workflow to call `docker.yml` instead of
duplicating build logic
- **Removed** `push` option - now always pushes (consistent with other
publish workflows)
- **Builds** all images (lodestar, grafana, prometheus) via docker.yml

### Why

Keeps the manual workflow consistent with other publish workflows and
reduces code duplication.

---
*Generated with AI assistance (Claude/OpenClaw). Human-supervised and
tested.*

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
## Description

Add HTTP API endpoints to manage GossipSub direct peers at runtime,
allowing operators to dynamically add/remove trusted peers without
requiring a node restart.

### New Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/eth/v1/lodestar/direct_peers?peer=<multiaddr\|enr>` | Add a
direct peer |
| DELETE | `/eth/v1/lodestar/direct_peers?peerId=<peer_id>` | Remove a
direct peer |
| GET | `/eth/v1/lodestar/direct_peers` | List current direct peer IDs |

### Motivation

Direct peers maintain permanent mesh connections without GRAFT/PRUNE
negotiation. Currently, they can only be configured via the
`--directPeers` CLI flag at startup.

This PR enables runtime management which is useful for:
- Adding trusted peers discovered during operation
- Removing misbehaving peers from the direct list
- Temporary mesh connections for debugging/testing
- Hot-adding bootstrap peers without downtime

### Implementation

- Adds `addDirectPeer`, `removeDirectPeer`, `getDirectPeers` methods to
`Eth2Gossipsub` class
- Reuses existing `parseDirectPeers()` function for multiaddr/ENR
parsing
- Exposes through NetworkCore → Network → API layer
- Follows existing patterns for Lodestar-specific debug endpoints
- **Throws `ApiError(400)` on invalid peer input** (instead of returning
null)
- **Prevents adding self as a direct peer** with appropriate warning log

### Error Handling

- Invalid multiaddr/ENR format → `ApiError(400)` with descriptive
message
- Missing peer addresses → `ApiError(400)`
- Adding self as direct peer → `ApiError(400)`

### Testing

- Existing `directPeers.test.ts` covers the parsing logic (11 tests
passing)
- Build and lint pass

Closes #7559

---

*This PR was authored with AI assistance (Lodekeeper 🌟)*

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
## Summary

Follow-up to #8855 per [review
feedback](#8855 (review)).

### Changes

1. **Remove `bigIntToBytesInto` function** - Not used in production
code, can be re-added when needed
2. **Remove unused exports** - `getBigIntBufferImplementation` and
`initBigIntBufferNative` were not used outside the module
3. **Remove `bigIntToBytes` benchmark file** - No longer needed without
`bigIntToBytesInto` comparison
4. **Remove tests for `bigIntToBytesInto`** - Function no longer exists
5. **Remove `minimumReleaseAgeExclude`** - `@vekexasia/bigint-buffer2`
v1.1.0 is now older than 48 hours

---
*Generated with AI assistance (Claude/OpenClaw). Human-supervised and
tested.*

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
…#8859)

## Description

Similar to `packages/params/test/e2e/ensure-config-is-synced.test.ts`
which validates preset values, this test validates chainConfig values
against the consensus-specs `configs/*.yaml` files.

This would have caught the `MIN_BUILDER_WITHDRAWABILITY_DELAY` mismatch
that was discovered manually in #8839.

### What it does
- Downloads `configs/mainnet.yaml` and `configs/minimal.yaml` from
consensus-specs
- Compares values against Lodestar's chainConfig
- Excludes network-specific values (fork epochs, genesis params, etc.)
since those intentionally differ

### Testing
```bash
cd packages/config
pnpm vitest run test/e2e/ensure-config-is-synced.test.ts
```

---

*This PR was created by @lodekeeper (AI contributor) based on feedback
from @nflaig*

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
## Description

Upgrade fastify to 5.7.3 to address
[CVE-2026-25224](GHSA-mrq3-vjjr-p77c)
(DoS via Unbounded Memory Allocation in sendWebStream).

### Security Analysis

**Lodestar is NOT affected by this vulnerability** because:

1. **SSE endpoint** (`/eth/v1/events`): Uses `res.raw.write()` directly
on the Node.js HTTP response object, not Web Streams
2. **All other endpoints**: Send JSON payloads via `reply.send()`, not
`ReadableStream` or `Response` with Web Stream body
3. **ReadableStream usage**: Only exists in CLI for file downloads, not
in Fastify responses

This upgrade is a proactive security measure following best practices.

### Changes

- Update `fastify` from `^5.2.1` to `^5.7.3` in:
  - `@lodestar/api`
  - `@lodestar/beacon-node`
  - `@chainsafe/lodestar` (cli)
  - `@lodestar/light-client`
- Add `fastify` to `minimumReleaseAgeExclude` in `pnpm-workspace.yaml`
to allow the new security release (bypasses the 48-hour policy for
security updates)
- Fix TypeScript error in `setErrorHandler` due to stricter typing in
fastify 5.7.3 (`err` is now `unknown` by default)

### References

- [Fastify v5.7.3
Release](https://github.com/fastify/fastify/releases/tag/v5.7.3)
-
[GHSA-mrq3-vjjr-p77c](GHSA-mrq3-vjjr-p77c)
- [HackerOne Report](https://hackerone.com/reports/3524779)

---

*AI-assisted development: This PR was developed with assistance from an
AI coding agent.*

---------

Signed-off-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
## Description

Use a hybrid approach for `byteArrayEquals` in `@lodestar/utils` that
selects the optimal comparison method based on array size:

- **Loop for ≤48 bytes**: V8 JIT optimizations in Node v24 make loops
faster for small arrays
- **Buffer.compare for >48 bytes**: Native code is significantly faster
for larger arrays

This ensures optimal performance for the most common use cases (32-byte
roots, 48-byte pubkeys) while still benefiting from native code for
larger comparisons (signatures).

**Also replaces all direct `Buffer.compare` calls** across the codebase
with `byteArrayEquals` for consistency.

## Node v24.13.0 Benchmarks

| Size | Loop | Buffer.compare | Winner |
|------|------|----------------|--------|
| 32 bytes | **14.7 ns/op** | 49.7 ns/op | Loop 3.4x faster |
| 48 bytes | **36 ns/op** | 56 ns/op | Loop 1.5x faster |
| 96 bytes | 130 ns/op | **50 ns/op** | Buffer 2.6x faster |
| 1024 bytes | 940 ns/op | **55 ns/op** | Buffer 17x faster |
| 131072 bytes | 14.8 μs/op | **270 ns/op** | Buffer 55x faster |

## Usage Analysis

| Size | Count | % | Examples |
|------|-------|---|----------|
| **32 bytes** | 59 | **94%** | roots, hashes, stateRoot, blockHash,
parentRoot, randao, credentials |
| 48 bytes | 2 | 3% | pubkeys |
| 96 bytes | 2 | 3% | signatures (G2_POINT_AT_INFINITY comparisons) |

## Changes

- Added `byteArrayEquals` to `@lodestar/utils` with hybrid
implementation
- Uses loop for small arrays (≤48 bytes) where V8 JIT is faster
- Uses `Buffer.compare` for larger arrays where native code wins
- Updated all imports across the codebase to use the new implementation
- **Replaced 14 direct `Buffer.compare` calls** with `byteArrayEquals`:
  - beacon-node: 7 files (block validation, sync, state)
  - state-transition: 4 files (consolidation, load state utils)
  - era: 2 files (reader, e2s)
- Added benchmark results as comments in test files

## Note

The `@chainsafe/ssz` library also has a `byteArrayEquals` implementation
that could benefit from a similar change, but that would need to be
addressed upstream.

Closes #5955

---

*This PR was created with AI assistance (Lodekeeper 🌟)*

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
Closes #8867, details are in
the issue but the tl;dr is that we do not test node v22 anymore and
there are negative performance implications and changes like
#8846 are specifically
optimized for node v24 while they would cause a regression for node v22.
## Description

This PR adds an `AGENTS.md` file to provide context for AI coding
assistants (Claude Code, Codex, GitHub Copilot, etc.) working with the
Lodestar codebase.

Inspired by
[ethereum/consensus-specs#4894](ethereum/consensus-specs#4894)
which adds a similar file to the consensus specs repo.

## Contents

The file includes:
- **Project overview**: What Lodestar is and its role in the ecosystem
- **Directory structure**: Layout of packages and their purposes
- **Build commands**: Essential `pnpm` commands for building, testing,
linting
- **Code style**: Conventions from biome.jsonc and CONTRIBUTING.md
- **Testing guidelines**: How to run and write tests
- **PR guidelines**: Branch naming, commit conventions, AI disclosure
requirements
- **Common tasks**: Step-by-step guides for typical contributions
- **Style learnings**: Specific preferences learned from PR reviews

## Why?

AI assistants often struggle with project-specific conventions, test
commands, and style requirements. This file serves as a concise
reference that:
1. Helps AI assistants produce higher-quality contributions
2. Reduces review friction from style/convention violations
3. Also serves as a quick reference for human contributors

The file intentionally stays concise while covering the most important
aspects for day-to-day contributions.

---

🤖 This PR was authored by AI (Lodekeeper/Claude) with supervision.

---------

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @nflaig, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on preparing the codebase for the v1.40.0 release by integrating the upcoming Gloas fork, enhancing API capabilities, and optimizing internal state management. It introduces new features for builder operations and peer management, alongside significant refactoring to improve performance and maintainability. The changes also include comprehensive updates to development documentation and monitoring metrics.

Highlights

  • Gloas (EIP-7732) Integration: Introduced extensive support for the Gloas fork, including new API endpoints for builder management, execution payload bids, and payload attestations. This involves new data structures, validation rules, and processing logic across the chain, network, and state transition layers.
  • API Enhancements: Added new API endpoints for managing direct peers (addDirectPeer, removeDirectPeer, getDirectPeers), retrieving monitored validator indices (getMonitoredValidatorIndices), and fetching custody information (getCustodyInfo).
  • State Management & Performance: Refactored state caching mechanisms, making FIFOBlockStateCache and PersistentCheckpointStateCache the default for improved memory management. Optimized state loading and comparison operations by switching to byteArrayEquals for byte array comparisons and streamlining shuffling cache interactions.
  • Build & Development Tooling Updates: Updated Node.js engine requirement to ^24.13.0 and adjusted vitest launch configurations. A new AGENTS.md documentation file was added, providing comprehensive development guidelines.
  • Metrics and Monitoring: Introduced new Prometheus metrics for 'Unfinalized Block Writes Queue' and Gloas-related operation pools (payloadAttestationPool, executionPayloadBidPool). Existing shuffling cache metrics were refined for better accuracy.
  • Dependency and Version Bumps: Updated fastify to ^5.7.4 and axios to ^1.13.2. All internal packages were version bumped to 1.40.0 as part of the release preparation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added .venv/ to ignore Python virtual environments.
    • Added checkpoint_states/ to ignore local checkpoint state files.
  • .vscode/launch.template.json
    • Updated vitest program path from .bin/vitest to vitest/vitest.mjs.
  • AGENTS.md
    • Added a new comprehensive documentation file detailing project overview, directory structure, build commands, code style, testing guidelines, PR guidelines, common tasks, consensus spec implementation, and important notes.
  • RELEASE.md
    • Updated release announcement steps to include adding release notes to the GitHub release page.
  • dashboards/lodestar_beacon_chain.json
    • Modified Prometheus expressions for shuffling cache metrics.
    • Removed lodestar_shuffling_cache_promise_not_resolved_and_thrown_away_count and lodestar_shuffling_cache_next_shuffling_not_on_epoch_cache metrics.
    • Added new panels for 'Unfinalized Block Writes Queue' metrics (Queue Length, Job Time, Queue Concurrency, Job Wait Time).
  • dashboards/lodestar_summary.json
    • Corrected Prometheus expression for validator_monitor_prev_epoch_on_chain_balance to calculate rate per validator.
  • dashboards/lodestar_validator_monitor.json
    • Corrected Prometheus expression for validator_monitor_prev_epoch_on_chain_balance to calculate rate per validator.
  • docs/pages/contribution/testing/simulation-tests.md
    • Removed the test:sim:deneb section.
  • lerna.json
    • Version bumped to 1.40.0.
  • package.json
    • Updated Node.js engine requirement to ^24.13.0.
    • Added axios dependency.
    • Version bumped to 1.40.0.
  • packages/api/package.json
    • Updated fastify dependency to ^5.7.4.
    • Version bumped to 1.40.0.
  • packages/api/src/beacon/routes/lodestar.ts
    • Added ValidatorIndex import.
    • Introduced DirectPeer type for multiaddr or ENR strings.
    • Introduced CustodyInfo type for data column custody details.
    • Added new API endpoints: addDirectPeer, removeDirectPeer, getDirectPeers, getMonitoredValidatorIndices, getCustodyInfo.
  • packages/beacon-node/package.json
    • Updated fastify dependency to ^5.7.4.
    • Version bumped to 1.40.0.
  • packages/beacon-node/src/api/impl/beacon/blocks/index.ts
    • Removed fromAsync import.
    • Modified addColumn and addBlob calls to include {throwOnDuplicateAdd: false} option for multi-BN setups.
    • Changed processBlock call to remove eagerPersistBlock option.
    • Updated getBlockHeaders to use chain.getBlockByRoot instead of db.block.get.
    • Refactored getDataColumnSidecars and getBlobSidecars to use new chain methods.
  • packages/beacon-node/src/api/impl/beacon/state/utils.ts
    • Added CachedBeaconStateAllForks import.
    • Removed getStateResponse function.
    • Updated getStateResponseWithRegen to return CachedBeaconStateAllForks | Uint8Array.
  • packages/beacon-node/src/api/impl/config/constants.ts
    • Added BUILDER_INDEX_FLAG, BUILDER_INDEX_SELF_BUILD, DOMAIN_PROPOSER_PREFERENCES to specConstants.
  • packages/beacon-node/src/api/impl/debug/index.ts
    • Removed fromAsync import.
    • Removed db from getDebugApi parameters.
    • Updated getDataColumnSidecars to use chain.getDataColumnSidecars.
  • packages/beacon-node/src/api/impl/lodestar/index.ts
    • Implemented addDirectPeer, removeDirectPeer, getDirectPeers API endpoints.
    • Simplified state handling in getLodestarApi to use state directly instead of cloning.
    • Implemented getMonitoredValidatorIndices and getCustodyInfo API endpoints.
    • Removed getCheckpointState case from regenRequestToJson.
  • packages/beacon-node/src/api/impl/proof/index.ts
    • Removed state.commit() call, with a comment indicating no need to commit state changes in beacon-node.
  • packages/beacon-node/src/api/impl/validator/index.ts
    • Added ProtoBlock import.
    • Removed CheckpointHex import from ../../chain/index.js and added from ../../chain/stateCache/types.js.
    • Updated produceBlindedBlock and produceBlock to use parentBlock: ProtoBlock instead of parentBlockRoot: Root.
    • Simplified state handling in getValidatorApi to use state directly instead of cloning.
    • Updated getProposerHead to return ProtoBlock.
  • packages/beacon-node/src/api/rest/base.ts
    • Added FastifyError import.
    • Updated server.setErrorHandler to handle FastifyError | Error and improved validation error message extraction.
  • packages/beacon-node/src/chain/ColumnReconstructionTracker.ts
    • Renamed RECONSTRUCTION_DELAY_MIN_MS and RECONSTRUCTION_DELAY_MAX_MS to RECONSTRUCTION_DELAY_MIN_BPS and RECONSTRUCTION_DELAY_MAX_BPS.
    • Made reconstruction delays configurable via config.getSlotComponentDurationMs.
  • packages/beacon-node/src/chain/archiveStore/historicalState/getHistoricalState.ts
    • Added byteArrayEquals import.
    • Added getStateTypeFromBytes import.
    • Updated getNearestState to use db.stateArchive.binaries and deserialize the state.
    • Changed state root comparison from Buffer.compare to byteArrayEquals.
  • packages/beacon-node/src/chain/archiveStore/utils/archiveBlocks.ts
    • Added logCtx to verbose logs for archiving and pruning operations.
    • Added comments clarifying assumptions about block/sidecar presence in hot DB before migration.
  • packages/beacon-node/src/chain/blocks/blockInput/blockInput.ts
    • Added NUMBER_OF_COLUMNS import.
    • Added byteArrayEquals import.
    • Added getBlob method to BlockInputBlobs.
    • Changed blockAndBlobArePaired to use byteArrayEquals.
    • Added hasComputedAllData and computedDataPromise to BlockInputColumnsState and BlockInputColumns for tracking full data availability.
    • Added getColumn method to BlockInputColumns.
  • packages/beacon-node/src/chain/blocks/importBlock.ts
    • Removed toCheckpointHex import from ../stateCache/index.js and added from ../stateCache/persistentCheckpointsCache.js.
    • Removed writeBlockInputToDb import.
    • Replaced immediate block persistence with an asynchronous unfinalizedBlockWrites queue.
    • Updated checkpoint state emission to pass checkpointState directly instead of a clone.
    • Modified addAttestationPostElectra to use this.shufflingCache.getBeaconCommittees.
  • packages/beacon-node/src/chain/blocks/index.ts
    • Removed removeEagerlyPersistedBlockInputs import and related logic.
  • packages/beacon-node/src/chain/blocks/types.ts
    • Removed eagerPersistBlock from ImportBlockOpts.
  • packages/beacon-node/src/chain/blocks/verifyBlock.ts
    • Removed writeBlockInputToDb import.
    • Added this.shufflingCache.processState(preState0) for forky conditions.
    • Updated attestation processing to use this.shufflingCache.getIndexedAttestation.
    • Removed index2pubkey from verifyBlocksSignatures parameters.
  • packages/beacon-node/src/chain/blocks/verifyBlocksSignatures.ts
    • Removed Index2PubkeyCache import.
    • Removed index2pubkey parameter from verifyBlocksSignatures and getBlockSignatureSets calls.
  • packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts
    • Removed byteArrayEquals import from ../../util/bytes.js.
    • Added byteArrayEquals import from @lodestar/utils.
    • Added dontTransferCache: false to stateTransition options.
  • packages/beacon-node/src/chain/blocks/writeBlockInputToDb.ts
    • Added waitForComputedAllData check before persisting BlockInputColumns.
    • Replaced removeEagerlyPersistedBlockInputs with persistBlockInputs function, which uses a JobItemQueue and prunes seenBlockInputCache.
  • packages/beacon-node/src/chain/bls/multithread/index.ts
    • Added Index2PubkeyCache import.
    • Added index2pubkey to BlsMultiThreadWorkerPoolModules and constructor.
    • Updated getAggregatedPubkey and jobItemWorkReq to use index2pubkey.
  • packages/beacon-node/src/chain/bls/multithread/jobItem.ts
    • Added Index2PubkeyCache import.
    • Updated jobItemWorkReq to accept index2pubkey.
  • packages/beacon-node/src/chain/bls/singleThread.ts
    • Added Index2PubkeyCache import.
    • Added index2pubkey to constructor.
    • Updated getAggregatedPubkey to use index2pubkey.
  • packages/beacon-node/src/chain/bls/utils.ts
    • Added Index2PubkeyCache import.
    • Added index2pubkey parameter to getAggregatedPubkey.
    • Modified getAggregatedPubkey to handle indexed type and use index2pubkey for aggregate type.
    • Updated getAggregatedPubkeysCount to use indices.length.
  • packages/beacon-node/src/chain/chain.ts
    • Added deneb, fulu, ssz, sszTypesFor imports.
    • Added BLOB_SIDECARS_IN_WRAPPER_INDEX import.
    • Added callInNextEventLoop import.
    • Added JobItemQueue import.
    • Added getSlotFromSignedBeaconBlockSerialized import.
    • Added persistBlockInputs import.
    • Added ExecutionPayloadBidPool, PayloadAttestationPool to op pools.
    • Added SeenPayloadAttesters, SeenExecutionPayloadEnvelopes, SeenExecutionPayloadBids to seen cache.
    • Removed BlockStateCacheImpl, InMemoryCheckpointStateCache imports.
    • Removed nHistoricalStates option, making FIFOBlockStateCache and PersistentCheckpointStateCache default.
    • Initialized unfinalizedBlockWrites as a JobItemQueue.
    • Added onCheckpoint event listener.
    • Implemented close() to drop unfinalized block writes.
    • Updated isKnownValidator to check seenPayloadAttesters.
    • Updated getStateBySlot, getStateByStateRoot return types.
    • Implemented getSerializedBlockByRoot, getBlobSidecars, getSerializedBlobSidecars, getDataColumnSidecars, getSerializedDataColumnSidecars.
    • Updated produceCommonBlockBody, produceBlock to use parentBlock: ProtoBlock instead of parentBlockRoot: Root.
    • Updated getShuffling to process state in shufflingCache.
    • Updated op pool metrics to include payloadAttestationPool and executionPayloadBidPool.
    • Updated op pool pruning to include new pools.
    • Updated onForkChoiceFinalized to prune seenExecutionPayloadEnvelopes and use getBlockByRoot.
    • Updated computeBlockRewards and computeSyncCommitteeRewards to use preState directly instead of cloning.
  • packages/beacon-node/src/chain/errors/attestationError.ts
    • Added INVALID_PAYLOAD_STATUS_VALUE and PREMATURELY_INDICATED_PAYLOAD_PRESENT error codes for Gloas.
  • packages/beacon-node/src/chain/errors/executionPayloadBid.ts
    • New file: Defines ExecutionPayloadBidError and related error codes for Gloas.
  • packages/beacon-node/src/chain/errors/executionPayloadEnvelope.ts
    • New file: Defines ExecutionPayloadEnvelopeError and related error codes for Gloas.
  • packages/beacon-node/src/chain/errors/index.ts
    • Exported new Gloas-related error files.
  • packages/beacon-node/src/chain/errors/payloadAttestation.ts
    • New file: Defines PayloadAttestationError and related error codes for Gloas.
  • packages/beacon-node/src/chain/forkChoice/index.ts
    • Updated initializeForkChoiceFromFinalizedState and initializeForkChoiceFromUnfinalizedState to include builderIndex and blockHashHex for Gloas.
  • packages/beacon-node/src/chain/initState.ts
    • Added byteArrayEquals import.
    • Added getStateTypeFromBytes import.
    • Changed state root comparison from Buffer.compare to byteArrayEquals.
    • Updated initStateFromDb to use db.stateArchive.lastBinary() and getStateTypeFromBytes.
  • packages/beacon-node/src/chain/interface.ts
    • Added deneb, fulu, gloas imports.
    • Added ExecutionPayloadBidPool, PayloadAttestationPool to op pools.
    • Added SeenPayloadAttesters, SeenExecutionPayloadEnvelopes, SeenExecutionPayloadBids to seen cache.
    • Updated getStateBySlot, getStateByStateRoot return types.
    • Added getSerializedBlockByRoot, getBlobSidecars, getSerializedBlobSidecars, getDataColumnSidecars, getSerializedDataColumnSidecars methods.
    • Updated produceCommonBlockBody, produceBlock parameters.
  • packages/beacon-node/src/chain/lightClient/index.ts
    • Added byteArrayEquals import.
    • Changed Buffer.compare to byteArrayEquals.
  • packages/beacon-node/src/chain/lightClient/proofs.ts
    • Removed state.commit() calls.
  • packages/beacon-node/src/chain/opPools/aggregatedAttestationPool.ts
    • Removed MAX_ATTESTATIONS import.
    • Removed CachedBeaconStatePhase0 import.
    • Removed AttestationWithScore type.
    • Removed getAttestationsForBlockPreElectra and related logic, now throwing an error for pre-Electra forks.
    • Updated getAttestationsForBlockElectra to accept shufflingCache.
    • Updated getNotSeenValidatorsFn to accept shufflingCache.
    • Removed extractParticipationPhase0.
  • packages/beacon-node/src/chain/opPools/executionPayloadBidPool.ts
    • New file: Implements ExecutionPayloadBidPool for managing execution payload bids.
  • packages/beacon-node/src/chain/opPools/index.ts
    • Exported new Gloas-related op pools.
  • packages/beacon-node/src/chain/opPools/opPool.ts
    • Added DbBatch import.
    • Updated persistDiff to use dbRepo.batch for atomic operations.
  • packages/beacon-node/src/chain/opPools/payloadAttestationPool.ts
    • New file: Implements PayloadAttestationPool for managing payload attestations.
  • packages/beacon-node/src/chain/options.ts
    • Removed nHistoricalStates option.
  • packages/beacon-node/src/chain/prepareNextSlot.ts
    • Updated recomputeForkChoiceHead and predictProposerHead to return ProtoBlock.
    • Removed asyncShufflingCalculation option.
  • packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts
    • Added ProtoBlock import.
    • Added fromHex import.
    • Updated produceBlockBody and produceCommonBlockBody to use parentBlock: ProtoBlock instead of parentBlockRoot: Root.
  • packages/beacon-node/src/chain/regen/interface.ts
    • Added validateGossipExecutionPayloadBid to RegenCaller.
    • Removed getCheckpointState and asyncShufflingCalculation.
    • Updated getBlockSlotState to accept ProtoBlock.
    • Removed opts from getState.
  • packages/beacon-node/src/chain/regen/queued.ts
    • Removed getCheckpointState from RegenFnName and jobQueueProcessor.
    • Updated getStateSync, getPreStateSync, getCheckpointStateSync, getClosestHeadState, getState to remove opts parameter.
    • Updated getBlockSlotState to accept ProtoBlock.
  • packages/beacon-node/src/chain/regen/regen.ts
    • Added seenBlockInputCache to RegenModules.
    • Removed getCheckpointState logic.
    • Updated getBlockSlotState to accept ProtoBlock.
    • Removed opts from getState.
    • Updated processSlotsToNearestCheckpoint to pass checkpointState directly instead of a clone.
  • packages/beacon-node/src/chain/seenCache/index.ts
    • Exported new Gloas-related seen caches.
  • packages/beacon-node/src/chain/seenCache/seenAttesters.ts
    • Added SeenPayloadAttesters.
  • packages/beacon-node/src/chain/seenCache/seenExecutionPayloadBids.ts
    • New file: Implements SeenExecutionPayloadBids for tracking seen execution payload bids.
  • packages/beacon-node/src/chain/seenCache/seenExecutionPayloadEnvelope.ts
    • New file: Implements SeenExecutionPayloadEnvelopes for tracking seen execution payload envelopes.
  • packages/beacon-node/src/chain/seenCache/seenGossipBlockInput.ts
    • Added byteArrayEquals import.
    • Changed Buffer.compare to byteArrayEquals.
    • Changed pruning logic to sort by slot ascending.
  • packages/beacon-node/src/chain/shufflingCache.ts
    • Removed IShufflingCache, ShufflingBuildProps imports.
    • Changed ShufflingCache to not implement IShufflingCache.
    • Removed getSync's buildProps parameter and build method.
    • Added processState, getIndexedAttestation, getAttestingIndices, getBeaconCommittee, getBeaconCommittees methods.
    • Updated set to use shufflingSetMultipleTimes metric and return early if already set.
  • packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts
    • Removed file.
  • packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts
    • Removed StateRegenerationOpts import.
    • Updated getSeedState and get to return state directly instead of a clone.
  • packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts
    • Removed file.
  • packages/beacon-node/src/chain/stateCache/index.ts
    • Removed blockStateCacheImpl and inMemoryCheckpointsCache exports.
  • packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts
    • Removed StateRegenerationOpts import.
    • Updated bufferPool type.
    • Updated getOrReload, getStateOrBytes, getStateOrLoadDb, get, getLatest, getOrReloadLatest to remove opts parameter and return state directly.
    • Added toCheckpointKey export.
  • packages/beacon-node/src/chain/stateCache/types.ts
    • Removed StateRegenerationOpts import.
    • Updated BlockStateCache and CheckpointStateCache interfaces to remove opts parameters.
  • packages/beacon-node/src/chain/validation/aggregateAndProof.ts
    • Updated attestation data index validation for Gloas.
    • Removed aggregator parameter from getSelectionProofSignatureSet and getAggregateAndProofSignatureSet.
    • Updated createAggregateSignatureSetFromComponents to use attestingIndices directly.
  • packages/beacon-node/src/chain/validation/attestation.ts
    • Added isForkPostGloas import.
    • Added new error codes INVALID_PAYLOAD_STATUS_VALUE and PREMATURELY_INDICATED_PAYLOAD_PRESENT for Gloas.
    • Updated validateGossipAttestationsSameAttData to use chain.index2pubkey[set.index].
    • Updated validateApiAttestation to handle ShufflingError.
    • Updated validateAttestationNoSignatureCheck to include Gloas-specific validation for attData.index.
  • packages/beacon-node/src/chain/validation/attesterSlashing.ts
    • Added BeaconConfig import.
    • Updated assertValidAttesterSlashing parameters to include config, stateSlot, validatorsLen.
    • Updated getAttesterSlashingSignatureSets to remove index2pubkey.
  • packages/beacon-node/src/chain/validation/blobSidecar.ts
    • Added byteArrayEquals import.
    • Updated validateGossipBlobSidecar and validateBlockBlobSidecars to remove index2pubkey from getBlockHeaderProposerSignatureSetByParentStateSlot and getBlockHeaderProposerSignatureSetByHeaderSlot.
  • packages/beacon-node/src/chain/validation/block.ts
    • Added isForkPostBellatrix, isForkPostGloas imports.
    • Updated blobKzgCommitmentsLen check for Gloas.
    • Added chain.shufflingCache.processState(blockState).
    • Updated isForkPostBellatrix check for Gloas.
    • Removed index2pubkey from getBlockProposerSignatureSet.
  • packages/beacon-node/src/chain/validation/blsToExecutionChange.ts
    • Added BeaconConfig import.
    • Added Validator import.
    • Updated isValidBlsToExecutionChange parameters.
  • packages/beacon-node/src/chain/validation/dataColumnSidecar.ts
    • Added byteArrayEquals import.
    • Updated validateGossipDataColumnSidecar and validateBlockDataColumnSidecars to remove index2pubkey from getBlockHeaderProposerSignatureSetByParentStateSlot and getBlockHeaderProposerSignatureSetByHeaderSlot.
  • packages/beacon-node/src/chain/validation/executionPayloadBid.ts
    • New file: Implements validation logic for ExecutionPayloadBid messages.
  • packages/beacon-node/src/chain/validation/executionPayloadEnvelope.ts
    • New file: Implements validation logic for ExecutionPayloadEnvelope messages.
  • packages/beacon-node/src/chain/validation/payloadAttestationMessage.ts
    • New file: Implements validation logic for PayloadAttestationMessage messages.
  • packages/beacon-node/src/chain/validation/proposerSlashing.ts
    • Added BeaconConfig import.
    • Added Slot import.
    • Added Validator import.
    • Added Index2PubkeyCache import.
    • Updated processProposerSlashing and assertValidProposerSlashing parameters.
    • Updated verifySignatureSet to pass index2pubkey.
  • packages/beacon-node/src/chain/validation/signatureSets/aggregateAndProof.ts
    • Removed PublicKey import.
    • Updated getAggregateAndProofSignatureSet to use IndexedSignatureSet and aggregatorIndex.
  • packages/beacon-node/src/chain/validation/signatureSets/contributionAndProof.ts
    • Removed Index2PubkeyCache import.
    • Updated getContributionAndProofSignatureSet to use IndexedSignatureSet and aggregatorIndex.
  • packages/beacon-node/src/chain/validation/signatureSets/selectionProof.ts
    • Removed PublicKey import.
    • Updated getSelectionProofSignatureSet to use IndexedSignatureSet and aggregatorIndex.
  • packages/beacon-node/src/chain/validation/signatureSets/syncCommittee.ts
    • Removed Index2PubkeyCache import.
    • Updated getSyncCommitteeSignatureSet to use IndexedSignatureSet and validatorIndex.
  • packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeContribution.ts
    • Removed PublicKey import.
    • Updated getSyncCommitteeContributionSignatureSet to use indices instead of pubkeys.
  • packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts
    • Removed Index2PubkeyCache import.
    • Updated getSyncCommitteeSelectionProofSignatureSet to use IndexedSignatureSet and aggregatorIndex.
  • packages/beacon-node/src/chain/validation/syncCommittee.ts
    • Updated getSyncCommitteeSignatureSet to remove index2pubkey.
  • packages/beacon-node/src/chain/validation/syncCommitteeContributionAndProof.ts
    • Removed index2pubkey from local variable.
    • Updated getSyncCommitteeSelectionProofSignatureSet and getContributionAndProofSignatureSet to remove index2pubkey.
  • packages/beacon-node/src/chain/validation/voluntaryExit.ts
    • Updated getVoluntaryExitSignatureSet to remove index2pubkey.
  • packages/beacon-node/src/chain/validatorMonitor.ts
    • Added prettyPrintIndices import.
    • Changed RETAIN_REGISTERED_VALIDATORS_MS to RETAIN_REGISTERED_VALIDATORS_EPOCHS and made it epoch-based.
    • Added getMonitoredValidatorIndices method.
    • Added logging for validator additions/removals.
    • Updated prevEpochOnChainBalance metric to be total balance instead of per-index.
    • Added validatorsConnectedIndices static metric.
  • packages/beacon-node/src/db/repositories/checkpointState.ts
    • Changed CheckpointStateRepository to extend BinaryRepository and removed encodeValue, decodeValue, getId methods.
  • packages/beacon-node/src/db/repositories/stateArchive.ts
    • Changed StateArchiveRepository to extend BinaryRepository.
    • Updated put to use putBinary and storeRootIndex.
    • Updated getByRoot to getBinaryByRoot.
  • packages/beacon-node/src/execution/engine/mock.ts
    • Added ChainConfig import.
    • Added computeTimeAtSlot import.
    • Updated ExecutionEngineMockOpts to accept genesisTime and config.
    • Initialized fork timestamps from opts.genesisTime and opts.config.
  • packages/beacon-node/src/index.ts
    • Removed initStateFromDb export.
  • packages/beacon-node/src/metrics/metrics/lodestar.ts
    • Added new metrics for unfinalizedBlockWritesQueue, payloadAttestationPool, and executionPayloadBidPool.
    • Removed shufflingBuiltMultipleTimes, shufflingPromiseNotResolvedAndThrownAway, nextShufflingNotOnEpochCache, shufflingCalculationTime metrics.
  • packages/beacon-node/src/network/core/networkCore.ts
    • Added new methods addDirectPeer, removeDirectPeer, getDirectPeers.
  • packages/beacon-node/src/network/core/networkCoreWorker.ts
    • Added new methods to libp2pWorkerApi for direct peer management.
  • packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts
    • Added new methods to WorkerNetworkCore for direct peer management.
  • packages/beacon-node/src/network/core/types.ts
    • Added new interfaces for direct peer management.
  • packages/beacon-node/src/network/gossip/gossipsub.ts
    • Added peerIdFromString, multiaddr, ENR imports.
    • Added directPeers option to Eth2GossipsubOpts.
    • Implemented parseDirectPeers to handle multiaddr and ENR strings.
    • Implemented addDirectPeer, removeDirectPeer, getDirectPeers methods.
  • packages/beacon-node/src/network/gossip/interface.ts
    • Added gloas import.
    • Added new GossipTypes for execution_payload, payload_attestation_message, execution_payload_bid.
  • packages/beacon-node/src/network/gossip/scoringParameters.ts
    • Added PTC_SIZE import.
    • Added new weights for EXECUTION_PAYLOAD_WEIGHT, PAYLOAD_ATTESTATION_WEIGHT, EXECUTION_PAYLOAD_BID_WEIGHT.
    • Updated maxPositiveScore.
    • Added new topic score parameters for execution_payload, payload_attestation_message, execution_payload_bid.
  • packages/beacon-node/src/network/gossip/topic.ts
    • Updated stringifyGossipTopicType to include new gossip types.
    • Updated getGossipSSZType to return SSZ types for new gossip types.
    • Updated parseGossipTopic to include new gossip types.
    • Updated getCoreTopicsAtFork to include new gossip types for Gloas.
    • Updated gossipTopicIgnoreDuplicatePublishError to include new gossip types.
  • packages/beacon-node/src/network/network.ts
    • Added new methods addDirectPeer, removeDirectPeer, getDirectPeers.
  • packages/beacon-node/src/network/options.ts
    • Added directPeers option.
  • packages/beacon-node/src/network/peers/peerManager.ts
    • Added check to disconnect peers not using secp256k1 key type.
  • packages/beacon-node/src/network/processor/gossipHandlers.ts
    • Added new imports for validateGossipExecutionPayloadBid, validateGossipExecutionPayloadEnvelope, validateGossipPayloadAttestationMessage.
    • Added new handlers for execution_payload, payload_attestation_message, execution_payload_bid.
    • Removed chain.seenBlockInputCache.prune from block processing.
    • Updated blockInput.hasAllData() to blockInput.hasComputedAllData().
  • packages/beacon-node/src/network/processor/gossipQueues/index.ts
    • Added new queue options for execution_payload, payload_attestation_message, execution_payload_bid.
  • packages/beacon-node/src/network/processor/index.ts
    • Added new executeGossipWorkOrderObj entries for execution_payload, payload_attestation_message, execution_payload_bid.
  • packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts
    • Removed fromHex import.
    • Removed unfinalized db access.
    • Updated blockBytes retrieval to use chain.getSerializedBlockByRoot.
  • packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRoot.ts
    • Removed Slot import.
    • Removed IBeaconDb import.
    • Removed getSlotFromSignedBeaconBlockSerialized import.
    • Updated block retrieval to use chain.getSerializedBlockByRoot.
  • packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts
    • Removed fromHex import.
    • Removed IBeaconDb import.
    • Removed BLOB_SIDECARS_IN_WRAPPER_INDEX import.
    • Updated blobSideCarsBytes retrieval to use chain.getSerializedBlobSidecars.
  • packages/beacon-node/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts
    • Removed unfinalized db access.
    • Updated dataColumnSidecars retrieval to use chain.getSerializedDataColumnSidecars.
  • packages/beacon-node/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts
    • Updated dataColumns retrieval to use chain.getSerializedDataColumnSidecars.
  • packages/beacon-node/src/network/reqresp/handlers/index.ts
    • Updated onBeaconBlocksByRoot and onBlobSidecarsByRoot to remove db parameter.
  • packages/beacon-node/src/network/reqresp/utils/dataColumnResponseValidation.ts
    • Changed blobsCount > 0 to blobsCount === 0.
  • packages/beacon-node/src/node/nodejs.ts
    • Added ZERO_HASH_HEX import.
    • Added isExecutionCachedStateType import.
    • Added logic to initialize executionEngineOpts for mock EL.
  • packages/beacon-node/src/sync/backfill/backfill.ts
    • Added byteArrayEquals import.
    • Updated verifyBlockProposerSignature to remove index2pubkey.
  • packages/beacon-node/src/sync/backfill/verify.ts
    • Updated verifyBlockProposerSignature to remove index2pubkey.
  • packages/beacon-node/src/sync/range/chain.ts
    • Removed this.pruneBlockInputs(batch.getBlocks()).
  • packages/beacon-node/src/sync/range/range.ts
    • Removed eagerPersistBlock: false option.
  • packages/beacon-node/src/sync/unknownBlock.ts
    • Removed eagerPersistBlock: true option.
    • Removed this.chain.seenBlockInputCache.prune.
  • packages/beacon-node/src/sync/utils/downloadByRange.ts
    • Added byteArrayEquals import.
    • Updated validateBlockByRangeResponse to use byteArrayEquals.
  • packages/beacon-node/src/sync/utils/downloadByRoot.ts
    • Removed byteArrayEquals import.
  • packages/beacon-node/src/util/bytes.ts
    • Removed file.
  • packages/beacon-node/src/util/sszBytes.ts
    • Changed !slot to slot === null.
  • packages/beacon-node/test/e2e/api/impl/lightclient/endpoint.test.ts
    • Added vi import.
    • Updated testParams to include ELECTRA_FORK_EPOCH and FULU_FORK_EPOCH.
    • Updated assertions for fork name and sync committee root.
  • packages/beacon-node/test/e2e/chain/bls/multithread.test.ts
    • Added index2pubkey to test setup and BlsMultiThreadWorkerPool initialization.
  • packages/beacon-node/test/e2e/chain/lightclient.test.ts
    • Updated testParams to include ELECTRA_FORK_EPOCH, FULU_FORK_EPOCH, and BLOB_SCHEDULE.
    • Updated getHeadStateProof to accept config and use config.getForkTypes(slot).BeaconState.
  • packages/beacon-node/test/e2e/chain/stateCache/nHistoricalStates.test.ts
    • Removed nHistoricalStates: false and nHistoricalStates: true options, as nHistoricalStates is now always true.
  • packages/beacon-node/test/e2e/network/onWorker/dataSerialization.test.ts
    • Added new test cases for direct peer management.
  • packages/beacon-node/test/e2e/sync/unknownBlockSync.test.ts
    • Increased testTimeout.
    • Added retry logic for bn.db.block.get.
  • packages/beacon-node/test/mocks/mockedBeaconChain.ts
    • Added getBlockByRoot to mocked chain methods.
  • packages/beacon-node/test/perf/chain/opPools/aggregatedAttestationPool.test.ts
    • Added ShufflingCache import.
    • Updated beforeEach to initialize shufflingCache.
    • Updated fn to pass shufflingCache to getAttestationsForBlock.
    • Removed AggregatedAttestationPool - Altair describe block.
  • packages/beacon-node/test/perf/chain/produceBlock/produceBlockBody.test.ts
    • Removed fromHexString import.
    • Updated parentBlockRoot to parentBlock.
  • packages/beacon-node/test/perf/chain/stateCache/inMemoryCheckpointsCache.test.ts
    • Removed file.
  • packages/beacon-node/test/perf/misc/map.test.ts
    • Skipped the test.
  • packages/beacon-node/test/perf/network/gossip/snappy.test.ts
    • Skipped the test.
  • packages/beacon-node/test/spec/presets/fork_choice.test.ts
    • Updated shouldSkip to include new Gloas-related tests.
  • packages/beacon-node/test/spec/presets/operations.test.ts
    • Updated processDepositRequest and processConsolidationRequest calls.
  • packages/beacon-node/test/spec/specTestVersioning.ts
    • Updated specVersion to v1.7.0-alpha.1.
  • packages/beacon-node/test/spec/utils/specTestIterator.ts
    • Updated skippedTests for Gloas.
  • packages/beacon-node/test/unit-minimal/chain/opPools/aggregatedAttestationPool.test.ts
    • Removed ACTIVE_PRESET, PresetName imports.
    • Removed CachedBeaconStateAltair import.
    • Removed getNotSeenValidatorsFn import.
    • Added ShufflingCache import.
    • Removed generateCachedAltairState import.
    • Removed AggregatedAttestationPool - Altair describe block.
    • Updated getAttestationsForBlock call to pass shufflingCache.
  • packages/beacon-node/test/unit-minimal/chain/stateCache/persistentCheckpointsCache.test.ts
    • Updated toCheckpointHex import.
  • packages/beacon-node/test/unit/api/impl/beacon/blocks/getBlockHeaders.test.ts
    • Removed vi.spyOn(modules.db.block, "get").
    • Updated modules.db.block.get mocks to modules.chain.getBlockByRoot.
  • packages/beacon-node/test/unit/api/impl/validator/duties/proposer.test.ts
    • Updated modules.chain.getStateBySlot.mockResolvedValue to use cachedState.
  • packages/beacon-node/test/unit/api/impl/validator/produceBlockV3.test.ts
    • Removed fromHexString import.
    • Updated toHexString to toRootHex.
    • Updated modules.chain.recomputeForkChoiceHead, modules.chain.getProposerHead, modules.chain.forkChoice.getBlock mocks to use toRootHex.
    • Updated parentBlockRoot to parentBlock.
  • packages/beacon-node/test/unit/chain/bls/bls.test.ts
    • Added index2pubkey to test setup and BlsSingleThreadVerifier, BlsMultiThreadWorkerPool initialization.
  • packages/beacon-node/test/unit/chain/stateCache/blockStateCacheImpl.test.ts
    • Removed file.
  • packages/beacon-node/test/unit/chain/stateCache/inMemoryCheckpointsCache.test.ts
    • Removed file.
  • packages/beacon-node/test/unit/chain/validation/attestation/validateGossipAttestationsSameAttData.test.ts
    • Added index2pubkey to test setup and chain initialization.
    • Updated signatureSet to use IndexedSignatureSet.
  • packages/beacon-node/test/unit/chain/validatorMonitor.test.ts
    • New file: Unit tests for ValidatorMonitor.
  • packages/beacon-node/test/unit/db/api/repository.test.ts
    • Added batch to mocked db methods.
  • packages/beacon-node/test/unit/network/gossip/directPeers.test.ts
    • New file: Unit tests for directPeers parsing.
  • packages/beacon-node/test/unit/network/gossip/scoringParameters.test.ts
    • Updated invalidMessageDeliveriesWeight and meshFailurePenaltyWeight values.
  • packages/beacon-node/test/unit/network/gossip/topic.test.ts
    • Updated config to include GLOAS_FORK_EPOCH.
    • Added new test cases for execution_payload, payload_attestation_message, execution_payload_bid.
  • packages/beacon-node/test/unit/util/bytes.test.ts
    • Changed byteArrayEquals import from ../../../src/util/bytes.js to @lodestar/utils.
  • packages/beacon-node/test/utils/node/beacon.ts
    • Added initStateFromDb import.
    • Added resumeFromDb option.
    • Added logic to load anchor state from DB if resumeFromDb is true.
    • Removed explicit fork timestamp settings for mock EL.
  • packages/beacon-node/test/utils/node/simTest.ts
    • Removed toHexString import.
    • Updated checkpointState retrieval to use bn.chain.regen.getCheckpointStateSync.
    • Updated lastState retrieval to use toRootHex.
  • packages/beacon-node/test/utils/validationData/attestation.ts
    • Updated bls initialization to pass index2pubkey.
  • packages/cli/package.json
    • Updated fastify dependency to ^5.7.4.
    • Version bumped to 1.40.0.
  • packages/cli/src/cmds/dev/options.ts
    • Added execution.engineMock to externalOptionsOverrides.
  • packages/cli/src/networks/dev.ts
    • Added devConfig to set fork epochs to 0 for dev network.
  • packages/cli/src/options/beaconNodeOptions/chain.ts
    • Removed chain.nHistoricalStates option.
  • packages/cli/src/options/beaconNodeOptions/execution.ts
    • Removed genesisBlockHash from mock EL options.
  • packages/cli/src/options/beaconNodeOptions/network.ts
    • Added directPeers option.
  • packages/cli/test/sim/deneb.test.ts
    • Removed file.
  • packages/cli/test/sim/endpoints.test.ts
    • Updated fork epochs in defineSimTestConfig.
    • Updated signedAttestations to use ssz.electra.SingleAttestation.defaultValue() and adjusted expected error message.
  • packages/cli/test/unit/options/beaconNodeOptions.test.ts
    • Removed chain.nHistoricalStates option.
    • Added directPeers to network options.
  • packages/cli/test/utils/crucible/assertions/defaults/headAssertion.ts
    • Updated store[n.beacon.id][s].blockRoot to store[n.beacon.id][s]?.blockRoot.
  • packages/cli/test/utils/crucible/runner/childProcessRunner.ts
    • Increased healthTimeoutMs to 60000.
  • packages/cli/test/utils/crucible/runner/dockerRunner.ts
    • Increased healthTimeoutMs to 60000.
  • packages/config/package.json
    • Version bumped to 1.40.0.
  • packages/config/src/chainConfig/configs/mainnet.ts
    • Added MIN_BUILDER_WITHDRAWABILITY_DELAY.
  • packages/config/src/chainConfig/configs/minimal.ts
    • Added MIN_BUILDER_WITHDRAWABILITY_DELAY.
  • packages/config/src/chainConfig/types.ts
    • Added MIN_BUILDER_WITHDRAWABILITY_DELAY.
  • packages/config/test/e2e/ensure-config-is-synced.test.ts
    • New file: Ensures chainConfig values match remote spec.
  • packages/era/package.json
    • Version bumped to 1.40.0.
  • packages/era/src/e2s.ts
    • Added byteArrayEquals import.
    • Changed Buffer.compare to byteArrayEquals.
  • packages/era/src/era/reader.ts
    • Added byteArrayEquals import.
    • Changed Buffer.compare to byteArrayEquals.
  • packages/flare/package.json
    • Version bumped to 1.40.0.
  • packages/fork-choice/package.json
    • Version bumped to 1.40.0.
  • packages/fork-choice/src/forkChoice/forkChoice.ts
    • Added isGloasBeaconBlock import.
    • Updated onBlock to include builderIndex and blockHashHex for Gloas.
  • packages/fork-choice/src/protoArray/interface.ts
    • Added builderIndex and blockHashHex to ProtoBlock.
  • packages/light-client/package.json
    • Updated fastify dependency to ^5.7.4.
    • Version bumped to 1.40.0.
  • packages/light-client/src/spec/utils.ts
    • Added byteArrayEquals import.
  • packages/light-client/src/spec/validateLightClientBootstrap.ts
    • Added byteArrayEquals import.
  • packages/light-client/src/utils/verifyMerkleBranch.ts
    • Added byteArrayEquals import.
  • packages/light-client/test/unit/sync.node.test.ts
    • Increased testTimeout.
  • packages/light-client/test/unit/syncInMemory.test.ts
    • Increased testTimeout.
  • packages/logger/package.json
    • Version bumped to 1.40.0.
  • packages/params/package.json
    • Updated axios dependency to ^1.13.2.
    • Version bumped to 1.40.0.
  • packages/params/src/index.ts
    • Added BUILDER_REGISTRY_LIMIT, MAX_BUILDERS_PER_WITHDRAWALS_SWEEP to active preset.
    • Updated DOMAIN_BEACON_BUILDER and added DOMAIN_PROPOSER_PREFERENCES.
    • Added BUILDER_INDEX_FLAG, BUILDER_INDEX_SELF_BUILD.
  • packages/params/src/presets/mainnet.ts
    • Added BUILDER_REGISTRY_LIMIT, MAX_BUILDERS_PER_WITHDRAWALS_SWEEP.
  • packages/params/src/presets/minimal.ts
    • Added BUILDER_REGISTRY_LIMIT, MAX_BUILDERS_PER_WITHDRAWALS_SWEEP.
  • packages/params/src/types.ts
    • Added BUILDER_REGISTRY_LIMIT, MAX_BUILDERS_PER_WITHDRAWALS_SWEEP to BeaconPreset and BeaconPresetTypes.
  • packages/params/test/e2e/ensure-config-is-synced.test.ts
    • Updated specConfigCommit to ethereumConsensusSpecsTests.specVersion.
    • Removed ignoredLocalPresetFields.
    • Removed gloas fork check.
  • packages/prover/package.json
    • Updated axios dependency to ^1.13.2.
    • Version bumped to 1.40.0.
  • packages/prover/test/e2e/cli/cmds/start.test.ts
    • Increased test timeout.
  • packages/prover/test/utils/e2e_env.ts
    • Increased minFinalizedTimeMs.
  • packages/reqresp/package.json
    • Version bumped to 1.40.0.
  • packages/spec-test-util/package.json
    • Version bumped to 1.40.0.
  • packages/state-transition/package.json
    • Updated bigint-buffer to @vekexasia/bigint-buffer2.
    • Version bumped to 1.40.0.
  • packages/state-transition/src/block/index.ts
    • Exported processDepositRequest.
  • packages/state-transition/src/block/isValidIndexedAttestation.ts
    • Updated isValidIndexedAttestation and isValidIndexedAttestationBigint parameters to include stateSlot and validatorsLen.
    • Updated verifySignatureSet calls to pass index2pubkey.
    • Updated isValidIndexedAttestationIndices parameters to include config, stateSlot, validatorsLen.
  • packages/state-transition/src/block/isValidIndexedPayloadAttestation.ts
    • Updated verifySignatureSet to pass state.epochCtx.index2pubkey.
  • packages/state-transition/src/block/processAttestationPhase0.ts
    • Updated isValidIndexedAttestation parameters.
  • packages/state-transition/src/block/processAttestationsAltair.ts
    • Added byteArrayEquals import.
    • Updated verifySignatureSet to pass state.epochCtx.index2pubkey.
  • packages/state-transition/src/block/processAttesterSlashing.ts
    • Added BeaconConfig import.
    • Updated processAttesterSlashing and assertValidAttesterSlashing parameters.
    • Updated verifySignatureSet to pass index2pubkey.
  • packages/state-transition/src/block/processBlockHeader.ts
    • Added byteArrayEquals import.
  • packages/state-transition/src/block/processBlsToExecutionChange.ts
    • Added BeaconConfig import.
    • Added Validator import.
    • Added byteArrayEquals import.
    • Updated isValidBlsToExecutionChange parameters.
  • packages/state-transition/src/block/processConsolidationRequest.ts
    • Added byteArrayEquals import.
    • Removed fork parameter from processConsolidationRequest.
    • Updated byteArrayEquals calls.
  • packages/state-transition/src/block/processDepositRequest.ts
    • Updated processDepositRequest to handle builder deposits and added applyDepositForBuilder, addBuilderToRegistry functions.
  • packages/state-transition/src/block/processExecutionPayload.ts
    • Added byteArrayEquals import.
  • packages/state-transition/src/block/processExecutionPayloadBid.ts
    • Added BUILDER_INDEX_SELF_BUILD import.
    • Added byteArrayEquals import.
    • Added getExecutionPayloadBidSigningRoot import.
    • Updated processExecutionPayloadBid to use isActiveBuilder, canBuilderCoverBid.
    • Removed hasBuilderWithdrawalCredential import.
    • Removed balance checks.
  • packages/state-transition/src/block/processExecutionPayloadEnvelope.ts
    • Added BUILDER_INDEX_SELF_BUILD import.
    • Added byteArrayEquals import.
    • Updated processExecutionPayloadEnvelope to use processDepositRequest with fork.
    • Removed computeExitEpochAndUpdateChurn.
    • Updated validateExecutionPayloadEnvelope to verify withdrawals against payloadExpectedWithdrawals.
    • Updated verifyExecutionPayloadEnvelopeSignature to handle BUILDER_INDEX_SELF_BUILD and use state.builders.
  • packages/state-transition/src/block/processOperations.ts
    • Updated processDepositRequest and processConsolidationRequest calls.
  • packages/state-transition/src/block/processPayloadAttestation.ts
    • Added byteArrayEquals import.
  • packages/state-transition/src/block/processProposerSlashing.ts
    • Added BeaconConfig import.
    • Added Slot import.
    • Added Validator import.
    • Added Index2PubkeyCache import.
    • Updated processProposerSlashing and assertValidProposerSlashing parameters.
    • Updated verifySignatureSet to pass index2pubkey.
  • packages/state-transition/src/block/processSyncCommittee.ts
    • Added byteArrayEquals import.
    • Updated verifySignatureSet to pass state.epochCtx.index2pubkey.
    • Updated getSyncCommitteeSignatureSet to remove index2pubkey and use indices.
  • packages/state-transition/src/block/processVoluntaryExit.ts
    • Added PublicKey, Signature, verify imports.
    • Updated processVoluntaryExit to handle builder exits.
    • Updated getVoluntaryExitValidity to remove fork parameter from getPendingBalanceToWithdraw.
  • packages/state-transition/src/block/processWithdrawalRequest.ts
    • Removed fork parameter from getPendingBalanceToWithdraw.
  • packages/state-transition/src/block/processWithdrawals.ts
    • Updated MAX_BUILDERS_PER_WITHDRAWALS_SWEEP import.
    • Added BuilderIndex import.
    • Added byteArrayEquals import.
    • Updated isBuilderPaymentWithdrawable to isParentBlockFull.
    • Added convertBuilderIndexToValidatorIndex, convertValidatorIndexToBuilderIndex, isBuilderIndex imports.
    • Added isPartiallyWithdrawableValidator import.
    • Updated getExpectedWithdrawals to include processedBuildersSweepCount.
    • Updated Gloas-specific logic to store payloadExpectedWithdrawals and update builderPendingWithdrawals, nextWithdrawalBuilderIndex.
    • Refactored getBuilderWithdrawals and added getBuildersSweepWithdrawals.
    • Updated applyWithdrawals to handle builder withdrawals.
  • packages/state-transition/src/cache/epochCache.ts
    • Removed IShufflingCache import.
    • Removed AttesterDuty, calculateCommitteeAssignments imports.
    • Removed computeStartSlotAtEpoch import.
    • Added calculateDecisionRoot import.
    • Added EpochShuffling import.
    • Added AttesterDuty, calculateCommitteeAssignments, getAttestingIndices, getBeaconCommittees, getIndexedAttestation imports from ../util/shuffling.js.
    • Removed shufflingCache from EpochCache properties and constructor.
    • Updated nextShuffling type to EpochShuffling.
    • Updated createFromState to remove shufflingCache parameter.
    • Updated afterProcessEpoch to use calculateDecisionRoot and epochTransitionCache.nextShuffling.
    • Removed EpochCacheErrorCode.COMMITTEE_INDEX_OUT_OF_RANGE.
    • Updated getBeaconCommittees to use getBeaconCommittees from ../util/shuffling.js.
    • Updated getIndexedAttestation and getAttestingIndices to use new shuffling util functions.
    • Removed getCommitteeAssignment.
  • packages/state-transition/src/cache/epochTransitionCache.ts
    • Removed SLOTS_PER_HISTORICAL_ROOT import.
    • Removed asyncShufflingCalculation from EpochTransitionCacheOpts and EpochTransitionCache.
    • Updated nextShufflingDecisionRoot to nextShuffling: EpochShuffling | null.
    • Removed asyncShufflingCalculation logic from beforeProcessEpoch.
  • packages/state-transition/src/cache/stateCache.ts
    • Removed shufflingCache from loadCachedBeaconState.
  • packages/state-transition/src/epoch/processBuilderPendingPayments.ts
    • Removed computeExitEpochAndUpdateChurn.
    • Updated payment.weight > quorum to payment.weight >= quorum.
  • packages/state-transition/src/epoch/processPendingAttestations.ts
    • Added byteArrayEquals import.
  • packages/state-transition/src/epoch/processProposerLookahead.ts
    • Removed shufflingCache usage.
    • Updated cache.nextShuffling = shuffling.
  • packages/state-transition/src/index.ts
    • Removed EpochCacheError, EpochCacheErrorCode exports.
  • packages/state-transition/src/rewards/blockRewards.ts
    • Added RewardCache import.
    • Updated computeBlockRewards parameters.
  • packages/state-transition/src/rewards/syncCommitteeRewards.ts
    • Removed BalanceRecord.
    • Updated computeSyncCommitteeRewards to use rewardDeltas map.
  • packages/state-transition/src/signatureSets/attesterSlashings.ts
    • Removed Index2PubkeyCache import.
    • Updated getAttesterSlashingsSignatureSets and getAttesterSlashingSignatureSets to remove index2pubkey.
    • Updated getIndexedAttestationBigintSignatureSet to use indices instead of pubkeys.
  • packages/state-transition/src/signatureSets/blsToExecutionChange.ts
    • Removed CachedBeaconStateAllForks import.
    • Updated getBlsToExecutionChangeSignatureSet return type to SingleSignatureSet.
    • Updated getBlsToExecutionChangeSignatureSets return type to SingleSignatureSet[].
  • packages/state-transition/src/signatureSets/executionPayloadBid.ts
    • New file: Defines getExecutionPayloadBidSigningRoot.
  • packages/state-transition/src/signatureSets/executionPayloadEnvelope.ts
    • New file: Defines getExecutionPayloadEnvelopeSigningRoot.
  • packages/state-transition/src/signatureSets/index.ts
    • Exported new Gloas-related signature set files.
    • Updated getBlockSignatureSets to remove index2pubkey.
    • Updated getRandaoRevealSignatureSet, getProposerSlashingSignatureSets, getAttesterSlashingSignatureSets, getAttestationsSignatureSets, getVoluntaryExitsSignatureSets, getSyncCommitteeSignatureSet calls to remove index2pubkey.
  • packages/state-transition/src/signatureSets/indexedAttestation.ts
    • Removed Index2PubkeyCache import.
    • Updated getAttestationWithIndicesSignatureSet to use attestingIndices directly.
    • Updated getIndexedAttestationSignatureSet to remove index2pubkey.
    • Updated getAttestationsSignatureSets to remove index2pubkey.
  • packages/state-transition/src/signatureSets/indexedPayloadAttestation.ts
    • Added BeaconConfig import.
    • Updated getPayloadAttestationDataSigningRoot parameters.
    • Updated getIndexedPayloadAttestationSignatureSet to use attestingIndices directly.
  • packages/state-transition/src/signatureSets/proposer.ts
    • Removed Index2PubkeyCache import.
    • Updated verifyProposerSignature to pass index2pubkey to verifySignatureSet.
    • Updated getBlockProposerSignatureSet, getBlockHeaderProposerSignatureSetByParentStateSlot, getBlockHeaderProposerSignatureSetByHeaderSlot, getBlockHeaderProposerSignatureSet to remove index2pubkey and use IndexedSignatureSet.
  • packages/state-transition/src/signatureSets/proposerSlashings.ts
    • Removed Index2PubkeyCache import.
    • Updated getProposerSlashingSignatureSets to remove index2pubkey and use IndexedSignatureSet.
  • packages/state-transition/src/signatureSets/randao.ts
    • Removed Index2PubkeyCache import.
    • Updated verifyRandaoSignature to pass index2pubkey to verifySignatureSet.
    • Updated getRandaoRevealSignatureSet to remove index2pubkey and use IndexedSignatureSet.
  • packages/state-transition/src/signatureSets/voluntaryExits.ts
    • Removed Index2PubkeyCache import.
    • Updated verifyVoluntaryExitSignature to pass index2pubkey to verifySignatureSet.
    • Updated getVoluntaryExitSignatureSet and getVoluntaryExitsSignatureSets to remove index2pubkey and use IndexedSignatureSet.
  • packages/state-transition/src/slot/index.ts
    • Added byteArrayEquals import.
  • packages/state-transition/src/types.ts
    • Added ShufflingGetter export.
  • packages/state-transition/src/util/calculateCommitteeAssignments.ts
    • Removed file.
  • packages/state-transition/src/util/electra.ts
    • Removed hasBuilderWithdrawalCredential import.
    • Updated hasCompoundingWithdrawalCredential.
  • packages/state-transition/src/util/epochShuffling.ts
    • Removed GaugeExtra, Logger, NoLabels imports.
    • Removed ShufflingBuildProps, PublicShufflingCacheMetrics, IShufflingCache interfaces.
    • Made calculateDecisionRoot exportable.
  • packages/state-transition/src/util/gloas.ts
    • Updated BUILDER_INDEX_FLAG, FAR_FUTURE_EPOCH, MIN_DEPOSIT_AMOUNT imports.
    • Added BuilderIndex, Epoch, ValidatorIndex imports.
    • Added byteArrayEquals import.
    • Renamed hasBuilderWithdrawalCredential to isBuilderWithdrawalCredential.
    • Added isBuilderIndex, convertBuilderIndexToValidatorIndex, convertValidatorIndexToBuilderIndex, isActiveBuilder, getPendingBalanceToWithdrawForBuilder, canBuilderCoverBid, initiateBuilderExit, findBuilderIndexByPubkey functions.
  • packages/state-transition/src/util/index.ts
    • Removed calculateCommitteeAssignments export.
    • Removed shufflingDecisionRoot export.
    • Added gloas export.
    • Added shuffling export.
  • packages/state-transition/src/util/interop.ts
    • Changed toBigIntBE import from bigint-buffer to @vekexasia/bigint-buffer2.
  • packages/state-transition/src/util/loadState/findModifiedInactivityScores.ts
    • Added byteArrayEquals import.
    • Updated comments and Buffer.compare to byteArrayEquals.
  • packages/state-transition/src/util/loadState/findModifiedValidators.ts
    • Added byteArrayEquals import.
    • Updated comments and Buffer.compare to byteArrayEquals.
  • packages/state-transition/src/util/loadState/loadValidator.ts
    • Added byteArrayEquals import.
    • Updated Buffer.compare to byteArrayEquals.
  • packages/state-transition/src/util/shuffling.ts
    • New file: Contains shuffling-related utilities and error definitions.
  • packages/state-transition/src/util/shufflingDecisionRoot.ts
    • Removed file.
  • packages/state-transition/src/util/signatureSets.ts
    • Added PublicKey, Signature, aggregatePublicKeys imports.
    • Added Index2PubkeyCache import.
    • Added indexed to SignatureSetType.
    • Added IndexedSignatureSet type.
    • Updated ISignatureSet type.
    • Added getSignatureSetPubkey function.
    • Updated verifySignatureSet to accept index2pubkey and handle indexed type.
    • Added createIndexedSignatureSetFromComponents.
    • Updated createAggregateSignatureSetFromComponents to use indices.
  • packages/state-transition/src/util/validator.ts
    • Updated MAX_EFFECTIVE_BALANCE import.
    • Added hasEth1WithdrawalCredential import.
    • Added hasExecutionWithdrawalCredential import.
    • Added isPartiallyWithdrawableValidator function.
    • Removed fork parameter from getPendingBalanceToWithdraw.
    • Removed Gloas-specific logic from getPendingBalanceToWithdraw.
  • packages/state-transition/test/perf/misc/byteArrayEquals.test.ts
    • Updated byteArrayEquals import.
    • Added byteArrayEqualsLoop for comparison.
    • Updated benchmarks to compare byteArrayEqualsLoop with byteArrayEquals.
  • packages/state-transition/test/perf/misc/rootEquals.test.ts
    • Updated byteArrayEquals import.
  • packages/state-transition/test/perf/util/loadState/findModifiedValidators.test.ts
    • Updated byteArrayEquals import.
    • Updated Buffer.compare to byteArrayEquals.
  • packages/state-transition/test/perf/util/loadState/loadState.test.ts
    • Increased vi.setConfig timeout.
    • Added shufflingGetter to loadCachedBeaconState and createCachedBeaconState calls.
  • packages/state-transition/test/unit/block/isValidIndexedAttestation.test.ts
    • Updated isValidIndexedAttestation parameters.
  • packages/state-transition/test/unit/block/processConsolidationRequest.test.ts
    • Removed ForkSeq import.
    • Removed fork parameter from processConsolidationRequest.
  • packages/state-transition/test/unit/cachedBeaconState.test.ts
    • Increased vi.setConfig timeout.
    • Added shufflingGetter to loadCachedBeaconState and createCachedBeaconState calls.
  • packages/state-transition/test/unit/rewards/blockRewards.test.ts
    • Updated computeBlockRewards parameters.
  • packages/state-transition/test/unit/signatureSets/signatureSets.test.ts
    • Removed index2pubkey from getBlockSignatureSets.
  • packages/state-transition/test/unit/util/loadState/loadValidator.test.ts
    • Added byteArrayEquals import.
    • Updated Buffer.compare to byteArrayEquals.
  • packages/state-transition/test/unit/util/misc.test.ts
    • Changed toBigIntLE import from bigint-buffer to @vekexasia/bigint-buffer2.
  • packages/types/package.json
    • Version bumped to 1.40.0.
  • packages/types/src/gloas/sszTypes.ts
    • Added BUILDER_REGISTRY_LIMIT import.
    • Added Builder container.
    • Updated BuilderPendingWithdrawal to use BuilderIndex.
    • Added ProposerPreferences and SignedProposerPreferences containers.
    • Updated ExecutionPayloadBid to use BuilderIndex.
    • Updated ExecutionPayloadEnvelope to use BuilderIndex.
    • Added builders, nextWithdrawalBuilderIndex, payloadExpectedWithdrawals to BeaconState.
  • packages/types/src/gloas/types.ts
    • Added Builder, ProposerPreferences, SignedProposerPreferences types.
  • packages/types/src/primitive/sszTypes.ts
    • Added BuilderIndex.
  • packages/types/src/primitive/types.ts
    • Added BuilderIndex.
  • packages/types/src/utils/typeguards.ts
    • Added ForkPostGloas import.
    • Added isGloasBeaconBlock function.
  • packages/utils/package.json
    • Updated bigint-buffer to @vekexasia/bigint-buffer2.
    • Version bumped to 1.40.0.
  • packages/utils/src/bytes/browser.ts
    • Changed toBigIntBE, toBigIntLE, toBufferBE, toBufferLE imports from bigint-buffer to @vekexasia/bigint-buffer2.
    • Added byteArrayEquals function.
  • packages/utils/src/bytes/nodejs.ts
    • Added byteArrayEquals function with hybrid implementation.
  • packages/utils/src/metrics.ts
    • Added reset() method to Gauge interface.
  • packages/utils/test/perf/bytes.test.ts
    • Added new benchmarks for byteArrayEquals.
Ignored Files
  • Ignored by pattern: .github/workflows/** (9)
    • .github/workflows/check-specrefs.yml
    • .github/workflows/docker.yml
    • .github/workflows/docs.yml
    • .github/workflows/publish-dev.yml
    • .github/workflows/publish-manual.yml
    • .github/workflows/publish-nextfork.yml
    • .github/workflows/publish-rc.yml
    • .github/workflows/publish-stable.yml
    • .github/workflows/test-sim.yml
Activity
  • The pull request is titled 'chore: v1.40.0 release', indicating a routine version update.
  • The description body is empty, suggesting that the changes are self-explanatory through the code modifications and commit history.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request prepares the v1.40.0 release. It includes version bumps across packages, dependency updates, and a significant number of feature additions and refactorings. Key changes include the implementation of features for the upcoming Gloas fork, a major refactoring of state and shuffling caches for better performance and memory management, and improvements to the BLS signature verification process to use validator indices instead of full public keys. I've identified a few important bug fixes in the caching and data validation logic. Overall, the changes are extensive but appear well-structured and move the codebase forward significantly.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 1a81a41 Previous: null Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.1518 ms/op
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 37.165 us/op
BLS verify - blst 803.79 us/op
BLS verifyMultipleSignatures 3 - blst 1.1452 ms/op
BLS verifyMultipleSignatures 8 - blst 1.5848 ms/op
BLS verifyMultipleSignatures 32 - blst 4.7137 ms/op
BLS verifyMultipleSignatures 64 - blst 9.0629 ms/op
BLS verifyMultipleSignatures 128 - blst 17.240 ms/op
BLS deserializing 10000 signatures 678.98 ms/op
BLS deserializing 100000 signatures 6.7585 s/op
BLS verifyMultipleSignatures - same message - 3 - blst 850.65 us/op
BLS verifyMultipleSignatures - same message - 8 - blst 1.0117 ms/op
BLS verifyMultipleSignatures - same message - 32 - blst 1.6654 ms/op
BLS verifyMultipleSignatures - same message - 64 - blst 2.5115 ms/op
BLS verifyMultipleSignatures - same message - 128 - blst 4.2590 ms/op
BLS aggregatePubkeys 32 - blst 18.802 us/op
BLS aggregatePubkeys 128 - blst 67.050 us/op
getSlashingsAndExits - default max 70.624 us/op
getSlashingsAndExits - 2k 313.32 us/op
isKnown best case - 1 super set check 209.00 ns/op
isKnown normal case - 2 super set checks 209.00 ns/op
isKnown worse case - 16 super set checks 209.00 ns/op
validate api signedAggregateAndProof - struct 1.3767 ms/op
validate gossip signedAggregateAndProof - struct 1.3578 ms/op
batch validate gossip attestation - vc 640000 - chunk 32 114.94 us/op
batch validate gossip attestation - vc 640000 - chunk 64 101.76 us/op
batch validate gossip attestation - vc 640000 - chunk 128 92.444 us/op
batch validate gossip attestation - vc 640000 - chunk 256 90.149 us/op
bytes32 toHexString 346.00 ns/op
bytes32 Buffer.toString(hex) 233.00 ns/op
bytes32 Buffer.toString(hex) from Uint8Array 317.00 ns/op
bytes32 Buffer.toString(hex) + 0x 234.00 ns/op
Return object 10000 times 0.22320 ns/op
Throw Error 10000 times 3.9133 us/op
toHex 134.65 ns/op
Buffer.from 129.34 ns/op
shared Buffer 80.320 ns/op
fastMsgIdFn sha256 / 200 bytes 1.8080 us/op
fastMsgIdFn h32 xxhash / 200 bytes 188.00 ns/op
fastMsgIdFn h64 xxhash / 200 bytes 254.00 ns/op
fastMsgIdFn sha256 / 1000 bytes 5.6810 us/op
fastMsgIdFn h32 xxhash / 1000 bytes 282.00 ns/op
fastMsgIdFn h64 xxhash / 1000 bytes 298.00 ns/op
fastMsgIdFn sha256 / 10000 bytes 50.727 us/op
fastMsgIdFn h32 xxhash / 10000 bytes 1.3510 us/op
fastMsgIdFn h64 xxhash / 10000 bytes 880.00 ns/op
send data - 1000 256B messages 12.860 ms/op
send data - 1000 512B messages 15.875 ms/op
send data - 1000 1024B messages 21.266 ms/op
send data - 1000 1200B messages 23.068 ms/op
send data - 1000 2048B messages 21.567 ms/op
send data - 1000 4096B messages 24.133 ms/op
send data - 1000 16384B messages 121.86 ms/op
send data - 1000 65536B messages 306.16 ms/op
enrSubnets - fastDeserialize 64 bits 855.00 ns/op
enrSubnets - ssz BitVector 64 bits 326.00 ns/op
enrSubnets - fastDeserialize 4 bits 128.00 ns/op
enrSubnets - ssz BitVector 4 bits 328.00 ns/op
prioritizePeers score -10:0 att 32-0.1 sync 2-0 234.37 us/op
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 259.85 us/op
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 610.36 us/op
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 694.24 us/op
prioritizePeers score 0:0 att 64-1 sync 4-1 828.69 us/op
array of 16000 items push then shift 1.5837 us/op
LinkedList of 16000 items push then shift 7.1190 ns/op
array of 16000 items push then pop 73.926 ns/op
LinkedList of 16000 items push then pop 7.4220 ns/op
array of 24000 items push then shift 2.3559 us/op
LinkedList of 24000 items push then shift 7.7590 ns/op
array of 24000 items push then pop 105.88 ns/op
LinkedList of 24000 items push then pop 7.4540 ns/op
intersect bitArray bitLen 8 5.6160 ns/op
intersect array and set length 8 32.813 ns/op
intersect bitArray bitLen 128 28.078 ns/op
intersect array and set length 128 535.12 ns/op
bitArray.getTrueBitIndexes() bitLen 128 1.0220 us/op
bitArray.getTrueBitIndexes() bitLen 248 1.7910 us/op
bitArray.getTrueBitIndexes() bitLen 512 3.6900 us/op
Full columns - reconstruct all 6 blobs 275.99 us/op
Full columns - reconstruct half of the blobs out of 6 97.444 us/op
Full columns - reconstruct single blob out of 6 31.024 us/op
Half columns - reconstruct all 6 blobs 272.99 ms/op
Half columns - reconstruct half of the blobs out of 6 137.50 ms/op
Half columns - reconstruct single blob out of 6 50.985 ms/op
Full columns - reconstruct all 10 blobs 408.83 us/op
Full columns - reconstruct half of the blobs out of 10 231.89 us/op
Full columns - reconstruct single blob out of 10 41.587 us/op
Half columns - reconstruct all 10 blobs 440.67 ms/op
Half columns - reconstruct half of the blobs out of 10 228.38 ms/op
Half columns - reconstruct single blob out of 10 50.269 ms/op
Full columns - reconstruct all 20 blobs 708.29 us/op
Full columns - reconstruct half of the blobs out of 20 297.43 us/op
Full columns - reconstruct single blob out of 20 30.947 us/op
Half columns - reconstruct all 20 blobs 882.65 ms/op
Half columns - reconstruct half of the blobs out of 20 450.72 ms/op
Half columns - reconstruct single blob out of 20 50.647 ms/op
Set add up to 64 items then delete first 2.0753 us/op
OrderedSet add up to 64 items then delete first 3.0493 us/op
Set add up to 64 items then delete last 2.3191 us/op
OrderedSet add up to 64 items then delete last 3.2833 us/op
Set add up to 64 items then delete middle 2.3220 us/op
OrderedSet add up to 64 items then delete middle 4.8511 us/op
Set add up to 128 items then delete first 4.8768 us/op
OrderedSet add up to 128 items then delete first 7.2575 us/op
Set add up to 128 items then delete last 4.6232 us/op
OrderedSet add up to 128 items then delete last 6.7252 us/op
Set add up to 128 items then delete middle 4.6113 us/op
OrderedSet add up to 128 items then delete middle 13.132 us/op
Set add up to 256 items then delete first 9.7701 us/op
OrderedSet add up to 256 items then delete first 15.463 us/op
Set add up to 256 items then delete last 9.3758 us/op
OrderedSet add up to 256 items then delete last 13.752 us/op
Set add up to 256 items then delete middle 9.2257 us/op
OrderedSet add up to 256 items then delete middle 40.613 us/op
pass gossip attestations to forkchoice per slot 2.4113 ms/op
forkChoice updateHead vc 100000 bc 64 eq 0 477.08 us/op
forkChoice updateHead vc 600000 bc 64 eq 0 2.9046 ms/op
forkChoice updateHead vc 1000000 bc 64 eq 0 4.8490 ms/op
forkChoice updateHead vc 600000 bc 320 eq 0 2.9293 ms/op
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9334 ms/op
forkChoice updateHead vc 600000 bc 7200 eq 0 3.1882 ms/op
forkChoice updateHead vc 600000 bc 64 eq 1000 3.3041 ms/op
forkChoice updateHead vc 600000 bc 64 eq 10000 3.4195 ms/op
forkChoice updateHead vc 600000 bc 64 eq 300000 8.0329 ms/op
computeDeltas 1400000 validators 0% inactive 14.107 ms/op
computeDeltas 1400000 validators 10% inactive 13.180 ms/op
computeDeltas 1400000 validators 20% inactive 12.255 ms/op
computeDeltas 1400000 validators 50% inactive 9.5647 ms/op
computeDeltas 2100000 validators 0% inactive 21.210 ms/op
computeDeltas 2100000 validators 10% inactive 21.899 ms/op
computeDeltas 2100000 validators 20% inactive 18.368 ms/op
computeDeltas 2100000 validators 50% inactive 14.417 ms/op
altair processAttestation - 250000 vs - 7PWei normalcase 1.9120 ms/op
altair processAttestation - 250000 vs - 7PWei worstcase 2.6555 ms/op
altair processAttestation - setStatus - 1/6 committees join 119.80 us/op
altair processAttestation - setStatus - 1/3 committees join 234.56 us/op
altair processAttestation - setStatus - 1/2 committees join 325.88 us/op
altair processAttestation - setStatus - 2/3 committees join 424.72 us/op
altair processAttestation - setStatus - 4/5 committees join 582.15 us/op
altair processAttestation - setStatus - 100% committees join 682.07 us/op
altair processBlock - 250000 vs - 7PWei normalcase 3.5715 ms/op
altair processBlock - 250000 vs - 7PWei normalcase hashState 15.818 ms/op
altair processBlock - 250000 vs - 7PWei worstcase 22.253 ms/op
altair processBlock - 250000 vs - 7PWei worstcase hashState 57.269 ms/op
phase0 processBlock - 250000 vs - 7PWei normalcase 1.5138 ms/op
phase0 processBlock - 250000 vs - 7PWei worstcase 19.072 ms/op
altair processEth1Data - 250000 vs - 7PWei normalcase 367.93 us/op
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 5.8890 us/op
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 34.500 us/op
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 10.443 us/op
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 7.0420 us/op
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 136.23 us/op
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.9348 ms/op
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.2505 ms/op
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.2963 ms/op
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.5152 ms/op
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.7258 ms/op
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.9172 ms/op
Tree 40 250000 create 359.29 ms/op
Tree 40 250000 get(125000) 122.16 ns/op
Tree 40 250000 set(125000) 1.1957 us/op
Tree 40 250000 toArray() 14.808 ms/op
Tree 40 250000 iterate all - toArray() + loop 14.843 ms/op
Tree 40 250000 iterate all - get(i) 42.899 ms/op
Array 250000 create 2.3883 ms/op
Array 250000 clone - spread 763.26 us/op
Array 250000 get(125000) 0.33800 ns/op
Array 250000 set(125000) 0.34300 ns/op
Array 250000 iterate all - loop 59.737 us/op
phase0 afterProcessEpoch - 250000 vs - 7PWei 40.498 ms/op
Array.fill - length 1000000 2.9170 ms/op
Array push - length 1000000 9.1626 ms/op
Array.get 0.21304 ns/op
Uint8Array.get 0.21729 ns/op
phase0 beforeProcessEpoch - 250000 vs - 7PWei 13.676 ms/op
altair processEpoch - mainnet_e81889 262.97 ms/op
mainnet_e81889 - altair beforeProcessEpoch 17.197 ms/op
mainnet_e81889 - altair processJustificationAndFinalization 5.2870 us/op
mainnet_e81889 - altair processInactivityUpdates 3.6343 ms/op
mainnet_e81889 - altair processRewardsAndPenalties 17.998 ms/op
mainnet_e81889 - altair processRegistryUpdates 621.00 ns/op
mainnet_e81889 - altair processSlashings 165.00 ns/op
mainnet_e81889 - altair processEth1DataReset 159.00 ns/op
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.5379 ms/op
mainnet_e81889 - altair processSlashingsReset 763.00 ns/op
mainnet_e81889 - altair processRandaoMixesReset 1.0320 us/op
mainnet_e81889 - altair processHistoricalRootsUpdate 161.00 ns/op
mainnet_e81889 - altair processParticipationFlagUpdates 490.00 ns/op
mainnet_e81889 - altair processSyncCommitteeUpdates 125.00 ns/op
mainnet_e81889 - altair afterProcessEpoch 42.614 ms/op
capella processEpoch - mainnet_e217614 794.23 ms/op
mainnet_e217614 - capella beforeProcessEpoch 70.036 ms/op
mainnet_e217614 - capella processJustificationAndFinalization 5.4320 us/op
mainnet_e217614 - capella processInactivityUpdates 16.452 ms/op
mainnet_e217614 - capella processRewardsAndPenalties 99.444 ms/op
mainnet_e217614 - capella processRegistryUpdates 5.5960 us/op
mainnet_e217614 - capella processSlashings 158.00 ns/op
mainnet_e217614 - capella processEth1DataReset 151.00 ns/op
mainnet_e217614 - capella processEffectiveBalanceUpdates 11.552 ms/op
mainnet_e217614 - capella processSlashingsReset 779.00 ns/op
mainnet_e217614 - capella processRandaoMixesReset 1.1220 us/op
mainnet_e217614 - capella processHistoricalRootsUpdate 162.00 ns/op
mainnet_e217614 - capella processParticipationFlagUpdates 486.00 ns/op
mainnet_e217614 - capella afterProcessEpoch 111.68 ms/op
phase0 processEpoch - mainnet_e58758 224.36 ms/op
mainnet_e58758 - phase0 beforeProcessEpoch 47.131 ms/op
mainnet_e58758 - phase0 processJustificationAndFinalization 5.7250 us/op
mainnet_e58758 - phase0 processRewardsAndPenalties 17.769 ms/op
mainnet_e58758 - phase0 processRegistryUpdates 2.6850 us/op
mainnet_e58758 - phase0 processSlashings 166.00 ns/op
mainnet_e58758 - phase0 processEth1DataReset 164.00 ns/op
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0646 ms/op
mainnet_e58758 - phase0 processSlashingsReset 875.00 ns/op
mainnet_e58758 - phase0 processRandaoMixesReset 1.0800 us/op
mainnet_e58758 - phase0 processHistoricalRootsUpdate 227.00 ns/op
mainnet_e58758 - phase0 processParticipationRecordUpdates 834.00 ns/op
mainnet_e58758 - phase0 afterProcessEpoch 34.380 ms/op
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.6962 ms/op
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.8198 ms/op
altair processInactivityUpdates - 250000 normalcase 12.454 ms/op
altair processInactivityUpdates - 250000 worstcase 12.208 ms/op
phase0 processRegistryUpdates - 250000 normalcase 4.5620 us/op
phase0 processRegistryUpdates - 250000 badcase_full_deposits 187.89 us/op
phase0 processRegistryUpdates - 250000 worstcase 0.5 69.063 ms/op
altair processRewardsAndPenalties - 250000 normalcase 15.900 ms/op
altair processRewardsAndPenalties - 250000 worstcase 15.530 ms/op
phase0 getAttestationDeltas - 250000 normalcase 6.5162 ms/op
phase0 getAttestationDeltas - 250000 worstcase 6.5951 ms/op
phase0 processSlashings - 250000 worstcase 76.397 us/op
altair processSyncCommitteeUpdates - 250000 10.459 ms/op
BeaconState.hashTreeRoot - No change 196.00 ns/op
BeaconState.hashTreeRoot - 1 full validator 68.356 us/op
BeaconState.hashTreeRoot - 32 full validator 1.0594 ms/op
BeaconState.hashTreeRoot - 512 full validator 7.7896 ms/op
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 87.018 us/op
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.4459 ms/op
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 14.301 ms/op
BeaconState.hashTreeRoot - 1 balances 76.142 us/op
BeaconState.hashTreeRoot - 32 balances 751.34 us/op
BeaconState.hashTreeRoot - 512 balances 6.0103 ms/op
BeaconState.hashTreeRoot - 250000 balances 145.64 ms/op
aggregationBits - 2048 els - zipIndexesInBitList 20.221 us/op
regular array get 100000 times 23.795 us/op
wrappedArray get 100000 times 23.339 us/op
arrayWithProxy get 100000 times 14.724 ms/op
ssz.Root.equals 22.731 ns/op
byteArrayEquals 22.318 ns/op
Buffer.compare 9.6570 ns/op
processSlot - 1 slots 11.060 us/op
processSlot - 32 slots 2.4009 ms/op
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 4.6781 ms/op
getCommitteeAssignments - req 1 vs - 250000 vc 1.8034 ms/op
getCommitteeAssignments - req 100 vs - 250000 vc 3.5200 ms/op
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7661 ms/op
findModifiedValidators - 10000 modified validators 524.97 ms/op
findModifiedValidators - 1000 modified validators 353.16 ms/op
findModifiedValidators - 100 modified validators 265.35 ms/op
findModifiedValidators - 10 modified validators 209.82 ms/op
findModifiedValidators - 1 modified validators 111.72 ms/op
findModifiedValidators - no difference 138.46 ms/op
migrate state 1500000 validators, 3400 modified, 2000 new 934.97 ms/op
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.0500 ns/op
state getBlockRootAtSlot - 250000 vs - 7PWei 557.52 ns/op
computeProposerIndex 100000 validators 1.4904 ms/op
getNextSyncCommitteeIndices 1000 validators 113.06 ms/op
getNextSyncCommitteeIndices 10000 validators 113.25 ms/op
getNextSyncCommitteeIndices 100000 validators 113.03 ms/op
computeProposers - vc 250000 620.08 us/op
computeEpochShuffling - vc 250000 39.444 ms/op
getNextSyncCommittee - vc 250000 10.012 ms/op
nodejs block root to RootHex using toHex 126.92 ns/op
nodejs block root to RootHex using toRootHex 79.277 ns/op
nodejs fromHex(blob) 266.41 us/op
nodejs fromHexInto(blob) 685.01 us/op
nodejs block root to RootHex using the deprecated toHexString 524.75 ns/op
nodejs byteArrayEquals 32 bytes (block root) 27.743 ns/op
nodejs byteArrayEquals 48 bytes (pubkey) 39.696 ns/op
nodejs byteArrayEquals 96 bytes (signature) 38.069 ns/op
nodejs byteArrayEquals 1024 bytes 43.095 ns/op
nodejs byteArrayEquals 131072 bytes (blob) 1.8221 us/op
browser block root to RootHex using toHex 158.10 ns/op
browser block root to RootHex using toRootHex 149.25 ns/op
browser fromHex(blob) 1.0664 ms/op
browser fromHexInto(blob) 688.79 us/op
browser block root to RootHex using the deprecated toHexString 366.10 ns/op
browser byteArrayEquals 32 bytes (block root) 30.676 ns/op
browser byteArrayEquals 48 bytes (pubkey) 42.607 ns/op
browser byteArrayEquals 96 bytes (signature) 83.608 ns/op
browser byteArrayEquals 1024 bytes 782.80 ns/op
browser byteArrayEquals 131072 bytes (blob) 99.099 us/op

by benchmarkbot/action

## Motivation

Fixes a race condition that can cause state corruption and `First offset
must equal to fixedEnd` errors on restart.

See discussion:
https://discord.com/channels/593655374469660673/1469368525180113078

## Description

The `using` keyword in `serializeState.ts` releases the buffer back to
the pool when the block exits. Since `processFn` is async (returns a
Promise), the buffer was being released before the DB write completed.

If another serialization (checkpoint state or archive state) happened
before the write finished, it would:
1. Get the same buffer from the pool
2. Call `fill(0)` on it (per BufferPool.alloc behavior)
3. Corrupt the data being written by the first serialization

This could cause `First offset must equal to fixedEnd 0 != <large
number>` errors on restart when the corrupted state is read.

## Fix

Add `await` before `processFn(stateBytes)` to ensure the buffer is not
released until the async operation completes.

---

**AI Disclosure:** This PR was authored with AI assistance
(Lodekeeper/Claude).

Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.