lighthouse/consensus
Michael Sproul a290a3c537 Add configurable block replayer (#2863)
## Issue Addressed

Successor to #2431

## Proposed Changes

* Add a `BlockReplayer` struct to abstract over the intricacies of calling `per_slot_processing` and `per_block_processing` while avoiding unnecessary tree hashing.
* Add a variant of the forwards state root iterator that does not require an `end_state`.
* Use the `BlockReplayer` when reconstructing states in the database. Use the efficient forwards iterator for frozen states.
* Refactor the iterators to remove `Arc<HotColdDB>` (this seems to be neater than making _everything_ an `Arc<HotColdDB>` as I did in #2431).

Supplying the state roots allow us to avoid building a tree hash cache at all when reconstructing historic states, which saves around 1 second flat (regardless of `slots-per-restore-point`). This is a small percentage of worst-case state load times with 200K validators and SPRP=2048 (~15s vs ~16s) but a significant speed-up for more frequent restore points: state loads with SPRP=32 should be now consistently <500ms instead of 1.5s (a ~3x speedup).

## Additional Info

Required by https://github.com/sigp/lighthouse/pull/2628
2021-12-21 06:30:52 +00:00
..
cached_tree_hash 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00
fork_choice v1.1.6 Fork Choice changes (#2822) 2021-12-13 20:43:22 +00:00
int_to_bytes Update to tokio 1.1 (#2172) 2021-02-10 23:29:49 +00:00
merkle_proof Get arbitrary check passing (2.0) (#2710) 2021-10-14 02:58:11 +00:00
proto_array v1.1.6 Fork Choice changes (#2822) 2021-12-13 20:43:22 +00:00
safe_arith Remove saturating arith from state_processing (#1644) 2020-09-25 05:18:21 +00:00
serde_utils Kintsugi review comments (#2831) 2021-12-02 14:29:59 +11:00
ssz 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00
ssz_derive Implement SSZ union type (#2579) 2021-09-25 05:58:36 +00:00
ssz_types Kintsugi review comments (#2831) 2021-12-02 14:29:59 +11:00
state_processing Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
swap_or_not_shuffle Get arbitrary check passing (2.0) (#2710) 2021-10-14 02:58:11 +00:00
tree_hash Bump crate versions (#2829) 2021-12-02 14:29:57 +11:00
tree_hash_derive Implement SSZ union type (#2579) 2021-09-25 05:58:36 +00:00
types v1.1.6 Fork Choice changes (#2822) 2021-12-13 20:43:22 +00:00