2019-03-07 01:53:15 +00:00
|
|
|
use fork_choice::ForkChoiceError;
|
|
|
|
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-03-07 01:53:15 +00:00
|
|
|
BeaconStateError(BeaconStateError),
|
|
|
|
DBInconsistent(String),
|
2019-05-21 07:27:06 +00:00
|
|
|
DBError(db::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-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,
|
|
|
|
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);
|