Merge remote-tracking branch 'origin/release-v7.0.0' into unstable

This commit is contained in:
Michael Sproul
2025-03-29 13:01:58 +11:00
21 changed files with 364 additions and 48 deletions

View File

@@ -820,10 +820,30 @@ where
));
}
let validator_pubkey_cache = self.validator_pubkey_cache.map(Ok).unwrap_or_else(|| {
ValidatorPubkeyCache::new(&head_snapshot.beacon_state, store.clone())
.map_err(|e| format!("Unable to init validator pubkey cache: {:?}", e))
})?;
let validator_pubkey_cache = self
.validator_pubkey_cache
.map(|mut validator_pubkey_cache| {
// If any validators weren't persisted to disk on previous runs, this will use the head state to
// "top-up" the in-memory validator cache and its on-disk representation with any missing validators.
let pubkey_store_ops = validator_pubkey_cache
.import_new_pubkeys(&head_snapshot.beacon_state)
.map_err(|e| format!("Unable to top-up persisted pubkey cache {:?}", e))?;
if !pubkey_store_ops.is_empty() {
// Write any missed validators to disk
debug!(
missing_validators = pubkey_store_ops.len(),
"Topping up validator pubkey cache"
);
store
.do_atomically_with_block_and_blobs_cache(pubkey_store_ops)
.map_err(|e| format!("Unable to write pubkeys to disk {:?}", e))?;
}
Ok(validator_pubkey_cache)
})
.unwrap_or_else(|| {
ValidatorPubkeyCache::new(&head_snapshot.beacon_state, store.clone())
.map_err(|e| format!("Unable to init validator pubkey cache: {:?}", e))
})?;
let migrator_config = self.store_migrator_config.unwrap_or_default();
let store_migrator =