885 Commits

Author SHA1 Message Date
Phil Ngo
c4ab7f0100 fix: bump discv5 to 11.0.4 (#8365)
**Motivation**

Users reported in the v1.34.0 release that changes in the release
created an issue when ipv6 and ipv4 ports were the same:

```
✖ Error: Timeout: Did not receive an init message from worker after 300000ms. Make sure the worker calls expose().
```

**Description**

This PR bumps discv5 from 11.0.3 to 11.0.4 which includes the fix to
binding ipv4 and ipv6 on the same port in dual stack mode.
See: https://github.com/ChainSafe/discv5/pull/318
2025-09-10 16:35:24 -04:00
Phil Ngo
86490969b7 chore: bump package versions to 1.34.1 2025-09-10 16:34:42 -04:00
Phil Ngo
1a17514b02 chore: bump package versions to 1.34.0 2025-09-05 12:24:08 -04: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
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
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
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
c1c459466f chore: move peer id file error due to file not found to debug (#8230)
**Motivation**

This log is currently always emitted if a user starts the node for the
first time or when upgrading to next release since we now have
`persistNetworkIdentity` set to `true` by default. Hence I think a
warning is not the right log level here.

**Description**

Move peer id file error due to file not found to `debug`

~~Alternative could be to differentiate error, ie. still log errors
other than file not found (`ENOENT`) as warn but seems unlikely that if
file exists we will fail here.~~ went with this approach now
2025-08-21 07:42:46 -04:00
NC
d4bbdc590b test: error from sim test is swallowed in tableReporter (#8223)
Errors from sim tests are swallowed because `TableReporter.summary()` is
not working as intended eg.
https://github.com/ChainSafe/lodestar/actions/runs/17056864174/job/48356128796?pr=8091

`arrayGroupBy` will always output empty object because
`acc[predicate(value, index, array)]` is always undefined and the bucket
is never initialized.
2025-08-19 17:34:22 -04:00
Nico Flaig
1968319c71 fix: move fulu constants to preset/config to be spec compliant (#8217)
**Motivation**

We are missing a few spec constants from our config. This causes issues
with Dora as noted in https://github.com/ChainSafe/lodestar/pull/8053
and also means it is not possible to configure the values of those
constants at runtime.

**Description**

Move constants to preset/config to be spec compliant

Closes https://github.com/ChainSafe/lodestar/issues/8109
2025-08-18 09:43:14 -04:00
Cayman
ece38879ec refactor: block proposal cleanup (#8155)
**Motivation**

- address
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2255325445

**Description**

Our block production and publishing data flow was messy. The data types
and utility functions are jumbled, duplicate functions, differences from
spec functions, etc. To that end, this refactors things that touch this
proposal data flow.

- Tweak the fork-agnostic `BlockContents` type to also include pre-deneb
`BeaconBlock`
  - this allows us to remove `BlockOrContents` variables and types
- Remove `Contents` (It isn't actually needed)
- Collect all `produced*` caches into `blockProductionCache`
- make blinded block reconstruction more typesafe
- Separate blobs+proofs sanity validation from cells+proof sanity
validation
- Delete duplicated `BlobsBundle` type
- Remove duplicate spec function `computeDataColumnSidecars` in favor of
`getDataColumnSidecars*` functions
- Refactor `computeBlobSidecars` into `getBlobSidecars` from the spec

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-08-15 07:31:18 -04:00
Nico Flaig
7d02789d1b feat: stricter builder circuit breaker (#8205)
**Motivation**

- Closes https://github.com/ChainSafe/lodestar/issues/7802

**Description**

- makes builder circuit breaker stricter, from previous 50% of blocks
missed down to 25%
- differentiate builder disabled due to failed status check vs. circuit
breaker activated
- updating wording in logs/errors `Execution builder` --> `External
builder`
2025-08-14 12:11:51 -04:00
Cayman
b42f83b4e0 fix: support dual stack on same port (#8190)
**Motivation**

- Resolve https://github.com/ChainSafe/lodestar/issues/7116
- Resolve https://github.com/ChainSafe/lodestar/issues/6531

**Description**

- Update discv5 dependency
(https://github.com/ChainSafe/discv5/pull/316)
- default to using the same port for ipv4 and ipv6
2025-08-13 11:50:23 -04:00
Nico Flaig
d5be46d90d test: disable DEBUG logs by default when running sim tests (#8186)
**Motivation**

Sim test debug logs are way too verbose by default. We don't run mainnet
nodes with `DEBUG` set unless we wanna investigate a specific issue,
should take the same approach in sim tests.

**Description**

Disable `DEBUG` logs by default when running sim tests
2025-08-12 12:00:10 +01:00
Cayman
aac4d9d864 Merge branch 'peerDAS' into unstable 2025-08-11 13:40:27 -04:00
Matthew Keil
da2490329b docs: add note to --persistNetworkIdentity for resetting ENR and cgc (#8159)
**Motivation**

Addresses peerDAS  PR comment
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2260457601

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-08-10 11:51:26 +01:00
NC
60e037958a fix: peer id check in initPrivateKeyAndEnr (#8165)
Closes #8151
2025-08-09 11:28:05 -07:00
Cayman
a862fa13b1 chore: refactor custody config initialization (#8126)
**Motivation**

- https://github.com/ChainSafe/lodestar/issues/8097
- supersedes https://github.com/ChainSafe/lodestar/pull/8112

**Description**

- remove metrics from `CustodyConfig`. Instead, do metrics in
`BeaconChain` (set on initialization, set on update)
- add `initialCustodyGroupCount` opt that gets set at the CLI layer by
"doing the right thing" - comparing opts.supernode, the stored enr
value, and the config value.
- thread `initialCustodyGroupCount` thru the application
- update all `CustodyConfig` construction sites
2025-08-07 09:24:31 -04:00
Matthew Keil
16e67f1abb refactor: remove stale peerdas lines and simple renamings (#8128)
**Motivation**

Addresses peerDAS PR comments:
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257229278
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257338920
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257407418
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257446878
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257447873
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257449151
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257452649
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257478150
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257521819
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257538460
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257581915
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257622328
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257624129
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257627278
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257764440
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257785089
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257789419
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257796643
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257299001
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257629226
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257635073
https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257645004
2025-08-06 21:35:47 -04:00
Cayman
b27b0ca402 fix: restore chain.archiveBlobEpochs cli flag (#8129)
**Motivation**

- https://github.com/ChainSafe/lodestar/pull/6353#discussion_r2257787139

**Description**

- add alias to old (pre-peerDAS) cli flag

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-08-06 17:05:06 -04:00
Nico Flaig
5bc821a090 fix: remove node custody requirement (#8099)
This removes `NODE_CUSTODY_REQUIREMENT` config value as it doesn't seem
to be part of the spec. It seems like the purpose of this config right
now is to be able to pass down supernode requirements (ie. setting
requirement to 128) and potentially allow to override the custody
requirement for testing but this is a misuse how config should be
handled.

As discussed with @matthewkeil we don't need to manually set node
custody requirement or disable validator custody anymore and rather just
rely on `--supernode` flag to custody all groups or dynamic validator
custody.
2025-08-04 02:32:32 -04:00
Phil Ngo
7afce97ce3 chore: bump package versions to 1.33.0 2025-07-31 15:05:32 -04:00
Nico Flaig
e03bda542e Merge branch 'unstable' into peerDAS 2025-07-23 13:51:07 +01:00
Nico Flaig
68e406de61 fix: only check genesis state root if network is specified (#8074)
**Motivation**

Noticed https://github.com/ChainSafe/lodestar/pull/7841 breaks kurtosis
runs as we check against mainnet genesis state root as it's the
`defaultNetwork`.

**Description**

Only check genesis state root if network is specified, since this isn't
really relevant for mainnet anyways and just new networks that are
launched it doesn't really make a difference as in those cases we
explicitly need to set `--network` and genesis state root check will be
done.
2025-07-22 18:43:21 +00:00
Vedant Asati
2623fd44f9 feat: add genesis state root integrity validation (#7841)
#**Motivation**
This PR adds validation of genesis state roots when initializing the
beacon node from a downloaded genesis state file. This helps ensure node
operators are working with the correct genesis state and can detect
potential tampering or misconfigurations. This validation is
particularly useful during testnet launches and provides an important
security check.

**Description**
Implements validation of genesis state root against expected values in
the network configuration.

Changes:
- Added `getGenesisStateRoot()` utility function to retrieve expected
roots for networks
- Added `genesisStateRoot` configuration property to all network files
(with initial value known only for hoodi testnet)
- Added validation logic that computes the hash tree root of downloaded
genesis state and compares against expected `genesisStateRoot`

Closes #7601

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-07-22 15:03:01 +00:00
Nico Flaig
5a2cffc7e5 Merge branch 'unstable' into nflaig/merge-unstable-jul17 2025-07-17 12:18:45 +01:00
Phil Ngo
36dbfb2cfe chore: bump package versions to 1.32.0 2025-07-09 14:35:57 -04:00
twoeths
498123da6e fix: remove only connect flags (#8046)
**Motivation**

- `onlyConnect*` flags are not (and should not) used anymore so we
should remove it to reduce maintenance cost

cc @matthewkeil

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
2025-07-09 10:11:49 -04:00
Nico Flaig
d9dc44442e feat: increase default gas limit to 45M (#8024)
**Motivation**

From https://x.com/vdWijden/status/1939234101631856969
> Over the last couple of days, all major
[@ethereum](https://x.com/ethereum) clients signalled that they consider
a move to 45M gas per block safe.

We should make it easy for users and just bump the default. 45M seems
like a reasonable increase for now.

**Description**

Increase default gas limit to 45M

Same as https://github.com/ChainSafe/lodestar/pull/7304
2025-07-01 10:55:03 -04:00
Nico Flaig
9f30766ff4 Merge branch 'unstable' into nflaig/peerDAS-merge-unstable-23-june 2025-06-23 16:22:30 +02:00
Mohammad Kermani
db77aaa8b6 feat: persist orphaned blocks to disk (#7946)
**Description**
Add two new options to persist orphaned blocks to disk:
- chain.persistOrphanedBlocks
- chain.persistOrphanedBlocksDir

Closes #4066

Please note that I couldn't test it because it requires running a node
receiving blocks that become orphaned after a while, and it's beyond my
current understanding of the repo.

---------

Co-authored-by: Cayman <caymannava@gmail.com>
2025-06-23 05:18:12 -04:00
Nico Flaig
4a12abd772 feat: switch to rust kzg for async proof verification (#7989)
**Motivation**

Bring changes from https://github.com/ChainSafe/lodestar/pull/7936 to
unstable branch.

**Description**

- deneb relevant changes from
https://github.com/ChainSafe/lodestar/pull/7936
- remove `--chain.trustedSetup` flag as file is part of kzg library now
- remove trusted setup files

Closes https://github.com/ChainSafe/lodestar/issues/7970
2025-06-23 04:08:07 -04:00
Cayman
0536c19e44 feat: async kzg proof verification (#7936)
**Motivation**

- kzg proof verification is expensive, shouldn't be hogging the main
thread

**Description**

- use https://github.com/crate-crypto/rust-eth-kzg instead of c-kzg
- update verification functions to async variants
2025-06-10 09:50:41 +07:00
Nico Flaig
c530895658 Merge branch 'unstable' into peerDAS 2025-06-09 21:04:53 +01:00
Phil Ngo
672665e350 chore: change remaining package licenses from LGPL-v3 to Apache-2.0 (#7915)
**Motivation**

Discussions were previously ongoing to make our entire monorepo and
packages within Apache-2.0 license. The only remaining packages which
were previously under LGPL-v3 were the beacon node, cli, validator
packages.

**Description**

This PR marks the switch for all packages in the Lodestar monorepository
to be under one license, Apache-2.0 of which the majority of consensus
clients have adopted. This PR:

- Removes any instance of LGPLv3
- Switches all LICENSE to adopt Apache-2.0
- Removes CLA bot signing as part of our contribution.md
2025-06-05 08:13:18 -04:00
Phil Ngo
8847b4a92b chore: bump package versions to 1.31.0 2025-06-03 14:16:18 -04:00
matthewkeil
29ce8f9467 Merge branch 'unstable' into mkeil/merge-unstable-to-peerDAS-june3 2025-06-03 22:45:40 +07:00
twoeths
141ab3625a fix: do not throw error for non-hashtree hashers (#7896)
**Motivation**

- do not throw error for as-sha256 hasher, an addition to #7887

**Description**

- `log.warn` instead of throwing error

may want @KatyaRyazantseva to give it a try on her laptop

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-06-03 15:10:30 +01:00
Matthew Keil
9f5ab00bab fix: remove arm check (#7897)
**Motivation**

Removes check for arm for mac compatibility.  
Removes log statement because the log happens in #7896
2025-06-01 23:51:37 -04:00
Cayman
b819263288 chore: bump ssz to v1.2.1 (#7894)
**Motivation**

- chainsafe/ssz#489

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-05-30 16:03:33 +00:00
Matthew Keil
065cb80811 fix: avx check in conditional (#7893)
**Motivation**

Fix check for AVX conditional.  Needs to follow what was done in:
https://github.com/OffchainLabs/hashtree/blob/main/bindings_amd64.go

Original PR just looked at the hashtree bindings here:
https://github.com/OffchainLabs/hashtree/blob/main/src/hashtree.c#L42
2025-05-30 15:57:42 +01:00
Matthew Keil
b3a6f4660e fix: default to as-sha256 if no chip support for AVX (#7887)
**Motivation**

A crash was reported by several parties running Lodestar on a VPS. The
problem was tracked down to no AVX support on the host which causes
OffchainLabs/hashtree to crash. The go binding do a similar check, at
the bindings level, and revert to a non-assembly SHA256 lib. This PR
does the same. Checks the hardware for the supported AVX types and
returns `as-sha256` hasher from the `hashtree` hasher so there is no
crash.



67979dccfc/src/hashtree.c (L53-L67)
2025-05-30 09:02:12 -04:00
Nico Flaig
fa41ea44de chore: bump @chainsafe/threads to v1.11.2 (#7877)
**Motivation**
- https://github.com/ChainSafe/lodestar/issues/5552 is still an issue

**Description**

- Includes https://github.com/ChainSafe/threads.js/pull/4 to get rid of
`MaxListenersExceededWarning`
2025-05-27 08:41:33 -04:00
Nico Flaig
4722be107d Merge branch 'unstable' into te/peerDAS_merge_unstable_may_14 2025-05-21 12:13:18 +01:00
Tuyen Nguyen
30400be52e fix: lint 2025-05-14 17:07:32 +07:00
Tuyen Nguyen
d4d0bc5b47 Merge remote-tracking branch 'origin/unstable' into te/peerDAS_merge_unstable_may_14 2025-05-14 16:54:21 +07:00
Phil Ngo
123eb2d9fb chore: bump package versions to 1.30.0 2025-05-09 12:15:00 -04:00
Nico Flaig
0f30a6d7d6 chore: add tsconfig to detect unused imports, variables, and functions (#7759)
**Motivation**

Get rid of dead code, improve code clarity, no more unused imports

**Description**

Add tsconfig to detect unused imports, variables, and functions
2025-05-08 19:44:35 +01:00
Matthew Keil
9c538e3a8f feat: make aggregate with randomness async again (#7761)
**Motivation**

Gnosis analysis shows that there is a lot of time spent on main thread
for running aggregateWithRandomness on main thread. Now that libp2p@v2
is more stable and so are some of the other conditions that triggered
our revert last time, looking to check this again to see what the
metrics look like for running not on main thread.

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-05-08 13:08:58 -04:00
Nico Flaig
6324a39d74 feat: make serving historical state opt-in (#7799)
**Motivation**

Based on concerns raised by @twoeths in
https://github.com/ChainSafe/lodestar/pull/7781#issuecomment-2849856198
we decided to put historical state regen (which triggers `loadState` in
certain cases) behind a feature flag as it may affect validator
performance and users should be aware of it when using the feature, the
primary use case for it anyways is for users that need a RPC node to
query this data, not operators that use Lodestar as their staking node
with attached validators.

**Description**

Make serving historical state opt-in
- adds new flag `--serveHistoricalState`
- only enables `HistoricalStateRegen` if flag is set
- throws error if data that requires historical state regen is fetched

**Open question:** do we want to add a check to each `loadState` call
specifically or inside `loadState` function itself? practically this
code path is only triggered if we return state as `Uint8Array` which
implies that it must be historically generated but this is no longer
possible without setting `--serveHistoricalState` flag after this PR.


d85e73aa12/packages/state-transition/src/util/loadState/loadState.ts (L20)
2025-05-07 20:32:00 +01:00