From 4e46e92bb372d0cb2a8dc7617b60c2858ad6c15e Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Tue, 9 Jun 2026 10:51:41 +0300 Subject: [PATCH] fail if the slashing cache validator is uninitialized --- consensus/types/src/state/beacon_state.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/consensus/types/src/state/beacon_state.rs b/consensus/types/src/state/beacon_state.rs index 5b9c5af3a7..f4b15ce716 100644 --- a/consensus/types/src/state/beacon_state.rs +++ b/consensus/types/src/state/beacon_state.rs @@ -1398,15 +1398,10 @@ impl BeaconState { // Post-Gloas, slashed validators are excluded from proposer selection if self.fork_name_unchecked().gloas_enabled() { - if self.slashings_cache_is_initialized() { - let slashings_cache = self.slashings_cache(); - indices.retain(|&index| !slashings_cache.is_slashed(index)); - } else { - // Fallback incase the slashing cache isnt initialized for the current slot. - // The slashing cache may be cold during block replay or state reconstruction. - // This fallback makes the slashing checks infallible. - indices.retain(|&index| self.validators().get(index).is_some_and(|v| !v.slashed)); - } + let latest_block_slot = self.latest_block_header().slot; + let slashings_cache = self.slashings_cache(); + slashings_cache.check_initialized(latest_block_slot)?; + indices.retain(|&index| !slashings_cache.is_slashed(index)); } let preimage = self.get_seed(epoch, Domain::BeaconProposer, spec)?;