lighthouse/beacon_node
Michael Sproul aa45fa3ff7 Revert fork choice if disk write fails (#2068)
## Issue Addressed

Closes #2028
Replaces #2059

## Proposed Changes

If writing to the database fails while importing a block, revert fork choice to the last version stored on disk. This prevents fork choice from being ahead of the blocks on disk. Having fork choice ahead is particularly bad if it is later successfully written to disk, because it renders the database corrupt (see #2028).

## Additional Info

* This mitigation might fail if the head+fork choice haven't been persisted yet, which can only happen at first startup (see #2067)
* This relies on it being OK for the head tracker to be ahead of fork choice. I figure this is tolerable because blocks only get added to the head tracker after successfully being written on disk _and_ to fork choice, so even if fork choice reverts a little bit, when the pruning algorithm runs, those blocks will still be on disk and OK to prune. The pruning algorithm also doesn't rely on heads being unique, technically it's OK for multiple blocks from the same linear chain segment to be present in the head tracker. This begs the question of #1785 (i.e. things would be simpler with the head tracker out of the way). Alternatively, this PR could just revert the head tracker as well (I'll look into this tomorrow).
2020-12-09 05:10:34 +00:00
..
beacon_chain Revert fork choice if disk write fails (#2068) 2020-12-09 05:10:34 +00:00
client update dependencies (#2032) 2020-12-07 08:20:33 +00:00
eth1 Improve compile time (#1989) 2020-12-09 01:34:58 +00:00
eth2_libp2p Downgrades a valid log (#2057) 2020-12-08 10:48:45 +00:00
genesis Improve compile time (#1989) 2020-12-09 01:34:58 +00:00
http_api update dependencies (#2032) 2020-12-07 08:20:33 +00:00
http_metrics update dependencies (#2032) 2020-12-07 08:20:33 +00:00
network Downgrades a valid log (#2057) 2020-12-08 10:48:45 +00:00
operation_pool Update pool/attestations and committees endpoints (#1899) 2020-11-18 23:31:39 +00:00
src fix default network handling (#2029) 2020-12-08 05:41:10 +00:00
store update dependencies (#2032) 2020-12-07 08:20:33 +00:00
tests Upgrade to tokio 0.3 (#1839) 2020-11-28 05:30:57 +00:00
timer Fix new clippy lints (#2036) 2020-12-03 01:10:26 +00:00
websocket_server Server sent events (#1920) 2020-12-04 00:18:58 +00:00
Cargo.toml fix default network handling (#2029) 2020-12-08 05:41:10 +00:00