This commit is contained in:
Mac L
2024-05-02 16:06:28 +10:00
parent 689cdaef61
commit d9a0c3d6c2
10 changed files with 139 additions and 157 deletions

View File

@@ -15,8 +15,8 @@ use std::time::Duration;
use types::{
consts::bellatrix::INTERVALS_PER_SLOT, AbstractExecPayload, AttestationShufflingId,
AttesterSlashing, BeaconBlockRef, BeaconState, BeaconStateError, ChainSpec, Checkpoint, Epoch,
EthSpec, ExecPayload, ExecutionBlockHash, Hash256, IndexedAttestation, RelativeEpoch,
SignedBeaconBlock, Slot,
EthSpec, ExecPayload, ExecutionBlockHash, FeatureName, Hash256, IndexedAttestation,
RelativeEpoch, SignedBeaconBlock, Slot,
};
#[derive(Debug)]
@@ -747,20 +747,15 @@ where
if let Some((parent_justified, parent_finalized)) = parent_checkpoints {
(parent_justified, parent_finalized)
} else {
let justification_and_finalization_state = match block {
BeaconBlockRef::Electra(_)
| BeaconBlockRef::Deneb(_)
| BeaconBlockRef::Capella(_)
| BeaconBlockRef::Bellatrix(_)
| BeaconBlockRef::Altair(_) => {
let justification_and_finalization_state =
if block.fork_name_unchecked().has_feature(FeatureName::Altair) {
// NOTE: Processing justification & finalization requires the progressive
// balances cache, but we cannot initialize it here as we only have an
// immutable reference. The state *should* have come straight from block
// processing, which initialises the cache, but if we add other `on_block`
// calls in future it could be worth passing a mutable reference.
per_epoch_processing::altair::process_justification_and_finalization(state)?
}
BeaconBlockRef::Base(_) => {
} else {
let mut validator_statuses =
per_epoch_processing::base::ValidatorStatuses::new(state, spec)
.map_err(Error::ValidatorStatuses)?;
@@ -772,8 +767,7 @@ where
&validator_statuses.total_balances,
spec,
)?
}
};
};
(
justification_and_finalization_state.current_justified_checkpoint(),