This commit syncs Prater

This commit is contained in:
Michael Sproul
2022-02-03 20:23:30 +11:00
parent 6c05b1de9b
commit f6230a5143
7 changed files with 30 additions and 15 deletions

View File

@@ -417,6 +417,12 @@ where
let (_, updated_builder) = self.set_genesis_state(genesis_state)?;
self = updated_builder;
// Build the committee caches before storing. The database assumes that states have
// committee caches built before storing.
weak_subj_state
.build_all_committee_caches(&self.spec)
.map_err(|e| format!("Error building caches on checkpoint state: {:?}", e))?;
// Write the state and block non-atomically, it doesn't matter if they're forgotten
// about on a crash restart.
store

View File

@@ -111,12 +111,11 @@ impl<T: BeaconChainTypes> ValidatorPubkeyCache<T> {
state: &BeaconState<T::EthSpec>,
) -> Result<(), BeaconChainError> {
if state.validators().len() > self.pubkeys.len() {
// FIXME(sproul): iter_from would be more efficient than `skip` here
self.import(
state
.validators()
.iter()
.skip(self.pubkeys.len())
.iter_from(self.pubkeys.len())
.unwrap() // FIXME(sproul)
.map(|v| v.pubkey),
)
} else {