lighthouse/testing
Michael Sproul 22115049ee Prioritise important parts of block processing (#3696)
## Issue Addressed

Closes https://github.com/sigp/lighthouse/issues/2327

## Proposed Changes

This is an extension of some ideas I implemented while working on `tree-states`:

- Cache the indexed attestations from blocks in the `ConsensusContext`. Previously we were re-computing them 3-4 times over.
- Clean up `import_block` by splitting each part into `import_block_XXX`.
- Move some stuff off hot paths, specifically:
  - Relocate non-essential tasks that were running between receiving the payload verification status and priming the early attester cache. These tasks are moved after the cache priming:
    - Attestation observation
    - Validator monitor updates
    - Slasher updates
    - Updating the shuffling cache
  - Fork choice attestation observation now happens at the end of block verification in parallel with payload verification (this seems to save 5-10ms).
  - Payload verification now happens _before_ advancing the pre-state and writing it to disk! States were previously being written eagerly and adding ~20-30ms in front of verifying the execution payload. State catchup also sometimes takes ~500ms if we get a cache miss and need to rebuild the tree hash cache.

The remaining task that's taking substantial time (~20ms) is importing the block to fork choice. I _think_ this is because of pull-tips, and we should be able to optimise it out with a clever total active balance cache in the state (which would be computed in parallel with payload verification). I've decided to leave that for future work though. For now it can be observed via the new `beacon_block_processing_post_exec_pre_attestable_seconds` metric.


Co-authored-by: Michael Sproul <micsproul@gmail.com>
2022-11-30 05:22:58 +00:00
..
antithesis Fix antithesis docker builds (#3380) 2022-07-28 07:40:03 +00:00
ef_tests Prioritise important parts of block processing (#3696) 2022-11-30 05:22:58 +00:00
eth1_test_rig Fix ganache test endpoint for ipv6 machines (#3563) 2022-09-13 01:57:45 +00:00
execution_engine_integration v3.3.0 (#3741) 2022-11-23 23:38:32 +00:00
node_test_rig Health Endpoints for UI (#3668) 2022-11-15 05:21:26 +00:00
simulator Add CLI flag to opt in to world-readable log files (#3747) 2022-11-25 07:57:11 +00:00
state_transition_vectors Consensus context with proposer index caching (#3604) 2022-10-15 22:25:54 +00:00
test-test_logger Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
web3signer_tests Builder Specs v0.2.0 (#3134) 2022-07-30 00:22:37 +00:00