Files
lighthouse/consensus/proto_array/src/error.rs
2026-06-21 17:29:59 +03:00

81 lines
2.2 KiB
Rust

use crate::PayloadStatus;
use safe_arith::ArithError;
use types::{Epoch, ExecutionBlockHash, Hash256, Slot};
#[derive(Clone, PartialEq, Debug)]
pub enum Error {
FinalizedNodeUnknown(Hash256),
JustifiedNodeUnknown(Hash256),
NodeUnknown(Hash256),
InvalidFinalizedRootChange,
InvalidNodeIndex(usize),
InvalidJustifiedIndex(usize),
InvalidBestDescendant(usize),
InvalidParentDelta(usize),
InvalidNodeDelta(usize),
MissingJustifiedCheckpoint,
MissingFinalizedCheckpoint,
DeltaOverflow(usize),
ProposerBoostOverflow(usize),
ReOrgThresholdOverflow,
IndexOverflow(&'static str),
InvalidExecutionDeltaOverflow(usize),
InvalidDeltaLen {
deltas: usize,
indices: usize,
},
RevertedFinalizedEpoch {
current_finalized_epoch: Epoch,
new_finalized_epoch: Epoch,
},
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,
},
Arith(ArithError),
InvalidNodeVariant {
block_root: Hash256,
},
BrokenBlock {
block_root: Hash256,
},
NoViableChildren,
OnBlockRequiresProposerIndex,
InvalidPayloadStatus {
block_root: Hash256,
payload_status: PayloadStatus,
},
/// `should_extend_payload` was called for a block whose slot is not the previous slot.
///
/// Spec equivalent: `assert store.blocks[root].slot + 1 == get_current_slot(store)`.
ShouldExtendPayloadInvalidSlot {
block_root: Hash256,
block_slot: Slot,
current_slot: Slot,
},
}
impl From<ArithError> for Error {
fn from(e: ArithError) -> Self {
Error::Arith(e)
}
}