use casper_execution_engine::{
core::engine_state::{Error as EngineStateError, StepError},
storage::error::db::Error as StorageLmdbError,
};
use crate::{
components::contract_runtime::ExecutionPreState,
types::{error::BlockCreationError, FinalizedBlock},
};
use casper_execution_engine::core::engine_state::GetEraValidatorsError;
#[derive(Debug, thiserror::Error)]
pub(crate) enum ConfigError {
#[error("failed to initialize LMDB environment for contract runtime: {0}")]
Lmdb(#[from] StorageLmdbError),
#[error("failed to initialize metrics for contract runtime: {0}")]
Prometheus(#[from] prometheus::Error),
#[error("failed to initialize execution engine: {0}")]
EngineState(#[from] EngineStateError),
}
#[derive(Debug, thiserror::Error)]
pub enum BlockExecutionError {
#[error("More than one execution result")]
MoreThanOneExecutionResult,
#[error(
"Block's height does not agree with execution pre-state. \
Block: {finalized_block:?}, \
Execution pre-state: {execution_pre_state:?}"
)]
WrongBlockHeight {
finalized_block: Box<FinalizedBlock>,
execution_pre_state: Box<ExecutionPreState>,
},
#[error(transparent)]
EngineStateError(#[from] EngineStateError),
#[error(transparent)]
StepError(#[from] StepError),
#[error(transparent)]
BlockCreationError(#[from] BlockCreationError),
#[error(transparent)]
LmdbError(#[from] lmdb::Error),
#[error(transparent)]
GetEraValidatorsError(#[from] GetEraValidatorsError),
}
#[derive(Debug, thiserror::Error)]
pub(crate) enum BlockExecutionEventsError {
#[error(transparent)]
BlockExecutionError(#[from] BlockExecutionError),
#[error(transparent)]
GetEraValidatorsError(#[from] GetEraValidatorsError),
}