Shrink persisted fork choice data (#7805)

Closes:

- https://github.com/sigp/lighthouse/issues/7760


  - [x] Remove `balances_cache` from `PersistedForkChoiceStore` (~65 MB saving on mainnet)
- [x] Remove `justified_balances` from `PersistedForkChoiceStore` (~16 MB saving on mainnet)
- [x] Remove `balances` from `ProtoArray`/`SszContainer`.
- [x] Implement zstd compression for votes
- [x] Fix bug in justified state usage
- [x] Bump schema version to V28 and implement migration.
This commit is contained in:
Michael Sproul
2025-08-18 16:03:28 +10:00
committed by GitHub
parent 08234b2823
commit 836c39efaa
26 changed files with 610 additions and 127 deletions

View File

@@ -355,6 +355,18 @@ impl StateSummariesDAG {
}
Ok(descendants)
}
/// Returns the root of the state at `slot` with `latest_block_root`, if it exists.
///
/// The `slot` must be the slot of the `latest_block_root` or a skipped slot following it. This
/// function will not return the `state_root` of a state with a different `latest_block_root`
/// even if it lies on the same chain.
pub fn state_root_at_slot(&self, latest_block_root: Hash256, slot: Slot) -> Option<Hash256> {
self.state_summaries_by_block_root
.get(&latest_block_root)?
.get(&slot)
.map(|(state_root, _)| *state_root)
}
}
impl From<HotStateSummary> for DAGStateSummary {