prysm-pulse/beacon-chain
Manu NALEPA 4030614df0
Slasher: Reduce cold start duration. (#13620)
* `getChunk` ==> `getChunkFromDatabase`.

* `loadChunks`: Rename variables.

* `Update`: Use explicit arguments.

* `detect_attestations.go`: Reduce abstraction layers.

* `loadAndUpdateChunks`: Change arguments order.

* `updatedChunkByChunkIndex`: Update all known validators in the chunk.

* `LastEpochWrittenForValidators`: Avoid avoidable `for`loop.

* `chunks.go`: Ensure implementations respect the interface.

* `LastEpochWrittenForValidators`: Stop considering lack of epoch as genesis epoch.

* `updatedChunkByChunkIndex`: Don't update latest updated epoch.

And add a bunch of tests.

* Improve slasher cold boot duration.

Before this commit, on a slasher cold boot (aka, without any db),
the `updatedChunkByChunkIndex` function looped for all validators
AND for all epochs between the genesis epoch and the current epoch.

This could take several dozen of minutes, and it is useless since the
min/max spans are actually a circular buffer with a limited lenght.
Cells of min/max spans can be overwritten (with the same value)
plenty of times.

After this commit, the `updatedChunkByChunkIndex` function loops
for all validators AND AT most 'historyLength' lenght.
Every cell of min/max spans are written AT MOST once.

Time needed for slasher boot goes from `O(nm)` to "only" `O(m)`, where:
- `n` is the number of epochs since the genesis.
- `m` is the number of validators.
2024-02-16 10:10:26 +00:00
..
blockchain Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
builder Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
cache Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
core Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
das Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
db Slasher: Reduce cold start duration. (#13620) 2024-02-16 10:10:26 +00:00
deterministic-genesis Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
execution Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
forkchoice Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
gateway Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
monitor Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
node backfill waits for init-sync before starting (#13623) 2024-02-15 17:42:36 +00:00
operations Update aggregate atts t1 bucket values (#13607) 2024-02-15 18:36:30 +00:00
p2p Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
package Update cross compile toolchains (#12069) 2023-03-07 20:09:46 +00:00
rpc Blob API - invalid indicies should error instead of ignored (#13616) 2024-02-15 19:54:42 +00:00
slasher Slasher: Reduce cold start duration. (#13620) 2024-02-16 10:10:26 +00:00
startup Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
state Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
sync backfill waits for init-sync before starting (#13623) 2024-02-15 17:42:36 +00:00
verification Update to V5 (#13622) 2024-02-15 05:46:47 +00:00
README.md Change Eth2 Repository Names (#9425) 2021-08-19 13:00:57 -05:00

Prysmatic Labs Beacon Chain Implementation

This is the main project folder for the beacon chain implementation of Ethereum written in Go by Prysmatic Labs.

You can also read our main README and join our active chat room on Discord.

Discord

Also, read the official beacon chain specification, this design spec serves as a source of truth for the beacon chain implementation we follow at Prysmatic Labs.