14 Commits

Author SHA1 Message Date
Nazar Hussain
f0ce024c1a test: update to vitest 4 to use builtin bun support (#8599)
**Motivation**

Update the vitest to avoid using third party test pool. 

**Description**

- Use latest vitest
- Remove custom process pool which we developed to run our tests in Bun
runtime
- Migrate test configs to latest version
- Update types
- Switch to playwright from webdriverio for browser tests performance,
which was due for long.


**Steps to test or reproduce**

- Run all tests
2025-11-06 10:43:41 -05:00
Cayman
52be14b24f feat: use snappy from lodestar-bun (#8557)
**Motivation**

- #7280 

**Description**

- Use lodestar-bun's snappy when possible
- nodejs snappy usage unaffected
- revive benchmarks from #7451 
```
  network / gossip / snappy
    compress
      ✔ 100 bytes - compress - snappyjs                                     904194.3 ops/s    1.105957 us/op   x0.973        249 runs  0.807 s
      ✔ 100 bytes - compress - snappy                                        1033261 ops/s    967.8100 ns/op   x0.990        271 runs  0.812 s
      ✔ 100 bytes - compress - #snappy                                       1380371 ops/s    724.4430 ns/op        -        352 runs  0.808 s
      ✔ 200 bytes - compress - snappyjs                                     634155.6 ops/s    1.576900 us/op   x0.991        171 runs  0.806 s
      ✔ 200 bytes - compress - snappy                                       901956.4 ops/s    1.108701 us/op   x1.010        301 runs  0.913 s
      ✔ 200 bytes - compress - #snappy                                       1202879 ops/s    831.3390 ns/op        -        295 runs  0.805 s
      ✔ 300 bytes - compress - snappyjs                                     509230.6 ops/s    1.963747 us/op   x1.006        140 runs  0.814 s
      ✔ 300 bytes - compress - snappy                                       843395.0 ops/s    1.185684 us/op   x1.009        216 runs  0.808 s
      ✔ 300 bytes - compress - #snappy                                       1052744 ops/s    949.8990 ns/op        -        268 runs  0.808 s
      ✔ 400 bytes - compress - snappyjs                                     449093.7 ops/s    2.226707 us/op   x0.984        121 runs  0.808 s
      ✔ 400 bytes - compress - snappy                                       782524.0 ops/s    1.277916 us/op   x1.015        206 runs  0.807 s
      ✔ 400 bytes - compress - #snappy                                       1008783 ops/s    991.2930 ns/op        -        250 runs  0.806 s
      ✔ 500 bytes - compress - snappyjs                                     390406.2 ops/s    2.561435 us/op   x0.991        107 runs  0.814 s
      ✔ 500 bytes - compress - snappy                                       733727.9 ops/s    1.362903 us/op   x1.000        187 runs  0.806 s
      ✔ 500 bytes - compress - #snappy                                      922128.1 ops/s    1.084448 us/op        -        222 runs  0.805 s
      ✔ 1000 bytes - compress - snappyjs                                    262729.3 ops/s    3.806199 us/op   x0.990         73 runs  0.813 s
      ✔ 1000 bytes - compress - snappy                                      544451.8 ops/s    1.836710 us/op   x0.998        144 runs  0.809 s
      ✔ 1000 bytes - compress - #snappy                                     765966.6 ops/s    1.305540 us/op        -        180 runs  0.814 s
      ✔ 10000 bytes - compress - snappyjs                                   19414.94 ops/s    51.50673 us/op   x1.131         11 runs   1.15 s
      ✔ 10000 bytes - compress - snappy                                     99177.41 ops/s    10.08294 us/op   x1.001         30 runs  0.835 s
      ✔ 10000 bytes - compress - #snappy                                    169126.1 ops/s    5.912749 us/op        -         52 runs  0.812 s
    uncompress
      ✔ 100 bytes - uncompress - snappyjs                                    6471152 ops/s    154.5320 ns/op   x0.984       1789 runs  0.488 s
      ✔ 100 bytes - uncompress - snappy                                      1250499 ops/s    799.6810 ns/op   x0.995        318 runs  0.805 s
      ✔ 100 bytes - uncompress - #snappy                                     4245942 ops/s    235.5190 ns/op        -        797 runs  0.502 s
      ✔ 200 bytes - uncompress - snappyjs                                    4229761 ops/s    236.4200 ns/op   x1.039       1188 runs  0.574 s
      ✔ 200 bytes - uncompress - snappy                                      1136787 ops/s    879.6720 ns/op   x0.997        293 runs  0.808 s
      ✔ 200 bytes - uncompress - #snappy                                     3771208 ops/s    265.1670 ns/op        -       1036 runs  0.608 s
      ✔ 300 bytes - uncompress - snappyjs                                    3219865 ops/s    310.5720 ns/op   x1.028        612 runs  0.560 s
      ✔ 300 bytes - uncompress - snappy                                      1046605 ops/s    955.4700 ns/op   x1.006        260 runs  0.806 s
      ✔ 300 bytes - uncompress - #snappy                                     3654276 ops/s    273.6520 ns/op        -        994 runs  0.631 s
      ✔ 400 bytes - uncompress - snappyjs                                    2623625 ops/s    381.1520 ns/op   x1.018        489 runs  0.627 s
      ✔ 400 bytes - uncompress - snappy                                     946192.0 ops/s    1.056868 us/op   x1.028        158 runs  0.705 s
      ✔ 400 bytes - uncompress - #snappy                                     3627697 ops/s    275.6570 ns/op        -        950 runs  0.630 s
      ✔ 500 bytes - uncompress - snappyjs                                    2177672 ops/s    459.2060 ns/op   x1.011        611 runs  0.800 s
      ✔ 500 bytes - uncompress - snappy                                     917029.0 ops/s    1.090478 us/op   x0.995        235 runs  0.813 s
      ✔ 500 bytes - uncompress - #snappy                                     3482779 ops/s    287.1270 ns/op        -        902 runs  0.656 s
      ✔ 1000 bytes - uncompress - snappyjs                                   1178109 ops/s    848.8180 ns/op   x0.992        221 runs  0.706 s
      ✔ 1000 bytes - uncompress - snappy                                    695356.6 ops/s    1.438111 us/op   x0.991        170 runs  0.811 s
      ✔ 1000 bytes - uncompress - #snappy                                    2737986 ops/s    365.2320 ns/op        -        685 runs  0.760 s
      ✔ 10000 bytes - uncompress - snappyjs                                 115614.7 ops/s    8.649418 us/op   x1.002         25 runs  0.722 s
      ✔ 10000 bytes - uncompress - snappy                                   114448.8 ops/s    8.737535 us/op   x1.006         23 runs  0.738 s
      ✔ 10000 bytes - uncompress - #snappy                                  436138.4 ops/s    2.292850 us/op        -        134 runs  0.812 s
```

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-10-23 09:03:41 -04:00
Cayman
ba92bd8a88 feat: add lodestar-bun and bun leveldb binding (#8462)
**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
2025-09-25 09:23:11 -04:00
Nazar Hussain
0c6f50771f chore: use latest TS module resolution (#8419)
**Motivation**

Use latest `module` and `moduleResolution` for TS.

**Description**

- To use [subpath
imports](https://nodejs.org/api/packages.html#subpath-imports) in the PR
#8320 we need to update the module solution strategy for TS.
- That requires to change the `module` for the TS as well. 
- Earlier tried to stay with `node18` or `node20`, but the `ts-node`
does not work with that.
- Maintaining different tsconfig for ts-node is more of hassle on wrong
run.
- So decided to stick with `nodenext` strategy for `moduleResolution` 

**Steps to test or reproduce**

Run all tests

---------

Co-authored-by: Cayman <caymannava@gmail.com>
2025-09-18 11:36:48 -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
NC
1fae9689dc Fix typo 2024-11-17 12:13:51 +07:00
Nazar Hussain
5c359f92dc deps: migrate to biomejs from eslint (#7108)
* Replace eslint with biomejs

* Update the inclusion of word

* Fix the formatting

* Update the lint task to do all checks

* Update biome rules from eslint config

* Replace eslint with biomejs

* Update the inclusion of word

* Fix the formatting

* Update the lint task to do all checks

* Update biome rules from eslint config

* Fix all lint issues

* Fix formatting

* Add extension recomendation for vscode

* Enable recommended rules

* Enable rule noUselessSwitchCase

* Enable rule noUselessConstructor

* Fix the types

* Fix unit tests

* Enforce import extensions

* Update the cli command

* Enforce useConsistentMemberAccessibility

* Update rules

* Fix rules

* Upgrade biomejs to latest version

* Update the rules

* Update and format the config file

* Fix types break during merge

* Fix unused check

* Add comment for explicit-return-type

* Remove eslint file

* Add _e objects for empty catch blocks

* Update formatter config

* Fix formatting
2024-10-10 12:43:36 -04:00
Nazar Hussain
7b6e3f7d69 test: migrate fork-choice unit tests to vitest (#6216)
* Migrate fork-choice unit tests to vitest

* Fix the assertion messages

* Update packages/fork-choice/test/unit/protoArray/computeDeltas.test.ts

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

* Fix assertion message

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2023-12-21 21:30:02 +01:00
Nazar Hussain
53378e1e08 test(prover): move tests for prover to vitest (#6074)
* Automatic assertion migration

* Fix some left over assertions

* Remove sinon

* Add config files

* Move browser tests to vitest

* Fix browser tests

* Add a skip lib check for now

* Fix the spellings

* Fix deprecated flags

* Fix types

* Update the script tasks

* Fix the e2e tests

* Fix e2e tests

* Update webdriverio to fix browser installtion issue

* Fix the vitest config

* Add a peer dependency

* Add vite resolution

* Add a manual install for browsers

* Update packages to support additional browser options

* Update the resolutions

* Add resolutions to fix dependencies

* Update the yarn linter script

* Add sigfault handler

* Rebuild native modules with debug flag

* Update depedencies

* Update e2e tests

* Update dependencies

* Add browser capabilities

* Revert a whitespace change

* Remove segfault handler

* Remove native dep for lightclient

* Add debug flag to introspect error

* Rename a file

* Upgrade the vitest package

* Fix the regressions introduced in vitest 1 >

* Revert the regression of vitest 1.0.1

* Clean dependencies

* Update multiple fork fix

* Add dependency fix

* Fix broken singleThread option for e2e
2023-12-08 10:30:08 +01:00
Nazar Hussain
c06f4e5e01 test: move mocha to vitest for beacon-node change (#6028)
* Add jest dependencies

* Convert beacon node unit tests to jest

* Convert all beacon unit tests to vitest

* Update dependencies

* Move all e2e tests to vitest

* Fix http but which was causing abort to not work

* Update the e2e script for the beacon-node

* Fix the e2e tests

* Update yarn dependencies

* Remove .only filter

* Fix lint and type errors

* Made close callbacks async

* Fix the test path

* Fix order of resource cleanup

* Fix the peer manager for agent version

* Fix failing unit test

* Update e2e workflow

* Add code coverage support for vitest

* Match the code coverage configuration to previous nyc config

* Fix the formatting for easy code review

* Add custom error messages to extremely confusing assertions

* Add custom matcher support in the vitest

* Update code with feedback
2023-10-13 15:13:31 +02:00
Cayman
7280234bea deps: update libp2p to 0.45.x (#5506)
* deps: update libp2p

* Fix libp2p components

* Fix e2e tests

* fix merge error

* chore: bump libp2p to 0.45.6

* chore: fix yarn lock

* Update to gossipsub 9.0.0

* Fix linter error

* Rely entirely on lodestar's peer manager to prune connections

* Update libp2p and gossipsub

* Remove unused Libp2pEvent members
2023-07-05 08:37:44 +07:00
Cayman
61c838b84f fix: simplify snappy frame encoding (#5617)
* fix: simplify snappy frame encoding

* fix e2e tests
2023-06-20 11:48:13 -04:00
Cayman
c2377f2de1 Update libp2p to ESM version (#4114)
* WIP

* Revert eslint changes

* Revert dependency update

* Revert dependencies

* Revert yarn.lock

* Update yarn.lock

* Update noise

* Fix lint errors

* Update discv5

* Fix linter errors

* Fix check-types

* Fix up libp2p connection manager handling

* Update gossipsub

* Add import statement

* Use upstream GossipsubEvents type

* Remove stray lint disable comment

* Only ping a single peer when it connects

* Update gossipsub

* libp2p-gossipsub 3.5.0

* Use libp2p-noise 7.0.3

* Use @libp2p/mplex 4.0.3

* Fix write heap dump in libp2p esm branch (#4387)

* Remove 'require' check in writeHeapDump

* Fix BELLATRIX_FORK_EPOCH

* Update libp2p dependencies

* Bump libp2p

* Fix heap memory issue

* Fix some tests

* Fix type error

* Fix req/resp 'index out of bounds' issue

* Fix linter errors

* Add libp2p metrics and dashboard

* Update gossipsub and set max outbound buffer size

* Update @libp2p/tcp

* Update uint8arrays

* v0.0.0

* Lint libp2p grafana dashboard

* Add leveldown dev dependency

* Set msgIdToStrFn to Buffer.toString

* Do not set udp to enr (#4591)

* Fix e2e reqresp test

* Fix lint

* Fix unit tests

* Update yarn.lock after merge

* Update libp2p

Co-authored-by: Tuyen Nguyen <vutuyen2636@gmail.com>
Co-authored-by: tuyennhv <tuyen@chainsafe.io>
2022-09-27 12:56:01 -05:00
Lion - dapplion
157693a428 Move types dir to root (#4216)
* Move types dir to root

* Update types location in root
2022-06-28 21:35:58 +02:00