mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 05:48:31 +00:00
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:
@@ -121,8 +121,8 @@ use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use store::iter::{BlockRootsIterator, ParentRootBlockIterator, StateRootsIterator};
|
||||
use store::{
|
||||
BlobSidecarListFromRoot, DatabaseBlock, Error as DBError, HotColdDB, HotStateSummary,
|
||||
KeyValueStoreOp, StoreItem, StoreOp,
|
||||
BlobSidecarListFromRoot, DBColumn, DatabaseBlock, Error as DBError, HotColdDB, HotStateSummary,
|
||||
KeyValueStore, KeyValueStoreOp, StoreItem, StoreOp,
|
||||
};
|
||||
use task_executor::{ShutdownReason, TaskExecutor};
|
||||
use tokio_stream::Stream;
|
||||
@@ -618,12 +618,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
reset_payload_statuses: ResetPayloadStatuses,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<Option<BeaconForkChoice<T>>, Error> {
|
||||
let Some(persisted_fork_choice) =
|
||||
store.get_item::<PersistedForkChoice>(&FORK_CHOICE_DB_KEY)?
|
||||
let Some(persisted_fork_choice_bytes) = store
|
||||
.hot_db
|
||||
.get_bytes(DBColumn::ForkChoice, FORK_CHOICE_DB_KEY.as_slice())?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
let persisted_fork_choice =
|
||||
PersistedForkChoice::from_bytes(&persisted_fork_choice_bytes, store.get_config())?;
|
||||
let fc_store =
|
||||
BeaconForkChoiceStore::from_persisted(persisted_fork_choice.fork_choice_store, store)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user