Implement checkpoint sync (#2244)

## Issue Addressed

Closes #1891
Closes #1784

## Proposed Changes

Implement checkpoint sync for Lighthouse, enabling it to start from a weak subjectivity checkpoint.

## Additional Info

- [x] Return unavailable status for out-of-range blocks requested by peers (#2561)
- [x] Implement sync daemon for fetching historical blocks (#2561)
- [x] Verify chain hashes (either in `historical_blocks.rs` or the calling module)
- [x] Consistency check for initial block + state
- [x] Fetch the initial state and block from a beacon node HTTP endpoint
- [x] Don't crash fetching beacon states by slot from the API
- [x] Background service for state reconstruction, triggered by CLI flag or API call.

Considered out of scope for this PR:

- Drop the requirement to provide the `--checkpoint-block` (this would require some pretty heavy refactoring of block verification)


Co-authored-by: Diva M <divma@protonmail.com>
This commit is contained in:
Michael Sproul
2021-09-22 00:37:28 +00:00
parent 280e4fe23d
commit 9667dc2f03
71 changed files with 4012 additions and 459 deletions

31
Cargo.lock generated
View File

@@ -895,6 +895,7 @@ dependencies = [
"environment",
"error-chain",
"eth1",
"eth2",
"eth2_config",
"eth2_libp2p",
"eth2_ssz 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -909,6 +910,7 @@ dependencies = [
"parking_lot",
"prometheus",
"reqwest",
"sensitive_url",
"serde",
"serde_derive",
"serde_yaml",
@@ -938,17 +940,6 @@ dependencies = [
"cc",
]
[[package]]
name = "colored"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59"
dependencies = [
"atty",
"lazy_static",
"winapi",
]
[[package]]
name = "compare_fields"
version = "0.2.0"
@@ -1714,6 +1705,7 @@ dependencies = [
"sensitive_url",
"serde",
"serde_json",
"store",
"types",
"zeroize",
]
@@ -3065,6 +3057,7 @@ dependencies = [
"deposit_contract",
"directory",
"dirs",
"env_logger 0.9.0",
"environment",
"eth1_test_rig",
"eth2_keystore",
@@ -3081,8 +3074,8 @@ dependencies = [
"regex",
"sensitive_url",
"serde",
"serde_json",
"serde_yaml",
"simple_logger",
"state_processing",
"tokio",
"tree_hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5628,19 +5621,6 @@ dependencies = [
"rand_core 0.6.3",
]
[[package]]
name = "simple_logger"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7de33c687404ec3045d4a0d437580455257c0436f858d702f244e7d652f9f07"
dependencies = [
"atty",
"chrono",
"colored",
"log",
"winapi",
]
[[package]]
name = "simulator"
version = "0.2.0"
@@ -6774,6 +6754,7 @@ dependencies = [
"serde_json",
"serde_yaml",
"slog",
"state_processing",
"superstruct",
"swap_or_not_shuffle",
"tempfile",