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

@@ -4,6 +4,7 @@ mod migration_schema_v24;
mod migration_schema_v25;
mod migration_schema_v26;
mod migration_schema_v27;
mod migration_schema_v28;
use crate::beacon_chain::BeaconChainTypes;
use std::sync::Arc;
@@ -79,6 +80,14 @@ pub fn migrate_schema<T: BeaconChainTypes>(
migration_schema_v27::downgrade_from_v27::<T>(db.clone())?;
db.store_schema_version_atomically(to, vec![])
}
(SchemaVersion(27), SchemaVersion(28)) => {
let ops = migration_schema_v28::upgrade_to_v28::<T>(db.clone())?;
db.store_schema_version_atomically(to, ops)
}
(SchemaVersion(28), SchemaVersion(27)) => {
let ops = migration_schema_v28::downgrade_from_v28::<T>(db.clone())?;
db.store_schema_version_atomically(to, ops)
}
// Anything else is an error.
(_, _) => Err(HotColdDBError::UnsupportedSchemaVersion {
target_version: to,