d23437f726
## Issue Addressed NA ## Proposed Changes Ensure that we read the current slot from the `fc_store` rather than the slot clock. This is because the `fc_store` will never allow the slot to go backwards, even if the system clock does. The `ProtoArray::find_head` function assumes a non-decreasing slot. This issue can cause logs like this: ``` ERRO Error whist recomputing head, error: ForkChoiceError(ProtoArrayError("find_head failed: InvalidBestNode(InvalidBestNodeInfo { start_root: 0xb22655aa2ae23075a60bd40797b3ba220db33d6fb86fa7910f0ed48e34bda72f, justified_checkpoint: Checkpoint { epoch: Epoch(111569), root: 0xb22655aa2ae23075a60bd40797b3ba220db33d6fb86fa7910f0ed48e34bda72f }, finalized_checkpoint: Checkpoint { epoch: Epoch(111568), root: 0x6140797e40c587b0d3f159483bbc603accb7b3af69891979d63efac437f9896f }, head_root: 0xb22655aa2ae23075a60bd40797b3ba220db33d6fb86fa7910f0ed48e34bda72f, head_justified_checkpoint: Some(Checkpoint { epoch: Epoch(111568), root: 0x6140797e40c587b0d3f159483bbc603accb7b3af69891979d63efac437f9896f }), head_finalized_checkpoint: Some(Checkpoint { epoch: Epoch(111567), root: 0x59b913d37383a158a9ea5546a572acc79e2cdfbc904c744744789d2c3814c570 }) })")), service: beacon, module: beacon_chain::canonical_head:499 ``` We expect nodes to automatically recover from this issue within seconds without any major impact. However, having *any* errors in the path of fork choice is undesirable and should be avoided. ## Additional Info NA
63 lines
1.8 KiB
Rust
63 lines
1.8 KiB
Rust
use types::{Checkpoint, Epoch, ExecutionBlockHash, Hash256, Slot};
|
|
|
|
#[derive(Clone, PartialEq, Debug)]
|
|
pub enum Error {
|
|
FinalizedNodeUnknown(Hash256),
|
|
JustifiedNodeUnknown(Hash256),
|
|
NodeUnknown(Hash256),
|
|
InvalidFinalizedRootChange,
|
|
InvalidNodeIndex(usize),
|
|
InvalidParentIndex(usize),
|
|
InvalidBestChildIndex(usize),
|
|
InvalidJustifiedIndex(usize),
|
|
InvalidBestDescendant(usize),
|
|
InvalidParentDelta(usize),
|
|
InvalidNodeDelta(usize),
|
|
DeltaOverflow(usize),
|
|
ProposerBoostOverflow(usize),
|
|
IndexOverflow(&'static str),
|
|
InvalidExecutionDeltaOverflow(usize),
|
|
InvalidDeltaLen {
|
|
deltas: usize,
|
|
indices: usize,
|
|
},
|
|
RevertedFinalizedEpoch {
|
|
current_finalized_epoch: Epoch,
|
|
new_finalized_epoch: Epoch,
|
|
},
|
|
InvalidBestNode(Box<InvalidBestNodeInfo>),
|
|
InvalidAncestorOfValidPayload {
|
|
ancestor_block_root: Hash256,
|
|
ancestor_payload_block_hash: ExecutionBlockHash,
|
|
},
|
|
ValidExecutionStatusBecameInvalid {
|
|
block_root: Hash256,
|
|
payload_block_hash: ExecutionBlockHash,
|
|
},
|
|
InvalidJustifiedCheckpointExecutionStatus {
|
|
justified_root: Hash256,
|
|
},
|
|
UnknownLatestValidAncestorHash {
|
|
block_root: Hash256,
|
|
latest_valid_ancestor_hash: Option<ExecutionBlockHash>,
|
|
},
|
|
IrrelevantDescendant {
|
|
block_root: Hash256,
|
|
},
|
|
ParentExecutionStatusIsInvalid {
|
|
block_root: Hash256,
|
|
parent_root: Hash256,
|
|
},
|
|
}
|
|
|
|
#[derive(Clone, PartialEq, Debug)]
|
|
pub struct InvalidBestNodeInfo {
|
|
pub current_slot: Slot,
|
|
pub start_root: Hash256,
|
|
pub justified_checkpoint: Checkpoint,
|
|
pub finalized_checkpoint: Checkpoint,
|
|
pub head_root: Hash256,
|
|
pub head_justified_checkpoint: Option<Checkpoint>,
|
|
pub head_finalized_checkpoint: Option<Checkpoint>,
|
|
}
|