lighthouse/beacon_node/beacon_chain/src
Paul Hauner 02e2fd2fb8 Add early attester cache (#2872)
## Issue Addressed

NA

## Proposed Changes

Introduces a cache to attestation to produce atop blocks which will become the head, but are not fully imported (e.g., not inserted into the database).

Whilst attesting to a block before it's imported is rather easy, if we're going to produce that attestation then we also need to be able to:

1. Verify that attestation.
1. Respond to RPC requests for the `beacon_block_root`.

Attestation verification (1) is *partially* covered. Since we prime the shuffling cache before we insert the block into the early attester cache, we should be fine for all typical use-cases. However, it is possible that the cache is washed out before we've managed to insert the state into the database and then attestation verification will fail with a "missing beacon state"-type error.

Providing the block via RPC (2) is also partially covered, since we'll check the database *and* the early attester cache when responding a blocks-by-root request. However, we'll still omit the block from blocks-by-range requests (until the block lands in the DB). I *think* this is fine, since there's no guarantee that we return all blocks for those responses.

Another important consideration is whether or not the *parent* of the early attester block is available in the databse. If it were not, we might fail to respond to blocks-by-root request that are iterating backwards to collect a chain of blocks. I argue that *we will always have the parent of the early attester block in the database.* This is because we are holding the fork-choice write-lock when inserting the block into the early attester cache and we do not drop that until the block is in the database.
2022-01-11 01:35:55 +00:00
..
attestation_verification Batch BLS verification for attestations (#2399) 2021-09-22 08:49:41 +00:00
schema_change Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
attestation_verification.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
attester_cache.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
beacon_chain.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
beacon_fork_choice_store.rs Optimise balances cache in case of skipped slots (#2849) 2021-12-13 23:35:57 +00:00
beacon_proposer_cache.rs Optimize validator duties (#2243) 2021-03-17 05:09:57 +00:00
beacon_snapshot.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
block_times_cache.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
block_verification.rs Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
builder.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
chain_config.rs Increase network limits (#2796) 2021-12-02 14:29:20 +11:00
early_attester_cache.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
errors.rs Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
eth1_chain.rs Removed PowBlock struct that never got used (#2813) 2021-12-02 14:29:20 +11:00
events.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
execution_payload.rs Update to superstruct v0.4.1 (#2886) 2022-01-06 03:14:58 +00:00
fork_revert.rs Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
head_tracker.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
historical_blocks.rs Reduce lock contention in backfill sync (#2716) 2021-10-15 03:28:03 +00:00
lib.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
metrics.rs Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
migrate.rs Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
naive_aggregation_pool.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
observed_aggregates.rs [Altair] Sync committee pools (#2321) 2021-07-15 00:52:02 +00:00
observed_attesters.rs Ensure doppelganger detects attestations in blocks (#2495) 2021-08-09 02:43:03 +00:00
observed_block_producers.rs Doppelganger detection (#2230) 2021-07-31 03:50:52 +00:00
observed_operations.rs Clippy 1.49.0 updates and dht persistence test fix (#2156) 2021-01-19 00:34:28 +00:00
persisted_beacon_chain.rs Fix head tracker concurrency bugs (#1771) 2020-10-19 05:58:39 +00:00
persisted_fork_choice.rs Optimise balances cache in case of skipped slots (#2849) 2021-12-13 23:35:57 +00:00
schema_change.rs Optimise balances cache in case of skipped slots (#2849) 2021-12-13 23:35:57 +00:00
shuffling_cache.rs Advance state to next slot after importing block (#2174) 2021-02-15 07:17:52 +00:00
snapshot_cache.rs Optimise snapshot cache for late blocks (#2832) 2021-12-06 03:41:31 +00:00
state_advance_timer.rs 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00
sync_committee_verification.rs Validator monitor support for sync committees (#2476) 2021-08-31 23:31:36 +00:00
test_utils.rs Add configurable block replayer (#2863) 2021-12-21 06:30:52 +00:00
timeout_rw_lock.rs Add flag to disable lock timeouts (#2714) 2021-10-19 00:30:40 +00:00
validator_monitor.rs Reduce validator monitor logging verbosity (#2606) 2021-10-12 05:06:48 +00:00
validator_pubkey_cache.rs 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00