lighthouse/beacon_node/beacon_chain/src
Mac L 4c510f8f6b Add BlockTimesCache to allow additional block delay metrics (#2546)
## Issue Addressed

Closes #2528

## Proposed Changes

- Add `BlockTimesCache` to provide block timing information to `BeaconChain`. This allows additional metrics to be calculated for blocks that are set as head too late.
- Thread the `seen_timestamp` of blocks received from RPC responses (except blocks from syncing) through to the sync manager, similar to what is done for blocks from gossip.

## Additional Info

This provides the following additional metrics:
- `BEACON_BLOCK_OBSERVED_SLOT_START_DELAY_TIME`
  - The delay between the start of the slot and when the block was first observed.
- `BEACON_BLOCK_IMPORTED_OBSERVED_DELAY_TIME`
   - The delay between when the block was first observed and when the block was imported.
- `BEACON_BLOCK_HEAD_IMPORTED_DELAY_TIME`
  - The delay between when the block was imported and when the block was set as head.

The metric `BEACON_BLOCK_IMPORTED_SLOT_START_DELAY_TIME` was removed.

A log is produced when a block is set as head too late, e.g.:
```
Aug 27 03:46:39.006 DEBG Delayed head block                      set_as_head_delay: Some(21.731066ms), imported_delay: Some(119.929934ms), observed_delay: Some(3.864596988s), block_delay: 4.006257988s, slot: 1931331, proposer_index: 24294, block_root: 0x937602c89d3143afa89088a44bdf4b4d0d760dad082abacb229495c048648a9e, service: beacon
```
2021-09-30 04:31:41 +00:00
..
attestation_verification Batch BLS verification for attestations (#2399) 2021-09-22 08:49:41 +00:00
attestation_verification.rs Batch BLS verification for attestations (#2399) 2021-09-22 08:49:41 +00:00
attester_cache.rs Add AttesterCache for attestation production (#2478) 2021-07-29 04:38:26 +00:00
beacon_chain.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
beacon_fork_choice_store.rs Tree hash caching and optimisations for Altair (#2459) 2021-07-23 00:23:53 +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 Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
builder.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
chain_config.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
errors.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
eth1_chain.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
events.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
fork_revert.rs Revert bad blocks on missed fork (#2529) 2021-08-30 06:41:31 +00:00
head_tracker.rs Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
historical_blocks.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
lib.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
metrics.rs Add BlockTimesCache to allow additional block delay metrics (#2546) 2021-09-30 04:31:41 +00:00
migrate.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +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 v0.12 fork choice update (#1229) 2020-06-17 11:10:22 +10:00
schema_change.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +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 Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
state_advance_timer.rs Add AttesterCache for attestation production (#2478) 2021-07-29 04:38:26 +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 contribution and proof event (#2527) 2021-09-25 07:53:58 +00:00
timeout_rw_lock.rs Add timeouts to canonical head rwlock (#759) 2020-01-06 17:30:37 +11:00
validator_monitor.rs Improve valmon inclusion delay calculation (#2618) 2021-09-30 01:22:43 +00:00
validator_pubkey_cache.rs [Altair] Sync committee pools (#2321) 2021-07-15 00:52:02 +00:00