diff --git a/beacon_node/http_api/src/attestation_performance.rs b/beacon_node/http_api/src/attestation_performance.rs index 2b4543656..ca68d4d04 100644 --- a/beacon_node/http_api/src/attestation_performance.rs +++ b/beacon_node/http_api/src/attestation_performance.rs @@ -83,6 +83,10 @@ pub fn get_attestation_performance( } // Either use the global validator set, or the specified index. + // + // Does no further validation of the indices, so in the event an index has not yet been + // activated or does not yet exist (according to the head state), it will return all fields as + // `false`. let index_range = if target.to_lowercase() == "global" { chain .with_head(|head| Ok((0..head.beacon_state.validators().len() as u64).collect())) diff --git a/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs b/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs index 5e15aa3e1..6eb2f9776 100644 --- a/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs +++ b/consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs @@ -129,7 +129,12 @@ impl EpochProcessingSummary { EpochProcessingSummary::Altair { participation_cache, .. - } => participation_cache.is_current_epoch_timely_target_attester(val_index), + } => participation_cache + .is_current_epoch_timely_target_attester(val_index) + .or_else(|e| match e { + ParticipationCacheError::InvalidValidatorIndex(_) => Ok(false), + e => Err(e), + }), } } @@ -222,7 +227,12 @@ impl EpochProcessingSummary { EpochProcessingSummary::Altair { participation_cache, .. - } => participation_cache.is_previous_epoch_timely_target_attester(val_index), + } => participation_cache + .is_previous_epoch_timely_target_attester(val_index) + .or_else(|e| match e { + ParticipationCacheError::InvalidValidatorIndex(_) => Ok(false), + e => Err(e), + }), } } @@ -248,7 +258,12 @@ impl EpochProcessingSummary { EpochProcessingSummary::Altair { participation_cache, .. - } => participation_cache.is_previous_epoch_timely_head_attester(val_index), + } => participation_cache + .is_previous_epoch_timely_head_attester(val_index) + .or_else(|e| match e { + ParticipationCacheError::InvalidValidatorIndex(_) => Ok(false), + e => Err(e), + }), } } @@ -274,7 +289,12 @@ impl EpochProcessingSummary { EpochProcessingSummary::Altair { participation_cache, .. - } => participation_cache.is_previous_epoch_timely_source_attester(val_index), + } => participation_cache + .is_previous_epoch_timely_source_attester(val_index) + .or_else(|e| match e { + ParticipationCacheError::InvalidValidatorIndex(_) => Ok(false), + e => Err(e), + }), } }