2019-06-15 18:03:29 +00:00
|
|
|
use crate::fork_choice::Error as ForkChoiceError;
|
2019-08-29 01:34:25 +00:00
|
|
|
use state_processing::per_block_processing::errors::AttestationValidationError;
|
2019-03-07 01:53:15 +00:00
|
|
|
use state_processing::BlockProcessingError;
|
2019-03-24 05:35:07 +00:00
|
|
|
use state_processing::SlotProcessingError;
|
2019-03-07 01:53:15 +00:00
|
|
|
use types::*;
|
|
|
|
|
|
|
|
macro_rules! easy_from_to {
|
|
|
|
($from: ident, $to: ident) => {
|
|
|
|
impl From<$from> for $to {
|
|
|
|
fn from(e: $from) -> $to {
|
|
|
|
$to::$from(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
|
|
pub enum BeaconChainError {
|
|
|
|
InsufficientValidators,
|
|
|
|
BadRecentBlockRoots,
|
2019-03-24 05:35:07 +00:00
|
|
|
UnableToReadSlot,
|
2019-06-23 04:47:23 +00:00
|
|
|
RevertedFinalizedEpoch {
|
|
|
|
previous_epoch: Epoch,
|
|
|
|
new_epoch: Epoch,
|
|
|
|
},
|
2019-08-29 03:25:55 +00:00
|
|
|
SlotClockDidNotStart,
|
2019-08-14 00:55:24 +00:00
|
|
|
UnableToFindTargetRoot(Slot),
|
2019-03-07 01:53:15 +00:00
|
|
|
BeaconStateError(BeaconStateError),
|
|
|
|
DBInconsistent(String),
|
2019-05-21 08:20:23 +00:00
|
|
|
DBError(store::Error),
|
2019-03-07 01:53:15 +00:00
|
|
|
ForkChoiceError(ForkChoiceError),
|
|
|
|
MissingBeaconBlock(Hash256),
|
|
|
|
MissingBeaconState(Hash256),
|
2019-03-24 05:35:07 +00:00
|
|
|
SlotProcessingError(SlotProcessingError),
|
2019-08-14 00:55:24 +00:00
|
|
|
NoStateForAttestation {
|
|
|
|
beacon_block_root: Hash256,
|
|
|
|
},
|
|
|
|
AttestationValidationError(AttestationValidationError),
|
2019-03-07 01:53:15 +00:00
|
|
|
}
|
|
|
|
|
2019-03-24 05:35:07 +00:00
|
|
|
easy_from_to!(SlotProcessingError, BeaconChainError);
|
|
|
|
|
2019-03-07 01:53:15 +00:00
|
|
|
#[derive(Debug, PartialEq)]
|
|
|
|
pub enum BlockProductionError {
|
|
|
|
UnableToGetBlockRootFromState,
|
2019-06-18 17:01:58 +00:00
|
|
|
UnableToReadSlot,
|
|
|
|
SlotProcessingError(SlotProcessingError),
|
2019-03-07 01:53:15 +00:00
|
|
|
BlockProcessingError(BlockProcessingError),
|
2019-03-21 20:11:04 +00:00
|
|
|
BeaconStateError(BeaconStateError),
|
2019-03-07 01:53:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
easy_from_to!(BlockProcessingError, BlockProductionError);
|
2019-03-21 20:11:04 +00:00
|
|
|
easy_from_to!(BeaconStateError, BlockProductionError);
|
2019-06-18 17:01:58 +00:00
|
|
|
easy_from_to!(SlotProcessingError, BlockProductionError);
|
2019-08-14 00:55:24 +00:00
|
|
|
easy_from_to!(AttestationValidationError, BeaconChainError);
|