lighthouse/eth2/attestation_validation/src/enums.rs

38 lines
1.1 KiB
Rust
Raw Normal View History

/// Reasons why an `AttestationRecord` can be invalid.
2018-12-06 07:41:22 +00:00
#[derive(PartialEq, Debug)]
pub enum Invalid {
AttestationTooRecent,
AttestationTooOld,
JustifiedSlotImpermissable,
JustifiedBlockNotInChain,
JustifiedBlockHashMismatch,
UnknownShard,
ShardBlockHashMismatch,
SignatureInvalid,
}
/// The outcome of validating the `AttestationRecord`.
///
/// Distinct from the `Error` enum as an `Outcome` indicates that validation executed sucessfully
/// and determined the validity `AttestationRecord`.
2018-12-06 07:41:22 +00:00
#[derive(PartialEq, Debug)]
pub enum Outcome {
Valid,
Invalid(Invalid),
}
/// Errors that prevent this function from correctly validating the `AttestationRecord`.
///
/// Distinct from the `Outcome` enum as `Errors` indicate that validation encountered an unexpected
/// condition and was unable to perform its duty.
2018-12-06 07:41:22 +00:00
#[derive(PartialEq, Debug)]
pub enum Error {
BlockHasNoParent,
BadValidatorIndex,
UnableToLookupBlockAtSlot,
OutOfBoundsBitfieldIndex,
PublicKeyCorrupt,
NoPublicKeyForValidator,
DBError(String),
}