mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-27 17:53:42 +00:00
Add untested attestation validation logic
This commit is contained in:
34
beacon_chain/attestation_validation/src/enums.rs
Normal file
34
beacon_chain/attestation_validation/src/enums.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
/// Reasons why an `AttestationRecord` can be invalid.
|
||||
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`.
|
||||
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.
|
||||
pub enum Error {
|
||||
BlockHasNoParent,
|
||||
BadValidatorIndex,
|
||||
UnableToLookupBlockAtSlot,
|
||||
OutOfBoundsBitfieldIndex,
|
||||
PublicKeyCorrupt,
|
||||
NoPublicKeyForValidator,
|
||||
DBError(String),
|
||||
}
|
||||
Reference in New Issue
Block a user