10951 Commits

Author SHA1 Message Date
twoeths
09ef70bbb0 fix: deduplicate slots to delete archived DatacolumnSidecars (#8357)
**Motivation**

- fix `archiveBlocks.ts`: duplicate slots when delete DataColumnSidecars

**Description**

- deduplicate them
- improve logs

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-09-09 08:08:38 -04:00
Nazar Hussain
2f71baeaa0 test: finalized sync e2e post electra only (#8340)
**Motivation**

- run a node starting from electra passing through fulu
- start another node to do range sync and try to catch up

**Description**

- to reproduce the issue in #8247
```
../../node_modules/.bin/vitest test/e2e/sync/finalizedSync.test.ts
```

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-09-09 08:50:16 +07:00
Nico Flaig
bb15e8ef5f fix: add bucketId to all db operations (#8347)
**Motivation**

Similar to https://github.com/ChainSafe/lodestar/pull/8346 adds missing
`bucketId` to all db operations to avoid `unknown`

This is from `stable-lg1k-hzax41-dkr` which shows it's already an issue
there

<img width="1890" height="684" alt="image"
src="https://github.com/user-attachments/assets/cfbdb335-b3ec-49b7-9ae2-be345ce8071e"
/>


**Description**

Add `bucketId` to all db operations

deployed to `feat3` to make sure I didn't miss anything
2025-09-08 14:47:47 -04:00
Nico Flaig
bb10d2b5ea fix: correct leveldb metrics (#8355)
Bring https://github.com/ChainSafe/lodestar/pull/8335 to unstable

Co-authored-by: twoeths <10568965+twoeths@users.noreply.github.com>
Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-09-08 14:44:55 -04:00
twoeths
8a8da6aa84 fix: add bucketId to abstract_prefixed_repo (#8346)
**Motivation**

- there are a lot of "unknown" read/write requests tracked in #8334

**Description**

- add bucketId to abstractPrefixedRepository.ts where it's missed

part of #8334

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-09-06 12:07:53 +01:00
Phil Ngo
1a17514b02 chore: bump package versions to 1.34.0 v1.34.0-rc.0 2025-09-05 12:24:08 -04:00
Matthew Keil
083b7cce17 chore: fix lint (#8323)
**Motivation**

Lint was breaking trying to merge into unstable. Quick fix to touch up
so can merge other PR's
2025-09-04 15:25:04 -04:00
Matthew Keil
97ad684a2a fix: log missing columns (#8315)
**Motivation**

Log out reqresp missing column indices that we do not have in the db but
should.

Added metrics as well. I think this might get noisy in the logs until we
finish backfill so might need to comment out the log and just use the
metrics for finding regressions.
2025-09-04 15:24:41 -04:00
Shivam Kumar
0aff2f62ff fix: use prettyPrintIndices for logging (#8298)
**Motivation**
We want to use `prettyPrintIndices` consistently for logging subnet
indices.

**Description**
Replaced `sampleSubnets.join(" ")` with
`prettyPrintIndices(sampleSubnets)`
to improve readability and consistency with other log fields.

Closes #8292

**Steps to test or reproduce**
```sh
git checkout maishivamhoo123/prettyPrintIndices-fresh
npm run test
2025-09-04 11:20:35 -04:00
Mercy Boma Naps Nkari
3795e32bb1 fix: add slot and epoch validation to epoch committees endpoint (#7941)
**Motivation**

<!-- Why is this PR exists? What are the goals of the pull request? -->

**Description**
This PR fixes an inconsistency in Lodestar's Beacon-API behavior when
querying:
```
curl "http://127.0.0.1:9596/eth/v1/beacon/states/head/committees?epoch=2&slot=118"
```
Previously, Lodestar would return a `500 Internal Server Error` when the
provided slot did not belong to the given epoch (e.g.,
`epoch=2&slot=118`), due to an unhandled
`EPOCH_CONTEXT_ERROR_DECISION_ROOT_EPOCH_OUT_OF_RANGE` error.

<img width="948" alt="Screenshot 2025-06-10 at 08 15 05"
src="https://github.com/user-attachments/assets/7f6feea9-90c8-4299-ae0a-ce2a1e6a2282"
/>

<img width="948" alt="Screenshot 2025-06-10 at 08 14 33"
src="https://github.com/user-attachments/assets/7fafea27-09a3-4f94-a5b6-d3a818ee5c65"
/>


<!-- A clear and concise general description of the changes of this PR
commits -->

<!-- If applicable, add screenshots to help explain your solution -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes https://github.com/ChainSafe/lodestar/issues/7882

**Steps to test or reproduce**

<!--Steps to reproduce the behavior:
```sh
git checkout <feature_branch>
lodestar beacon --new-flag option1
```
-->

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-09-04 11:11:55 -04:00
twoeths
9c2e6e097b fix: do not throw error when archive 0-blob block (#8319)
**Motivation**

- we currently throw error if there is no DataColumnSidecars for the
block when archiving block

**Description**

- log it instead

Closes #8314

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-09-04 11:01:28 -04:00
Nico Flaig
9623b3e10e fix: do not attempt to reconstruct builder blocks (#8317)
**Motivation**

We fail to publish builder blocks as we attempt to reconstruct the full
block

```
Sep-03 21:52:48.755[api]              info: Selected builder block reason=block_value, slot=304614, parentSlot=304613, parentBlockRoot=0x17a2824216119eef2d74aae47c7473c727e4ef67e02214b10b209c115c4ef10b, fork=fulu, builderSelection=default, isBuilderEnabled=true, isEngineEnabled=true, strictFeeRecipientCheck=false, builderBoostFactor=90, engineDurationMs=162, engineExecutionPayloadValue=0.00932 ETH, engineConsensusBlockValue=0.00071 ETH, engineBlockTotalValue=0.01003 ETH, builderDurationMs=746, builderExecutionPayloadValue=1.01245 ETH, builderConsensusBlockValue=0.00071 ETH, builderBlockTotalValue=1.01317 ETH
Sep-03 21:52:48.756[rest]            debug: Res req-2qfu produceBlockV3 - 200
Sep-03 21:52:48.764[rest]            debug: Req req-2qfw 172.18.0.4 publishBlindedBlockV2
Sep-03 21:52:48.765[rest]            debug: Exec req-2qfw 172.18.0.4 publishBlindedBlockV2
Sep-03 21:52:48.766[chain]           debug: Reconstructing the full signed block contents slot=304614, blockRoot=0xb2d3e029598895fd59a37eb89a120d9dd422c861077872117739c39cc2594442, source=engine
Sep-03 21:52:48.766[rest]            error: Req req-2qfw publishBlindedBlockV2 error - Missing executionPayload to reconstruct post-bellatrix full block
Error: Missing executionPayload to reconstruct post-bellatrix full block
    at signedBlindedBlockToFull (file:///usr/app/packages/state-transition/src/util/blindedBlock.ts:92:11)
    at reconstructSignedBlockContents (file:///usr/app/packages/state-transition/src/util/blindedBlock.ts:132:23)
    at publishBlindedBlock (file:///usr/app/packages/beacon-node/src/api/impl/beacon/blocks/index.ts:367:35)
```
```
Sep-03 21:52:48.768[]                error: Error proposing block slot=304614, validator=0xa12e…8dda - publishBlindedBlockV2 failed with status 500: Missing executionPayload to reconstruct post-bellatrix full block - Failed to publish block
Error: publishBlindedBlockV2 failed with status 500: Missing executionPayload to reconstruct post-bellatrix full block - Failed to publish block
    at ApiResponse.error (file:///usr/app/packages/api/src/utils/client/response.ts:165:12)
    at ApiResponse.assertOk (file:///usr/app/packages/api/src/utils/client/response.ts:156:18)
    at BlockProposingService.publishBlockWrapper (file:///usr/app/packages/validator/src/services/block.ts:176:9)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at BlockProposingService.createAndPublishBlock (file:///usr/app/packages/validator/src/services/block.ts:153:7)
    at async Promise.all (index 0)
```

**Description**

Do not attempt to reconstruct builder blocks by checking not only for
`producedResult` but also the block type, in case of `BlockType.Blinded`
we don't have the execution payload/blobs to reconstruct the full block
which results in the error above.
2025-09-04 11:00:15 -04:00
NC
e53169f3a9 refactor: rename related to sync committee indices (#8313)
Follow up on #7687 , we will want to apply similar naming convention to
sync committee when it comes to indices.

- `validatorSyncCommitteeIndices` should be the position indices in the
sync committee
- `syncCommitteeValidatorIndices` should be the validator indices (eg.
1063664) of the sync committee members
2025-09-04 10:46:33 -04:00
Nazar Hussain
07d20103f0 fix: invalid bucket id for finalized dataColumnSidecar (#8312)
**Motivation**

Should be able to fetch the finalized data columns. 

**Description**

- Fix the bucket id for the archive data columns side cars
- Fix the length check for the data column side cars

**Steps to test or reproduce**

- Run all tests
2025-09-03 16:39:01 -04:00
Nazar Hussain
7af2156539 fix: deserialization of db repository keys (#8310)
**Motivation**

Make sure the deserlization of keys works as expected and match with
original keys.

**Description**

- Fix db keys unwrapping
- Add e2e tests

**Steps to test or reproduce**

Run all tests

**Note**

As these tests actually interact with I/O so why I categorized those as
e2e and not unit.
2025-09-03 13:39:16 -04:00
Barnabas Busa
7f2271a1e2 chore: update minimal_config to latest spec (#8232)
**Motivation**

- https://github.com/ethereum/consensus-specs/pull/4508

**Description**

Update minimal preset to latest spec

Closes https://github.com/ChainSafe/lodestar/issues/8226

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-09-02 21:33:14 +01:00
Nazar Hussain
11ca515d52 test: upgrade sim tests to use post-electra images (#8303)
**Motivation**

Use the newer client versions to support only post-electra forks.

**Description**

- Update images versions
- Update the runner script
- Update tests


**Steps to test or reproduce**

- Run all tests

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-09-02 20:40:00 +01:00
Nico Flaig
ac245ef6cb chore: update payload_attributes event test data (#8308)
**Motivation**

This is required to pass spec tests since spec example was updated in
https://github.com/ethereum/beacon-APIs/pull/550

**Description**

Update `payload_attributes` event test data

**Note:** we already emit all required fields, no changes needed there
2025-09-02 13:39:04 -04:00
twoeths
4703d1c27e feat: track libp2p streams (#8304)
**Motivation**

- as shown in #8301, there could be leaked streams which cause the
connection to be closed
- it's good to know number of streams opened vs closed so that we know
if we have leaked streams on a running nodes

**Description**

- track incoming/outgoing streams opened/closed by methods

**Test**
it already showed that when we handle streams, number of streams closed
successfully is less than number of streams opened
<img width="1529" height="658" alt="Screenshot 2025-09-02 at 15 57 25"
src="https://github.com/user-attachments/assets/7472b95e-34af-4707-8af5-d1591e085dba"
/>

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-09-02 22:00:05 +07:00
Nazar Hussain
22a04f4543 chore: upgrade @biomejs/biome to newer type aware version (#7982)
**Motivation**

Use the more type aware version of Biome to get benefit from type safety
rules.

**Description**

- Keep the rules matching to previous behavior 
- Add explanation to all ignore as it's required in new version

**Steps to test or reproduce**

Run all tests

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-09-02 16:53:47 +02:00
Nico Flaig
c9145b85c3 feat: update blobs endpoint to use versioned_hashes instead of indices as filter (#8264)
**Motivation**

Latest updates from https://github.com/ethereum/beacon-APIs/pull/546

**Description**

Update `getBlobs` beacon api to use `versioned_hashes` instead of
`indices` as filter
2025-09-02 10:21:53 -04:00
kevaundray
7332b1afe1 chore: add script to launch up local kurtosis testnet (#8070)
**Motivation**

Adds a bash script that allows one to launch up a local kurtosis testnet
based off of the changes made locally.

Might be useful to others -- if so, I can clean it up

<!-- Why is this PR exists? What are the goals of the pull request? -->

**Description**

```
# start a testnet with local changes
./scripts/kurtosis/run.sh start 

# stop the testnet and cleanup
./scripts/kurtosis/run.sh stop
```

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-09-02 08:51:13 -04:00
Nico Flaig
684db9fff1 feat: serve data columns by root for finalized epochs (#8250)
**Motivation**

As per spec https://github.com/ethereum/consensus-specs/pull/4394 we
should be able to serve data columns by root for finalized epochs.

**Description**

Serve data columns by root for finalized epochs

Closes https://github.com/ChainSafe/lodestar/issues/7960
2025-09-02 12:39:15 +00:00
Nazar Hussain
7b42620eba fix: the data column sidecars behavior for unavailable sidecars (#8251)
**Motivation**

The check was missed on the length of the objects. 

**Description**

- The check was required to have on the length of the array
- Earlier we were returning `T[] | null`, later changed to `(T |
null)[]`, and some was missed the check and also weird that linter
didn't found it.

**Steps to test or reproduce**

- Run all tests


**Notes**

As stated by @nflaig the specs says as below:

```
in the deneb spec it's pretty clear that we should skip in range requests
> Slots that do not contain known blobs MUST be skipped, mimicking the behaviour of the BlocksByRange request. Only response chunks with known blobs should therefore be sent.

similar note for columns
> Slots that do not contain known data columns MUST be skipped, mimicking the
> behaviour of the `BlocksByRange` request. Only response chunks with known data
> columns should therefore be sent.

```

So if we throw error during the serving of data columns, we might miss
serving the one's which we have.
2025-09-02 10:32:59 +00:00
twoeths
453c87f226 fix: add disconnectThreshold for e2e tests (#8301)
**Motivation**

- make e2e tests stable
- peers get disconnected in e2e tests

**Description**

- I was not able to run `finalizeSync.test.ts` e2e tests in
`mkeil/refactor-block-input-on-unstable` until I found this option added
since #7762
- sometimes I found same issue with `unknownBlockSync.test.ts` e2e test,
suppose it will help that test too since it uses same utils

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-09-01 10:15:23 -04:00
Nazar Hussain
93489491e0 feat: add type support for Bun (#8288)
**Motivation**

Add types support for Bun. So we can start using `if(Bun)` in our
codebase.

**Description**

- Add `@types/bun` package

**Steps to test or reproduce**

- Run all tests
2025-09-01 14:18:16 +02:00
Ekaterina Riazantseva
6398efaba5 refactor: move fork-choice metrics to fork-choice package (#8265)
**Motivation**

Fork-choice package doesn't have its own metrics. Some fork-choice
metrics are scraped in beacon-chain through the onScrapeMetrics. This PR
is a part of metrics refactoring #7098. There is also a need to add new
fork-choice metrics for FOCIL.

**Description**

Fork-choice metrics from beacon node were moved to fork-choice package. 

Part of #7098

**Steps to test or reproduce**

Check Lodestar Grafana dashboard with this branch running.

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-09-01 12:48:28 +01:00
Nico Flaig
ac704f28d2 fix: defer common block body production until next event loop (#8285)
**Motivation**

While going through block production logs I noticed in some rare cases
we sent header requests pretty delayed into the slot, but not if you
look at our logs, it shows that header was sent at ~100ms but mev-boost
received it at ~600ms which is a huge discrepancy. When further
analysing this I noticed that ~600ms is roughtly the time we finished
producing the common block body. This means we can't really trust the
logs here as they might be emitted but the actual HTTP request is not
sent.

Since this issue is pretty rare and most of the time we sent the
requests <100ms I think it's race condition and highly depends on I/O
timing and what other async/sync load is processed.

Another interesting side effect of this is that when these huge delays
happen (up to 500ms) I also noticed that builder HTTP requests run into
the 1 second timeout even though it looks from mev-boost perspective
that response was sent within time. My guess here is that the `fetch`
implementation sets the timer and starts it but since sending the actual
HTTP requests requires to go through poll phase it might not actually
bet sent.

Long story short, we need to wait until next evet loop iteration to
ensure I/O operations are processed before starting common block body
production as it is synchronous and blocking.

**Description**

Defer call produce common block body `produceCommonBlockBody` to next
event loop by running it in `setImmediate` callback.

Previous PR https://github.com/ChainSafe/lodestar/pull/7814
2025-09-01 11:46:22 +01:00
twoeths
bfd8ee3460 fix: self rate limiter to handle dead requests (#8295)
**Motivation**

- node slow to sync due to dead requests tracked in self rate limiter

**Description**

- track request ids in self rate limiter
- if it's > 30s, it's considered dead and we remove

Closes #8263

part of #8256

**Test**

- was able to sync fusaka-devnet-3 with no selft rate limited errors
<img width="1677" height="645" alt="Screenshot 2025-08-29 at 20 38 45"
src="https://github.com/user-attachments/assets/2388639e-7232-4941-a1bf-4b9ecac55a58"
/>

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-08-29 11:50:03 -04:00
Nico Flaig
26ea9fa05b refactor: optimize event listener count checks (#8293)
## Summary

This PR optimizes event listener count checks for
`routes.events.EventType` emissions, following the principle that
**listener count checks should only be added where there's expensive
preprocessing work before emit**, since `emit()` is already a no-op when
no listeners exist.

## Changes Made

###  Added listener count checks (where expensive preprocessing
occurs):

**`packages/beacon-node/src/network/processor/gossipHandlers.ts`:**
- **`dataColumnSidecar`** emission: Added check to avoid
`kzgCommitments.map(toHex)` array mapping when no listeners

**`packages/beacon-node/src/chain/prepareNextSlot.ts`:**
- **`payloadAttributes`** emission: Added check to avoid `await
getPayloadAttributesForSSE()` async function call when no listeners

###  Removed unnecessary listener count checks (where no expensive
preprocessing occurs):

**`packages/beacon-node/src/network/processor/gossipHandlers.ts`:**
- **`blockGossip`** emission: Removed check since it only uses existing
variables `{slot, block: blockRootHex}`

**`packages/beacon-node/src/api/impl/beacon/blocks/index.ts`:**
- **`blockGossip`** emission: Removed check since it's a simple emission
with existing variables

###  Kept existing correct checks (for expensive operations):

- **`blobSidecar`** emissions: Keep checks for `toHex()` conversions and
`kzgCommitmentToVersionedHash()`
- **All loop-based emissions** in `importBlock.ts`: Keep checks for
`for` loop iterations
- **`block`** emission: Keep check for `isOptimisticBlock()` computation

## Performance Benefits

1. **Reduced CPU usage**: Expensive operations like async function calls
and array mapping only occur when needed
2. **Better resource utilization**: Memory allocations and computations
are avoided when events won't be consumed
3. **Cleaner code**: Removed redundant checks where the emit operation
itself is lightweight

## Key Principle Applied

**Only add listener count checks where there's expensive preprocessing
work before emission:**
-  Function calls, array operations, crypto operations
-  Simple emissions using existing variables

Since `emit()` is already a no-op when no listeners exist, explicit
checks are only beneficial when avoiding preprocessing overhead.

## Testing

-  Type checks pass
-  Build succeeds  
-  Linting passes

Resolves #7996

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-29 07:40:35 -04:00
Nico Flaig
74da098ba7 feat: add panels to track consensus block value (#8286)
**Motivation**

This is useful to get some insights into the quality of our produced
blocks

**Description**

Add panels to track consensus block value to block production dashboard

<img width="1895" height="295" alt="image"
src="https://github.com/user-attachments/assets/55638340-7c29-4411-9bba-d21f552a3a88"
/>
2025-08-29 08:47:59 +01:00
Nico Flaig
d368818b1e refactor: rename variables / functions related to committee vs. validator indices (#7687)
- `validatorCommitteeIndices` should be the position index in the
committee
- `committeeValidatorIndices` should be the validator indices (eg.
1063664) of the committee members

---------

Co-authored-by: NC <17676176+ensi321@users.noreply.github.com>
2025-08-28 23:46:42 -07:00
Nico Flaig
eb311a59bd chore: remove error stacktrace from peer disconnected during identify protocol logs (#8289)
**Motivation**

This log is way too verbose on devnet-3 right now
```
devops@lodestar-reth-1 ➜  ~ docker logs beacon 2>&1 | grep "Peer disconnected during identify protocol" | wc -l
113256
```

As suggested in
https://github.com/ChainSafe/lodestar/pull/8188#discussion_r2269948281
we should observe the error for a bit and it seems to be only
`unexpected end of input` which is not very useful.

**Description**


Remove error stacktrace from peer disconnected during identify protocol
logs

~~Alternative could be to add message to context or concat to the
message, open to any of these if we still think including the error
message is valuable.~~ went with still printing out the error message
2025-08-28 15:29:50 -04:00
Nazar Hussain
c9507c76b2 chore: fix broken types for datastore-level (#8287)
**Motivation**

Validate all types in Bun tuntime.

**Description**

- fix broken types for `datastore-level`

**Steps to test or reproduce**

- Run all tests
2025-08-28 11:22:46 -04:00
twoeths
2ac5250665 chore: track req/resp outgoing request error reason (#8283)
**Motivation**

- track req/resp outgoing request error by reason

**Description**

- the metric was added in #8116

<img width="835" height="609" alt="Screenshot 2025-08-28 at 15 25 59"
src="https://github.com/user-attachments/assets/92b97adc-9ae1-4ce0-a1d3-ef32378d5ee0"
/>

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
Co-authored-by: Cayman <caymannava@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-08-28 12:35:37 +00:00
twoeths
137e6eef9e fix: track execution engine getBlobs requests (#8274)
**Motivation**

- we currently track `getBlobs` request as unknown on metric

<img width="1304" height="374" alt="Screenshot 2025-08-27 at 10 39 58"
src="https://github.com/user-attachments/assets/721cd695-41e2-4e49-9225-7358acb2a6d4"
/>


**Description**

- track routeId to show them on our Grafana dashboard

part of #8271

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-08-28 09:47:11 +07:00
Nico Flaig
3f907a3346 fix: do not create data column sidecars if block has no blobs (#8277)
**Motivation**

Fix block production if block has 0 blobs

**Description**

Do not create data column sidecars if there block has no blobs and
return early in data column validation if there are no data column
sidecars to validate.


Closes https://github.com/ChainSafe/lodestar/issues/8276
2025-08-27 14:56:00 -04:00
Nico Flaig
dc288bce45 feat: score attestations for block by profitability (#8016)
Updates scoring / sorting of consolidated attestations during block
packing to follow `processAttestation` reward computation to maximize
profitability of block.


2fdd3fa446/packages/state-transition/src/block/processAttestationsAltair.ts (L33)

Closes https://github.com/ChainSafe/lodestar/issues/8019
2025-08-27 14:21:30 +01:00
twoeths
afdf325ebf feat: fromHexInto() api (#8275)
**Motivation**

- improve the time to deserialize hex, especially for getBlobsV2() where
each blob is 131kb
- if the benchmark is correct, we can expect the time to deserialize
blob hex from `332.6842 ms/op` to more or less 2ms
- will apply it for getBlobsV2() in the next PR by preallocate some
memory and reuse it for all slots

**Description**

- implement `fromHexInto()` using `String.charCodeAt()` for browser and
use that for NodeJs as well
- the Buffer/NodeJS implementation is too bad that I only maintain it in
the benchmark

**Test result on a regular lodestar node**
- `browser fromHexInto(blob)` is 1000x faster than `browser
fromHex(blob)` and >100x faster than `nodejs fromHexInto(blob) `

```
packages/utils/test/perf/bytes.test.ts
  bytes utils
    ✔ nodejs block root to RootHex using toHex                             2817687 ops/s    354.9010 ns/op        -       1324 runs  0.897 s
    ✔ nodejs block root to RootHex using toRootHex                         4369044 ops/s    228.8830 ns/op        -       1793 runs  0.902 s
    ✔ nodejs fromhex(blob)                                                3.005854 ops/s    332.6842 ms/op        -         10 runs   4.18 s
    ✔ nodejs fromHexInto(blob)                                            3.617654 ops/s    276.4222 ms/op        -         10 runs   3.36 s
    ✔ browser block root to RootHex using the deprecated toHexString       1656696 ops/s    603.6110 ns/op        -        963 runs   1.34 s
    ✔ browser block root to RootHex using toHex                            2060611 ops/s    485.2930 ns/op        -        424 runs  0.812 s
    ✔ browser block root to RootHex using toRootHex                        2320476 ops/s    430.9460 ns/op        -        889 runs  0.841 s
    ✔ browser fromHexInto(blob)                                           503.7166 ops/s    1.985243 ms/op        -         10 runs   21.9 s
    ✔ browser fromHex(blob)                                              0.5095370 ops/s    1.962566  s/op        -         10 runs   21.7 s
```

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-08-27 09:20:15 -04:00
twoeths
14a6f737fd feat: track kzg proofs verification time (#8267)
**Motivation**

- when verifying DataColumnSidecars, we track inclusion proof
verification time but not kzg proofs verification time

**Description**

- also track kzg proofs verification time

part of #8260

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-08-27 09:14:56 -04:00
Phil Ngo
44611dcdcc feat: increase target peers by default to 200 (#8272)
**Motivation**

As discussed on
https://github.com/ChainSafe/lodestar/discussions/8236#discussioncomment-14221640,
we made a decision to increase peer counts to maximize peer diversity in
anticipation of Fusaka, which may help with PeerDAS functionalities.

**Description**

This PR increases the maxPeers from 110 to 210 and targetPeers from 100
to 200. The overhead of bandwidth and computational resources are
minimal (even at 300 peers) and holding up well as seen in
https://github.com/ChainSafe/lodestar/discussions/8236#discussioncomment-14221689
and from Discord discussions here:
https://discord.com/channels/593655374469660673/1197575814494035968/1409883390995337226

Bandwidth data from @nflaig 's node:

<img width="660" height="666" alt="image"
src="https://github.com/user-attachments/assets/dc5be828-2a46-4f85-82b0-70ee271445f7"
/>
2025-08-26 18:42:04 -04:00
Nico Flaig
098ff4253f chore: remove per committee attestation routine (#8266)
**Motivation**

This code is no longer relevant for post-elecra and was previously only
used to be compatible with Charon DVT middleware, see previous PR
https://github.com/ChainSafe/lodestar/pull/5258 for reference.

**Description**

Remove per committee attestation routine

Closes https://github.com/ChainSafe/lodestar/issues/7981
2025-08-26 17:27:43 +01:00
dependabot[bot]
923176cd68 chore(deps): bump cipher-base from 1.0.4 to 1.0.6 (#8241)
Bumps [cipher-base](https://github.com/crypto-browserify/cipher-base)
from 1.0.4 to 1.0.6.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/browserify/cipher-base/blob/master/CHANGELOG.md">cipher-base's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/browserify/cipher-base/compare/v1.0.5...v1.0.6">v1.0.6</a>
- 2024-11-26</h2>
<h3>Commits</h3>
<ul>
<li>[Fix] io.js 3.0 - Node.js 5.3 typed array support <a
href="b7ddd2ac24"><code>b7ddd2a</code></a></li>
</ul>
<h2><a
href="https://github.com/browserify/cipher-base/compare/v1.0.4...v1.0.5">v1.0.5</a>
- 2024-11-17</h2>
<h3>Commits</h3>
<ul>
<li>[Tests] standard -&gt; eslint, make test dir, etc <a
href="ae02fd6624"><code>ae02fd6</code></a></li>
<li>[Tests] migrate from travis to GHA <a
href="66387d7146"><code>66387d7</code></a></li>
<li>[meta] fix package.json indentation <a
href="5c02918ac5"><code>5c02918</code></a></li>
<li>[Fix] return valid values on multi-byte-wide TypedArray input <a
href="8fd136432c"><code>8fd1364</code></a></li>
<li>[meta] add <code>auto-changelog</code> <a
href="88dc806806"><code>88dc806</code></a></li>
<li>[meta] add <code>npmignore</code> and
<code>safe-publish-latest</code> <a
href="7a137d749c"><code>7a137d7</code></a></li>
<li>Only apps should have lockfiles <a
href="42528f291d"><code>42528f2</code></a></li>
<li>[Deps] update <code>inherits</code>, <code>safe-buffer</code> <a
href="0e7a2d9a33"><code>0e7a2d9</code></a></li>
<li>[meta] add missing <code>engines.node</code> <a
href="f2dc13e47b"><code>f2dc13e</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="f5249f9461"><code>f5249f9</code></a>
v1.0.6</li>
<li><a
href="b7ddd2ac24"><code>b7ddd2a</code></a>
[Fix] io.js 3.0 - Node.js 5.3 typed array support</li>
<li><a
href="f03cebfdad"><code>f03cebf</code></a>
v1.0.5</li>
<li><a
href="88dc806806"><code>88dc806</code></a>
[meta] add <code>auto-changelog</code></li>
<li><a
href="7a137d749c"><code>7a137d7</code></a>
[meta] add <code>npmignore</code> and
<code>safe-publish-latest</code></li>
<li><a
href="5c02918ac5"><code>5c02918</code></a>
[meta] fix package.json indentation</li>
<li><a
href="8fd136432c"><code>8fd1364</code></a>
[Fix] return valid values on multi-byte-wide TypedArray input</li>
<li><a
href="66387d7146"><code>66387d7</code></a>
[Tests] migrate from travis to GHA</li>
<li><a
href="f2dc13e47b"><code>f2dc13e</code></a>
[meta] add missing <code>engines.node</code></li>
<li><a
href="0e7a2d9a33"><code>0e7a2d9</code></a>
[Deps] update <code>inherits</code>, <code>safe-buffer</code></li>
<li>Additional commits viewable in <a
href="https://github.com/crypto-browserify/cipher-base/compare/v1.0.4...v1.0.6">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a
href="https://www.npmjs.com/~ljharb">ljharb</a>, a new releaser for
cipher-base since your current version.</p>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cipher-base&package-manager=npm_and_yarn&previous-version=1.0.4&new-version=1.0.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/ChainSafe/lodestar/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-26 10:23:48 +01:00
twoeths
5a2006570a feat: unknown block sync e2e post electra only (#8245)
**Motivation**

- we want to test different sync scenarios post-electra and post-fulu so
that when we change syncing strategy, we have e2e tests to confirm it
works well

**Description**

- fix different issues in mock EL to return correct data
- e2e test to start from electra so it'll skip the "merge pow block"
logic

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-08-26 10:23:09 +01:00
Nico Flaig
d9fc7bb103 fix: move MAX_REQUEST_BLOCKS constants to config (#8262)
**Motivation**

Follow CL spec

**Description**

Move `MAX_REQUEST_BLOCKS` and `MAX_REQUEST_BLOCKS_DENEB` constants to
config

Closes https://github.com/ChainSafe/lodestar/issues/8249
2025-08-26 10:22:53 +01:00
Nazar Hussain
b9950594aa refactor: remove cpu features direct dependency (#8261)
**Motivation**

Make the code transition for compatibility with the Bun. 

**Description**

- The dependency `cpu-features` is not compatible with the `Bun`
- Removed the direct dependency
- Upgrade the `@chainsafe/persistent-merkle-tree` and `@chainsafe/ssz`
so the hasher detection is done implicitly.
- Latest commit for
[hahstree](e86a8b136a)
has the support for fallback, which is not used in the
`@chainsafe/persistent-merkle-tree`


**Steps to test or reproduce**

Run all tests
2025-08-25 17:22:23 -04:00
Nico Flaig
cc8c1ac67e feat: print out blob parameters if BPO fork is activated (#8253)
**Motivation**

We currently don't print out the current blob limit anywhere but it
would be good to know for debugging and just to inform the user if a BPO
is activated and what are the new blob parameters.

**Description**

Print out blob parameters if BPO fork is activated

---------

Co-authored-by: NC <17676176+ensi321@users.noreply.github.com>
2025-08-25 07:16:36 -04:00
twoeths
58a8297a16 chore: track DataColumnSidecar errors on Grafana (#8259)
**Motivation**

- from fulu, DataColumnSidecar validation is important so we need to
track it for investigation if any

**Description**

<img width="1306" height="379" alt="Screenshot 2025-08-25 at 14 12 11"
src="https://github.com/user-attachments/assets/d0474185-59c8-4d37-a088-ea8f484fee71"
/>

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-08-25 07:14:51 -04:00
Nico Flaig
2695c34c0a fix: select correct ssz type when persisting invalid attestations (#8257)
**Motivation**

See
https://github.com/ChainSafe/lodestar/issues/7977#issuecomment-3216215593

**Description**

Select correct `SingleAttestation` type based on fork instead of hard
coding it to `phase0.Attestation`

Closes https://github.com/ChainSafe/lodestar/issues/7977
2025-08-25 09:35:43 +01:00
Nico Flaig
9ed8317064 chore: remove skipped fulu constants in config test (#8252) 2025-08-22 12:50:27 -07:00