lighthouse/consensus/state_processing/src/per_block_processing
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
..
altair Optimize process_attestation with active balance cache (#2560) 2021-09-03 07:50:43 +00:00
altair.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
block_signature_verifier.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
errors.rs 1.1.5 merge spec tests (#2781) 2021-12-02 14:26:55 +11:00
is_valid_indexed_attestation.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
process_operations.rs Fix consensus, SSZ, tree hash & run merge EF tests (#2622) 2021-12-02 14:26:50 +11:00
signature_sets.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
tests.rs Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
verify_attestation.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
verify_attester_slashing.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
verify_deposit.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
verify_exit.rs removed verify_exit_time_independent_only function (#2509) 2021-08-30 06:41:30 +00:00
verify_proposer_slashing.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00