lighthouse/beacon_node
Michael Sproul f284e0e264 Fix bug in block root storage (#4663)
## Issue Addressed

Fix a bug in the storage of the linear block roots array in the freezer DB. Previously this array was always written as part of state storage (or block backfill). With state pruning enabled by #4610, these states were no longer being written and as a result neither were the block roots.

The impact is quite low, we would just log an error when trying to forwards-iterate the block roots, which for validating nodes only happens when they try to look up blocks for peers:

> Aug 25 03:42:36.980 ERRO Missing chunk in forwards iterator      chunk index: 49726, service: freezer_db

Any node checkpoint synced off `unstable` is affected and has a corrupt database. If you see the log above, you need to re-sync with the fix. Nodes that haven't checkpoint synced recently should _not_ be corrupted, even if they ran the buggy version.

## Proposed Changes

- Use a `ChunkWriter` to write the block roots when states are not being stored.
- Tweak the usage of `get_latest_restore_point` so that it doesn't return a nonsense value when state pruning is enabled.
- Tweak the guarantee on the block roots array so that block roots are assumed available up to the split slot (exclusive). This is a bit nicer than relying on anything to do with the latest restore point, which is a nonsensical concept when there aren't any restore points.

## Additional Info

I'm looking forward to deleting the chunked vector code for good when we merge tree-states 😁
2023-08-28 05:34:28 +00:00
..
beacon_chain Fix bug in block root storage (#4663) 2023-08-28 05:34:28 +00:00
beacon_processor Fix beacon-processor-max-workers (#4636) 2023-08-21 05:02:34 +00:00
builder_client Tidy formatting of Reqwest errors (#4336) 2023-06-27 01:06:50 +00:00
client Add Holesky (#4653) 2023-08-28 05:34:27 +00:00
eth1 Replace ganache-cli with anvil (#3555) 2023-05-15 07:22:02 +00:00
execution_layer update dependencies (#4639) 2023-08-28 00:55:28 +00:00
genesis rust 1.72 lints (#4659) 2023-08-24 14:33:24 -04:00
http_api Send success code for duplicate blocks on HTTP (#4655) 2023-08-28 00:55:31 +00:00
http_metrics upgrade to libp2p 0.52 (#4431) 2023-08-02 00:59:34 +00:00
lighthouse_network rust 1.72 lints (#4659) 2023-08-24 14:33:24 -04:00
network Do not log slot clock error prior to genesis (#4657) 2023-08-28 00:55:32 +00:00
operation_pool Fix some typos (#4565) 2023-08-14 00:29:43 +00:00
src Add Holesky (#4653) 2023-08-28 05:34:27 +00:00
store Fix bug in block root storage (#4663) 2023-08-28 05:34:28 +00:00
tests Appease Clippy 1.68 and refactor http_api (#4068) 2023-03-13 01:40:03 +00:00
timer Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
Cargo.toml Add Holesky (#4653) 2023-08-28 05:34:27 +00:00