lighthouse/beacon_node/eth1/src
Michael Sproul 47d57a290b Improve eth1 block cache sync (for Ropsten) (#3234)
## Issue Addressed

Fix for the eth1 cache sync issue observed on Ropsten.

## Proposed Changes

Ropsten blocks are so infrequent that they broke our algorithm for downloading eth1 blocks. We currently try to download forwards from the last block in our cache to the block with block number [`remote_highest_block - FOLLOW_DISTANCE + FOLLOW_DISTANCE / ETH1_BLOCK_TIME_TOLERANCE_FACTOR`](6f732986f1/beacon_node/eth1/src/service.rs (L489-L492)). With the tolerance set to 4 this is insufficient because we lag by 1536 blocks, which is more like ~14 hours on Ropsten. This results in us having an incomplete eth1 cache, because we should cache all blocks between -16h and -8h. Even if we were to set the tolerance to 2 for the largest allowance, we would only look back 1024 blocks which is still more than 8 hours.

For example consider this block https://ropsten.etherscan.io/block/12321390. The block from 1536 blocks earlier is 14 hours and 20 minutes before it: https://ropsten.etherscan.io/block/12319854. The block from 1024 blocks earlier is https://ropsten.etherscan.io/block/12320366, 8 hours and 48 minutes before.

- This PR introduces a new CLI flag called `--eth1-cache-follow-distance` which can be used to set the distance manually.
- A new dynamic catchup mechanism is added which detects when the cache is lagging the true eth1 chain and tries to download more blocks within the follow distance in order to catch up.
2022-06-03 06:05:03 +00:00
..
block_cache.rs Return eth1-related data via the API (#1797) 2020-11-02 00:37:30 +00:00
deposit_cache.rs Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
deposit_log.rs Fix new clippy lints (#2036) 2020-12-03 01:10:26 +00:00
http.rs v2.2.0 (#3139) 2022-04-05 02:53:09 +00:00
inner.rs Implement SSZ union type (#2579) 2021-09-25 05:58:36 +00:00
lib.rs Fallback nodes for eth1 access (#1918) 2020-11-27 08:37:44 +00:00
metrics.rs Monitoring service api (#2251) 2021-05-26 05:58:41 +00:00
service.rs Improve eth1 block cache sync (for Ropsten) (#3234) 2022-06-03 06:05:03 +00:00