nimbus-eth2/beacon_chain/spec
Jacek Sieka d583e8e4ac
Store finalized block roots in database (3s startup) (#3320)
* Store finalized block roots in database (3s startup)

When the chain has finalized a checkpoint, the history from that point
onwards becomes linear - this is exploited in `.era` files to allow
constant-time by-slot lookups.

In the database, we can do the same by storing finalized block roots in
a simple sparse table indexed by slot, bringing the two representations
closer to each other in terms of conceptual layout and performance.

Doing so has a number of interesting effects:

* mainnet startup time is improved 3-5x (3s on my laptop)
* the _first_ startup might take slightly longer as the new index is
being built - ~10s on the same laptop
* we no longer rely on the beacon block summaries to load the full dag -
this is a lot faster because we no longer have to look up each block by
parent root
* a collateral benefit is that we no longer need to load the full
summaries table into memory - we get the RSS benefits of #3164 without
the CPU hit.

Other random stuff:

* simplify forky block generics
* fix withManyWrites multiple evaluation
* fix validator key cache not being updated properly in chaindag
read-only mode
* drop pre-altair summaries from `kvstore`
* recreate missing summaries from altair+ blocks as well (in case
database has lost some to an involuntary restart)
* print database startup timings in chaindag load log
* avoid allocating superfluos state at startup
* use a recursive sql query to load the summaries of the unfinalized
blocks
2022-01-30 18:51:04 +02:00
..
datatypes Store finalized block roots in database (3s startup) (#3320) 2022-01-30 18:51:04 +02:00
eth2_apis phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
mev rearrange MEV code (#3319) 2022-01-25 19:43:28 +00:00
presets spec URL & copyright year update (#3338) 2022-01-29 01:05:39 +00:00
beacon_time.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
beaconstate.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
crypto.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
digest.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
english_word_list.txt Bump testutils 2020-06-01 16:58:28 +03:00
eth2_merkleization.nim Use nim-ssz-serialization module and rm local ssz code 2021-11-10 13:37:24 +02:00
eth2_ssz_serialization.nim initial migration from spec/datatypes/{merge => bellatrix} (#3249) 2022-01-06 12:25:35 +01:00
forks.nim Store finalized block roots in database (3s startup) (#3320) 2022-01-30 18:51:04 +02:00
helpers.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
keystore.nim Implementation of the Keymanager API (BETA) 2022-01-04 18:51:45 +02:00
light_client_sync.nim time: spring cleaning (#3262) 2022-01-11 11:01:54 +01:00
network.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
presets.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
signatures.nim Store finalized block roots in database (3s startup) (#3320) 2022-01-30 18:51:04 +02:00
signatures_batch.nim Store finalized block roots in database (3s startup) (#3320) 2022-01-30 18:51:04 +02:00
ssz_codec.nim REST JSON support improvements (#3232) 2022-01-06 08:38:40 +01:00
state_transition.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
state_transition_block.nim Store finalized block roots in database (3s startup) (#3320) 2022-01-30 18:51:04 +02:00
state_transition_epoch.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
validator.nim phase 0 & altair beacon chain and altair validator spec URL updates (#3339) 2022-01-29 13:53:31 +00:00
weak_subjectivity.nim time: spring cleaning (#3262) 2022-01-11 11:01:54 +01:00