**Motivation**
Make the types exports consistent for all packages.
All modern runtimes support [conditional
exports](https://nodejs.org/api/packages.html#conditional-exports) and
there are caveats when we have both conditional exports and normal
exports present in a package.json. This PR tend to make all exports
follow same consistent and modern pattern.
**Description**
- We were using subpath exports for some packages and module exports for
other
- Keep all the types export consistent as subpath exports.
- Remove "types" and "exports` directive from package.json
- Remove `typesVersions`, this is useful only if we have different
version of types for different versions of Typescript. Or having
different types files for different file paths.
**Steps to test or reproduce**
- Run all CI
Follow up on https://github.com/ChainSafe/lodestar/pull/8091 to clean up
remaining usage of `SECONDS_PER_SLOT`.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
**Motivation**
- #7280
**Description**
- update `@types/node` to the latest node v22 version
- add `@lodestar/bun` dependency using git+https (for now! so that we
don't have to republish a bazillion times)
- keep in mind that this requires a manual build/rebuild of the so (via
`cd node_modules/@lodestar/bun && zig build`)
- Add a bun-specific `LevelDbController` which uses
[`@lodestar/bun`](https://github.com/ChainSafe/lodestar-bun)
- Only expose the leveldb controller via a subpath export (and for
tests, as a custom import, like in #8320 )
- add bun bun global override types
**Motivation**
Add `src` directory to package sources along with the `lib` files to
have working source map.
**Description**
- Add `src` to the files.
**Steps to test or reproduce**
- Run all tests
**Motivation**
- #7280
**Description**
- Add `"bun"` export to all packages that points to the _typescript
source_ rather than the transpiled javascript
- Allows for bun to use typescript directly
**Motivation**
Enable the organize import back which was disabled in #7982 to isolate
the changes for import ordering
**Description**
- Update the organize import config
- Fix all linting errors
**Steps to test or reproduce**
- Run all tests
---------
Co-authored-by: Cayman <caymannava@gmail.com>
**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
**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>
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.
**Motivation**
There was an [issue on fusaka-devnet-3 builder
flow](https://discord.com/channels/595666850260713488/1399324773758140426)
due to failed validator registrations. The problem was that we already
sent validator registrations pre-genesis and unless the registration
data (fee recipient and gas limit) changes we will keep sending the
cached registration data (as per
https://github.com/ChainSafe/lodestar/pull/4447) which reuses the
previous timestamp. Why this is problematic is because mev-relay will
reject those registrations if [timestamp is before genesis
time](344d5b67d5/services/api/service.go (L2903))
so it will keep rejecting them until we restart the validator client or
change registration data to clear the cache.
**Description**
Don't send validator registrations pre-genesis, ie. only start sending
and caching them once we are in epoch 0. This matches the behavior of
Prysm (see https://github.com/OffchainLabs/prysm/pull/12847) which has
been there for a while. The only downside I can see is that in epoch 0
we might not be able to produce builder blocks in the first few slots
but that is really only relevant for devnets or local kurtosis runs but
either way since mev-relay rejects the registrations anyways there is
not much we can do in that case.
**Motivation**
Make our codebase compatible with Bun runtime
**Description**
- Configure Vitest to work along Bun
- Add CI workflow to test Unit tests for Bun
**Steps to test or reproduce**
Run all tests
**Motivation**
Fix for DVs post-electra.
**Description**
Previously from Obol we have required to disable the optimization of
Lodestar that skipped asking for a `committee_index`, because we needed
it for DVs. However, post-electra the `committee_index` should be 0 per
the spec.
**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
**Motivation**
Follow up to https://github.com/ChainSafe/lodestar/pull/7729, we need to
handle blob schedule separately from generic string comparison of
values, otherwise what we compare are shallow stringified arrays. It
does not validate the object properties and on length mismatch we just
get the following error
```
✖ Error: Local and remote configs are different
BLOB_SCHEDULE different value: [object object] != [object object],[object object]
```
**Description**
Add special handling for blob schedule when asserting equal params
- deserialize and sort blob schedules
- compare length of local and remote blob schedule
- then check each entry by comparing `EPOCH` and `MAX_BLOBS_PER_BLOCK`
**Motivation**
Get rid of dead code, improve code clarity, no more unused imports
**Description**
Add tsconfig to detect unused imports, variables, and functions
**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>
**Motivation**
This PR is to update specification references for new Beacon APIs
(v3.1.0) and Consensus specs (v2.5.0) released post-Electra.
**Description**
Closes https://github.com/ChainSafe/lodestar/issues/7463
Follow up to https://github.com/ChainSafe/lodestar/pull/7610 with a few
restructuring suggestions, see comments below for detailed changes,
revives constants tests we are no longer running in CI and makes each
package executable separately again, ie. `cd packages/<package-name>`
into `yarn test:unit` works for all packages again.
One major change is that unit tests default should be written with
`mainnet` preset in mind as I noticed that makes a lot more sense for a
bunch of existing tests, eg. we have tests that depend on external
fixtures, like api spec tests for events and those are not compatible
with `minimal` preset. Also there doesn't seem to be much downside in
most cases for unit tests to use `mainnet` preset as it does not run
through all the epoch, like for example a e2e or sim test does. So
overall, it allows us to use mainnet fixtures / more "real world" data
which seems better with little to no downside.
Time comparison running unit tests on `unstable` vs. this branch
**unstable**

**nflaig/restructure-tests**

There is just a difference of 2 seconds (might be a fluke) in a 6 minute
run, this seems acceptable to me considering the benefits of using
`mainnet` preset noted above.
**Motivation**
Remove any unused or inactive codebase.
**Description**
Remove all unused eslint directives as we are using `biome` now.
**Steps to test or reproduce**
Run lint rules and all tests