lighthouse/beacon_node/store/src
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
..
impls Clean capella (#4019) 2023-03-01 03:19:02 +00:00
chunk_writer.rs Implement checkpoint sync (#2244) 2021-09-22 00:37:28 +00:00
chunked_iter.rs Fix bug in block root storage (#4663) 2023-08-28 05:34:28 +00:00
chunked_vector.rs rust 1.72 lints (#4659) 2023-08-24 14:33:24 -04:00
config.rs use state cache to optimise historical state lookup (#4228) 2023-05-05 00:51:57 +00:00
errors.rs Fix Capella schema downgrades (#4004) 2023-02-20 17:50:42 +11:00
forwards_iter.rs Fix bug in block root storage (#4663) 2023-08-28 05:34:28 +00:00
garbage_collection.rs Compact database on finalization (#1871) 2020-11-09 07:02:21 +00:00
hot_cold_store.rs Fix bug in block root storage (#4663) 2023-08-28 05:34:28 +00:00
impls.rs Separate execution payloads in the DB (#3157) 2022-05-12 00:42:17 +00:00
iter.rs Fix lints for Rust 1.63 (#3459) 2022-08-12 00:56:39 +00:00
leveldb_store.rs rust 1.72 lints (#4659) 2023-08-24 14:33:24 -04:00
lib.rs Clean capella (#4019) 2023-03-01 03:19:02 +00:00
memory_store.rs Initial Commit of Retrospective OTB Verification (#3372) 2022-07-30 00:22:38 +00:00
metadata.rs Remove checkpoint alignment requirements and enable historic state pruning (#4610) 2023-08-21 05:02:32 +00:00
metrics.rs Implement slasher (#1567) 2020-11-23 03:43:22 +00:00
partial_beacon_state.rs Cache target attester balances for unrealized FFG progression calculation (#4362) 2023-06-30 01:13:06 +00:00
reconstruct.rs Cache target attester balances for unrealized FFG progression calculation (#4362) 2023-06-30 01:13:06 +00:00