lighthouse-pulse/beacon_node
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
..
beacon_chain Avoid parallel fork choice runs during sync (#3217) 2022-05-25 03:27:30 +00:00
client Allow TaskExecutor to be used in async tests (#3178) 2022-05-16 08:35:59 +00:00
eth1 Improve eth1 block cache sync (for Ropsten) (#3234) 2022-06-03 06:05:03 +00:00
execution_layer Emit log when fee recipient values are inconsistent (#3202) 2022-06-03 03:22:54 +00:00
genesis Update and consolidate dependencies (#3136) 2022-04-04 00:26:16 +00:00
http_api Use genesis slot for node/syncing (#3226) 2022-05-31 06:09:11 +00:00
http_metrics Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
lighthouse_network Tiny improvement: PeerManager and maximum discovery query (#3182) 2022-05-19 06:00:46 +00:00
network Fix typo in peer state transition log (#3224) 2022-05-31 06:09:10 +00:00
operation_pool Remove DB migrations for legacy database schemas (#3181) 2022-05-17 04:54:39 +00:00
src Improve eth1 block cache sync (for Ropsten) (#3234) 2022-06-03 06:05:03 +00:00
store Separate execution payloads in the DB (#3157) 2022-05-12 00:42:17 +00:00
tests Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
timer Call per_slot_task from a blocking thread (v2) (#3199) 2022-05-20 23:05:07 +00:00
Cargo.toml v2.3.0 (#3222) 2022-05-30 01:35:10 +00:00