Commit Graph

81 Commits

Author SHA1 Message Date
guha-rahul
4584616eeb feat: add Era File Reading and Writing (#8035)
**Motivation**

- tracks #7048 
-
[era](https://github.com/eth-clients/e2store-format-specs/blob/main/formats/era.md)
specs.

**Description**

- Adds functionality to read/write to
[e2s](613f4a9a50/docs/e2store.md (era-files))
files
```ts
import {open} from "node:fs/promises";
import {e2s} from "@lodestar/era";

const fh = await open("mainnet-xxxxxx-xxxxxxxx.era");
const entry = await e2s.readEntry(fh, 0);
entry.type == e2s.EntryType.Version
```
- Adds functionality to read/write era files
```ts
import {era} from "@lodestar/era";
import {config} from "@lodestar/config/default";
// open reader
const reader = await era.EraReader.open(config, "mainnet-xxxxx-xxxxxxxx.era");

// check number of groups
reader.groups.length === 1;

// read blocks
const slot = reader.groups[0].startSlot;

 // return snappy-frame compressed, ssz-serialized block at slot or null if a skip slot
 // throws if out of range
await reader.readCompressedBlock(slot);
// same, but for ssz-serialized block
await reader.readSerializedBlock(slot);
// same but for deserialized block
await reader.readBlock(slot);

// read state(s), one per group
// similar api to blocks, but with an _optional_ eraNumber param for specifying which group's state to read
await reader.readCompressedState(); 
await reader.readSerializedState();
await reader.readState();

// write era files
const writer = await era.EraWriter.create(config, "path/to/era");

// similar api to reader, can write compressed, serialized, or deserialized items
// first write all blocks for the era
await writer.writeBlock(block);
// ...
// then write the state
await writer.writeState(state);
// if applicable, continue writing eras of blocks and state (an era file can contain multiple eras, or "groups" as the spec states)
// when finished, must call `finish`, which will close the file handler and _rename_ the file to the spec-compliant name
await writer.finish();
```

- e2e test reads an era file, does all validation, writes an era fila,
does validation on that freshly created file
- requires the era file fixture to be downloaded (`cd packages/era/test
&& ./download_era_file.sh`)
  - e2e test is skipped (`test:e2e` is not defined for the era package)

---------

Co-authored-by: Cayman <caymannava@gmail.com>
2025-11-07 11:42:31 -05: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
Ekaterina Riazantseva
cdfdfec6ca refactor: move ValidatorMonitor to the BeaconChain (#7647)
**Motivation**

The ValidatorMonitor should be moved out of metrics into the BeaconChain
object.

**Description**
- Move ValidatorMonitor from the Metrics to the BeaconChain Object.
- Delete `registerValidatorStatuses()` from the
BeaconStateTransitionMetrics type.

Closes #7624

**Steps to test or reproduce**

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2025-04-16 12:07:14 +01:00
Varun Guleria
f87eb0b2c7 feat: lodestar script setup (#7254)
* feat: lodestar_setup

* feat: script_updates + docs

* feat: script_addition_in_docs + command_update

* Remove duplicate script from docs folder

* Minor script updates

* Update script to prepare docs and ignore copied file

* Update installation page

* Wording

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2024-12-06 15:49:45 +01:00
Nazar Hussain
e770ebe0ab chore: add vscode workspace settings (#7173)
* Add vscode workspace settings

* Update the settings file

* Add settings for open-in-github

* Update the settings

* Add comment in the settings

* Update the settings

* Use tabaqa extension to override settings

* Revert "Use tabaqa extension to override settings"

This reverts commit fd02f98f36.

* Update the settings file

* Update settings

* Update .vscode/settings.json

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

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2024-10-22 09:49:21 -04:00
Julien
93322168bb docs: revert docs link removal (#6864)
* fix: revert docs link removal

* chore: address comments

* update links and fix broken links

* fix lint

* update wordlist

* fix wordlist sort

---------

Co-authored-by: Phil Ngo <phil@chainsafe.io>
2024-06-12 01:30:41 -07:00
Julien
992fdd452e docs: added debugging section (#6743)
* docs: added debugging section

* chore: spell checks

* chore: added extra docs

* chore: address comments

* chore: added extra configuration

* chore: updated docs

* chore: added extra configuration

* chore: fix lint

* chore: fix typos

* chore: .gitignore

* chore: address comments

* chore: address comments
2024-05-22 02:21:03 -07:00
Nazar Hussain
02e28cf7ca feat: add support for browser bundle for lightclient (#6673)
* Reorganize the code so it is accessible from one package

* Add support for browser build for lightclient

* Update the build config

* Improve the bls vite plugin

* Restructure the vite and vitest scripts

* Simplify vite config

* Remove unused polyfill

* Fix the doc lint error

* Add support for bundle test

* Update the package json files

* Add dist build to default build task

* Fix spelling in the docs

* Fix the lint error

* Fix type error

* Disable eslint errors

* Increase the timeout for bundle test

* Fix eslint bundle

* Fix lint warning

* Remove the unused config

* Add the default export to bundle

* Enable compression on th build

* Update packages/light-client/README.md

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

* Increase timeout for one test

* Optimize package build task

* Update the readme

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
2024-04-26 13:18:56 +02:00
Julien
4686ad1db6 feat: docusaurus migration (#6533)
* chore: remove mkdocs specifics

* chore: migrate to docusaurus

* chore: update docs/pages/tools/flamegraphs.md

Co-authored-by: Matthew Keil <me@matthewkeil.com>

* chore: update packages/cli/docsgen/markdown.ts

Co-authored-by: Matthew Keil <me@matthewkeil.com>

* chore: update docs/src/css/custom.css

Co-authored-by: Phil Ngo <58080811+philknows@users.noreply.github.com>

* update docs/src/css/custom.css

Co-authored-by: Phil Ngo <58080811+philknows@users.noreply.github.com>

* chore: address comments

* chore: fix small issues

---------

Co-authored-by: Matthew Keil <me@matthewkeil.com>
Co-authored-by: Phil Ngo <58080811+philknows@users.noreply.github.com>
2024-03-18 03:43:27 -07:00
Matthew Keil
9c4641a733 docs: fix docs links (#6233)
* docs: add google landing page for old layout until reindexed

* docs: fix broken links

* docs: add SECURITY to docs site pages

* chore: lint docs

* docs: remove committed security.md

* docs: fix mkdocs warnings
2023-12-26 15:09:58 -05:00
Matthew Keil
cb8607e62e docs: update docsgen scripting and add new docs content (#6134)
* docs: rouged out changes to layout, TOC and started writing

* docs: add more docs for beacon-management

* docs: add database update and light-client examples

* docs: make spelling consistent in lightclient example

* refactor: move assets into docs folder

* docs: fix filenames and write testing and simtest content

* fix contributing navigation

* enable emojis on docs

* docs: update testing toc

* feat(docs): update cli docs rendering

* refactor(docs): move lightclient and prover into folder

* docs: add docsFolder prop to cli commands

* feat: create CliOptionDefinition and standardize flare and prover with existing

* fix: debug docs rendering edge cases

* fix: cleanup docs TOC

* fix: update docs scripts and workflow

* refactor: move docs/gitignore line to root gitignore

* feat: remove old comments

* fix: CI lint errors

* chore: lint docs

* chore: lint spelling

* feat: add check-spelling script

* fix: bug in build:docs if folder not present

* test: fix failing unit test

* chore: add gitignore changes to dockerignore

* feat: check README ts examples and cop

* chore: add pre to wordlist

* docs: add heap-dumps.md

* chore: lint spelling

* refactor: move assets back to root

* docs: add core-dumps and add to heap-dumps

* fix: put back unit test after moving assets back

* docs: update beacon-management/networking.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update beacon-management/networking.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update beacon-management/networking.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update beacon-management/networking.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update beacon-management/networking.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update beacon-management/networking.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update contribution/testing/index.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update beacon-management/syncing.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update contribution/testing/index.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update contribution/testing/index.md

Co-authored-by: Cayman <caymannava@gmail.com>

* docs: update supporting libraries

* docs: update for PR comments

* docs: fix broken lings and clean up TOC

* docs: clean up simulation-test and move integration stuff out to placeholder file

* chore: remove duplicate word in .wordlist.txt

* docs: fix data retention diagram

* fix: PR comments in docs

* docs: rewreite Proof of Stake intro

---------

Co-authored-by: Phil Ngo <phil@chainsafe.io>
Co-authored-by: Cayman <caymannava@gmail.com>
2023-12-12 11:11:43 -05:00
Lion - dapplion
9e57b7d320 ci: check docs spelling (#5527)
* Check docs spelling

* Add config

* Fix docs spelling

* Lint docs format

* docs(flamegraph): remove note about script that was removed

* sort wordlist

* Set sort algo

* Fix CI pipeline

* hope to fix CI ordering

* Disable wordlist sort check

* docs(CONTRIBUTING): remove merge conflict marker and add codeblock types

* refactor: change to pyspelling.yml for local runs

* docs: make spell-checking wordlist case insensitive

* fix: sort .wordlist.txt

* refactor: alphabetize script order

* fix: add docs/reference to gitignore

* docs: add codeblocks to pyspelling ignore and clear all errors

* docs: ignore possessive endings in spellcheck

* docs: clear spelling errors in package readmes

* docs: pyspelling fix generated cli.md

* feat(workflows): lint generated docs

* feat(workflows): add word sort to docs-check

* test: unsort wordlist

* fix: sort wordlist

* refactor(workflow): remove unused comments

---------

Co-authored-by: matthewkeil <me@matthewkeil.com>
Co-authored-by: Cayman <caymannava@gmail.com>
2023-06-21 18:24:27 +00:00
Lion - dapplion
7b53ebd4a2 chore: add script to pull dashboards from remote API (#5525)
Update scripts
2023-05-24 11:57:54 -04:00
Lion - dapplion
d1cddb7ca8 Add dockerized metrics local setup (#5173)
* Add dockerized metrics local setup

* Review PR
2023-02-20 11:08:46 -05:00
Nico Flaig
c09e39c540 Add keystores folder to gitignore (#4953) 2022-12-28 17:50:09 -05:00
Lion - dapplion
29dd662519 EIP-4844: Add c-kzg library and current trusted setup (#4851)
Add c-kzg library and current trusted setup
2022-12-05 18:08:01 +05:30
Lion - dapplion
1d64a2ff3f Run ethereum/bls12-381-tests (#4624)
* Support multiple sources for spec tests

* Fixes

* Justify skipped tests

* Fix types

* Run new bls tests in CI

* Re-add catch clause
2022-10-02 22:03:34 +05:30
Nazar Hussain
31f220e321 Add assertions to sim tests (#4510)
* Add support for run simulation env in child process

* Update the simulation node runner

* Add assertions placeholders

* Update assertions for single node

* Update simulation env for the multiple nodes

* Updaate the assertions for single node

* Updat asssertions for multiple nodes

* Add a simulation test for four nodes

* Add --dev option for testing environment

* Fix linting errors

* Update code as per feedback

* Update the execution.engineMock to be optional

* Add fork detection test

* Update forks tests

* Update the assertions to split in multiple files

* Add sim tests to the pipeline

* Fix lint error

* Update the simulation log format

* Add simulation tracker

* Skip the multi node test for now

* Updte the assertions style

* Update tests structure to run in sequence

* Fix the issues after rebase

* Update the export

* Improve the stats printing

* Update the logging for the sim tests

* Update the logs to hide rc config

* Update the usage of far future epoch value

* Update the fork tests to check the finality

* Add external signer support

* Skip the multi-node test

* Update the assertions style

* Update the node tests structure

* Update the nodes numbers

* Update the logging for childprocess

* Remove existing sim tests for same scenarios

* Update the logging for the process loading

* Remove duplicate sim tests

* Increase genesis delay to not miss slots on CI server

* Update simulation id

* Update acceptableParticipationRate to 70%

* Update the calculation for calcultating participation

* Update the event wait logic for multiple nodes

* Remove the extra log

* Fix forkchoice bug for low pivot slot

* Update the simulation env trackers

* Fix multi node key index

* Update simulations to use longer epochs

* Revert unused changes

* Update assertion messages

* Revert change for minimal param preset

* Update test description

* Remove unused code
2022-09-19 23:47:40 +02:00
Lion - dapplion
9194e21623 Check API definitions against OpenAPI spec (#4493)
* Add basic spec tests against OpenAPI definition

* Fix routes

* Fix routes

* Fix routes

* Fix routes

* Fetch openapi spec dynamically

* Add tests for events

* Don't use backup

* Update API impl

* Update other libraries

* Fix mocks

* Fix notation in fastify url

* Remove .skip

* Fix tests

* Add builder spec test infra

* Add keymanager spec test infra

* Fix schema issues

* Update tests

* Create oapi dir

* Fix duties tests
2022-09-01 10:04:48 -05:00
Cayman
e5dabac124 Rename packages using @lodestar namespace (#4231)
* Remove event handlers file

* exposing util module from the light-client package

* Rename packages using @lodestar namespace

* Fix linter errors

* Fix merge

Co-authored-by: dapplion <35266934+dapplion@users.noreply.github.com>
Co-authored-by: Dadepo Aderemi <dadepo@gmail.com>
2022-07-06 12:30:36 -05:00
Lion - dapplion
510f3108e4 Adopt gitflow for Lodestar releases (#4071)
* Adopt gitflow for Lodestar releases

* Apply feedback

* Replace most mentions of `master` with `unstable`

* Tweak various parts of RELEASE.md

* Update CI

* Tweak dev release version handling

* Tweak workflow names

* Replace `nightly` with `dev`

* Replace `beta` with `rc`

* Fix publish for rc release and stable release only

* Remove stray "beta"

* Add code examples to RELEASE.md

* Clarify publish process

* Collapse 'Alternatives considered' section

* Move 'Details' header up one level

* Clarify publishing a release

* Tweak headings

* Fix hotfix section

* More clarifications

* Update examples in RELEASE.md

* More clarifications

* Fix formatting

* Run RELEASE.md through grammarly

* Change script name to release:publish

* Add create_rc script

* Add workflow_dispatch for create RC

* Add placeholder for other scripts

* Update RELEASE.md

* Update release create rc script

* Update script instructions

* create_rc script must not be run in CI

* Update release flow

* Add publish-rc workflow

* Apply suggestions from code review

Co-authored-by: Afr Schoe <58883403+q9f@users.noreply.github.com>

Co-authored-by: Cayman <caymannava@gmail.com>
Co-authored-by: Afr Schoe <58883403+q9f@users.noreply.github.com>
2022-05-30 10:22:00 -05:00
Lion - dapplion
d7acdcf4a5 Benchmark initial sync (#3995)
* Basic range sync perf test

* Benchmark initial sync

* Add INFURA_ETH2_CREDENTIALS to benchmark GA

* Download test cache file from alternative source

* Re-org beforeValue and testCase helpers

* Break light-client - state-transition test dependency

* Revert adding downloadTestCacheFile

* Download files from a Github release
2022-05-13 18:23:14 +07:00
Lion - dapplion
c384b36a1b Use memory efficient toHex in pubkey2index map (#3561)
* Research the memory cost of bytes hex

* Benchmark overhead of Uint8Array

* Test template strings

* Improve PubkeyIndexMap memory efficiency
2022-01-04 10:08:09 +01:00
Lion - dapplion
97188a4a2b Move spec tests to main lodestar package (#3544)
* Move spec tests to main lodestar package

* Use spec test mocha rc

* Fix specTestVersioning import

* Fix test types

* Fix spec tests path

* Fix relative location of spec test coverage
2021-12-23 13:06:04 +01:00
Lion - dapplion
148ac6f4ea Add build if changed script (#3543)
* Add build if changed script

* Remove stale comment
2021-12-21 11:11:40 +01:00
Lion - dapplion
2275fecf44 Cache slashing protection tests data (#3500) 2021-12-08 16:42:01 +01:00
Lion - dapplion
be50e4e211 LightClient server no state cache + tracks head (#3461)
* WIP

* Refactor lightclient server db repositories

* WIP Lightclient refactor

* Lightclient tracking head

* Fix branch proof sorting

* Move lightclient code to package root

* Move LightclientServer code to module index

* Add e2e test and fix bugs

* Log sync committee periods

* Sync 3 periods

* Clean logging in LC

* Fix broken tests

* Rename getCommitteeUpdates route

* Use getStateV2 to download altair states

* Remove blockRoot from LightclientHeaderUpdate

* Polish lightclient

* Remove clock

* Remove beacon state transition dependency

* Add mock sync test

* Change getStateProof to GET

* Deprecate un-used db buckets

* Test fetching proofs on lightclient head state

* Test fetching proofs in sim test

* Test query serializtion

* Fix proof paths serdes in api

* Use Promise.all in storeSyncCommittee

* Rename finalizedHeader to checkpointHeader

* Remove genesisWitness

* Remove genesis proof dead code

* Rename lightclient_update to lightclient_header_update

* Pass only checkpoint root

* Use console levels in getLcLoggerConsole

* Remove stateProofPaths dead code

* Rename to initializeFromCheckpointRoot

* lightclient snapshot type has a single SyncCommittee

* Simplify tree position constants

* Log 'New sync committee period' message only once
2021-12-01 19:33:02 +01:00
Lion - dapplion
eaab9421c4 Add dockerized geth setup for amphora (#3317) 2021-10-05 09:50:06 -05:00
tuyennhv
22fb0fe5f4 Persist invalid ssz objects (#3067)
* Persist invalid ssz objects

* Unify log debug messages
2021-09-08 15:19:18 +07:00
Lion - dapplion
25ec250555 Re-org slashing protection DB code (#2868)
* Re-org slashing protection DB code

* Add basic e2e tests

* Fix e2e tests
2021-07-22 09:34:52 -05:00
Lion - dapplion
1ea9ab2cb3 Improve gitData scripts (#2819)
* Fix cli build script

* Improve gitData scripts

* Log git data file

* Simplify

* Add benchmark_data to git ignore

* Remove workflow validate step
2021-07-09 00:00:47 +02:00
Lion - dapplion
37e222d0a1 Add benchmark action (#2750)
* Add benchmark action

* Pass argument to script

* Pass option via CLI arg

* Bump benchmark

* Polish perf tests

* Add more data to test ids

* Fix id formating
2021-06-28 13:54:18 +02:00
Lion - dapplion
927ab09961 Distribute git data through NPM (#2671)
* Distribute git data through NPM

* Make git data parsing backwards compatible with current dockerfile
2021-06-09 16:35:49 -05:00
Lion - dapplion
ec065635ca Reduce perf test start-up time (#2339)
* Speed-up perf test start-up time

* Cache interop pubkeys to disk

* Remove unnecessary promises

* Remove unused perf utils

* Minimize BLS opts in perf tests

* Use optimized state creation on all perf tests

* Add comment about sources
2021-04-09 09:20:38 +02:00
dapplion
5ed6f06e49 Connect nodes manually in sim test 2021-03-20 11:41:23 +01:00
dapplion
3dbb05040e Multi-configuration setup 2021-03-06 12:16:30 +01:00
3xtr4t3rr3str14l
9a0a8d7e8c remove dead testnet mentions 2021-01-19 15:13:51 -06:00
3xtr4t3rr3str14l
58c8f7acec add .pyrmont to .gitignore 2020-11-30 16:20:19 -06:00
dapplion
98bbd14617 Add lodestar-db package 2020-10-11 16:08:10 +02:00
3xtr4t3rr3str14l
fa7a808c64 --testnet zinken 2020-10-08 14:15:41 -05:00
3xtr4t3rr3str14l
9219bc3e14 spadina testnet lodestar-cli setup 2020-09-25 14:25:11 -05:00
dapplion
495b0cb156 Improve build:docs script 2020-08-15 11:14:28 +02:00
dapplion
d4a4deee10 Organize doc generation scripts 2020-08-15 10:57:33 +02:00
3xtr4t3rr3str14l
251d3c445f .gitignore cli.md and move generateCLIDocs.ts to lodestar-cli 2020-08-14 11:46:54 -05:00
Lion - dapplion
0c1db37e50 Merge branch 'master' into dapplion/cli-medalla 2020-08-02 13:10:21 +02:00
dapplion
7ac6f882bd Add testnet --medalla flag 2020-07-31 18:58:04 +02:00
dapplion
3e40a48890 Add basic multi node test
Throw more descriptive error on getAttesterDuties if unknown validator
2020-07-27 18:50:18 +02:00
3xtr4t3rr3str14l
8002f677ad update .gitignore to ignore altona testnet artifacts 2020-07-15 16:29:24 -05:00
dapplion
a18f140f9c Fix account CLI errors 2020-07-07 23:50:34 +02:00
Patrick Michot
2fc1a30194 lodecli -> lodestar 2020-06-25 13:36:55 -05:00