lighthouse/beacon_node
Michael Sproul ed1fc7cca6 Fix I/O atomicity issues with checkpoint sync (#2671)
## Issue Addressed

This PR addresses an issue found by @YorickDowne during testing of v2.0.0-rc.0.

Due to a lack of atomic database writes on checkpoint sync start-up, it was possible for the database to get into an inconsistent state from which it couldn't recover without `--purge-db`. The core of the issue was that the store's anchor info was being stored _before_ the `PersistedBeaconChain`. If a crash occured so that anchor info was stored but _not_ the `PersistedBeaconChain`, then on restart Lighthouse would think the database was unitialized and attempt to compare-and-swap a `None` value, but would actually find the stale info from the previous run.

## Proposed Changes

The issue is fixed by writing the anchor info, the split point, and the `PersistedBeaconChain` atomically on start-up. Some type-hinting ugliness was required, which could possibly be cleaned up in future refactors.
2021-10-05 03:53:17 +00:00
..
beacon_chain Fix I/O atomicity issues with checkpoint sync (#2671) 2021-10-05 03:53:17 +00:00
client Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
eth1 Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
eth2_libp2p Consistent tracking of disconnected peers (#2650) 2021-09-30 04:31:43 +00:00
genesis Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
http_api Fix chain_id value in config/deposit_contract RPC method (#2659) 2021-10-01 06:32:38 +00:00
http_metrics Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
network Consistent tracking of disconnected peers (#2650) 2021-09-30 04:31:43 +00:00
operation_pool Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
src Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
store Fix I/O atomicity issues with checkpoint sync (#2671) 2021-10-05 03:53:17 +00:00
tests Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
timer Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
websocket_server Server sent events (#1920) 2020-12-04 00:18:58 +00:00
Cargo.toml Release v2.0.0-rc.0 (#2634) 2021-10-01 01:23:55 +00:00