lighthouse/beacon_node/beacon_chain/tests
Michael Sproul 99d2c33387 Avoid looking up pre-finalization blocks (#2909)
## Issue Addressed

This PR fixes the unnecessary `WARN Single block lookup failed` messages described here:

https://github.com/sigp/lighthouse/pull/2866#issuecomment-1008442640

## Proposed Changes

Add a new cache to the `BeaconChain` that tracks the block roots of blocks from before finalization. These could be blocks from the canonical chain (which might need to be read from disk), or old pre-finalization blocks that have been forked out.

The cache also stores a set of block roots for in-progress single block lookups, which duplicates some of the information from sync's `single_block_lookups` hashmap:

a836e180f9/beacon_node/network/src/sync/manager.rs (L192-L196)

On a live node you can confirm that the cache is working by grepping logs for the message: `Rejected attestation to finalized block`.
2022-01-27 22:58:32 +00:00
..
attestation_production.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
attestation_verification.rs Avoid looking up pre-finalization blocks (#2909) 2022-01-27 22:58:32 +00:00
block_verification.rs Optimise slasher DB layout and switch to MDBX (#2776) 2021-12-21 08:23:17 +00:00
main.rs Add BeaconChainHarness tests for The Merge (#2661) 2021-12-02 14:26:52 +11:00
merge.rs Update to spec v1.1.8 (#2893) 2022-01-19 00:24:19 +00:00
op_verification.rs Disable autotests for beacon_chain (#2658) 2021-12-02 14:26:52 +11:00
store_tests.rs Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
sync_committee_verification.rs Disable autotests for beacon_chain (#2658) 2021-12-02 14:26:52 +11:00
tests.rs Disable autotests for beacon_chain (#2658) 2021-12-02 14:26:52 +11:00