Return a specific error for frozen attn states (#2384)
## Issue Addressed NA ## Proposed Changes Return a very specific error when at attestation reads shuffling from a frozen `BeaconState`. Previously, this was returning `MissingBeaconState` which indicates a much more serious issue. ## Additional Info Since `get_inconsistent_state_for_attestation_verification_only` is only called once in `BeaconChain::with_committee_cache`, it is quite easy to reason about the impact of this change.
This commit is contained in:
parent
ba9c4c5eea
commit
bf4e02e2cc
@ -106,6 +106,11 @@ pub enum HotColdDBError {
|
||||
IterationError {
|
||||
unexpected_key: BytesKey,
|
||||
},
|
||||
AttestationStateIsFinalized {
|
||||
split_slot: Slot,
|
||||
request_slot: Option<Slot>,
|
||||
state_root: Hash256,
|
||||
},
|
||||
}
|
||||
|
||||
impl<E: EthSpec> HotColdDB<E, MemoryStore<E>, MemoryStore<E>> {
|
||||
@ -345,8 +350,15 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
||||
) -> Result<Option<BeaconState<E>>, Error> {
|
||||
metrics::inc_counter(&metrics::BEACON_STATE_GET_COUNT);
|
||||
|
||||
if slot.map_or(false, |slot| slot < self.get_split_slot()) {
|
||||
Ok(None)
|
||||
let split_slot = self.get_split_slot();
|
||||
|
||||
if slot.map_or(false, |slot| slot < split_slot) {
|
||||
Err(HotColdDBError::AttestationStateIsFinalized {
|
||||
split_slot,
|
||||
request_slot: slot,
|
||||
state_root: *state_root,
|
||||
}
|
||||
.into())
|
||||
} else {
|
||||
self.load_hot_state(state_root, BlockReplay::InconsistentStateRoots)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user