revm_wiring/
evm_wiring.rsuse crate::{result::HaltReason, Block};
use core::{fmt::Debug, hash::Hash};
use database_interface::{Database, EmptyDB};
use specification::hardfork::SpecId;
use transaction::Transaction;
pub trait HardforkTrait: Clone + Copy + Default + PartialEq + Eq + Into<SpecId> {}
impl<HardforkT> HardforkTrait for HardforkT where
HardforkT: Clone + Copy + Default + PartialEq + Eq + Into<SpecId>
{
}
pub trait HaltReasonTrait: Clone + Debug + PartialEq + Eq + From<HaltReason> {}
impl<HaltReasonT> HaltReasonTrait for HaltReasonT where
HaltReasonT: Clone + Debug + PartialEq + Eq + From<HaltReason>
{
}
pub trait EvmWiring: Sized {
type ExternalContext: Sized;
type ChainContext: Sized + Default + Debug;
type Database: Database;
type Block: Block;
type Transaction: Transaction;
type Hardfork: HardforkTrait;
type HaltReason: HaltReasonTrait;
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct EthereumWiring<DB: Database, EXT> {
phantom: core::marker::PhantomData<(DB, EXT)>,
}
impl<DB: Database, EXT: Debug> EvmWiring for EthereumWiring<DB, EXT> {
type Database = DB;
type ExternalContext = EXT;
type ChainContext = ();
type Block = crate::default::block::BlockEnv;
type Transaction = crate::default::TxEnv;
type Hardfork = SpecId;
type HaltReason = crate::result::HaltReason;
}
pub type DefaultEthereumWiring = EthereumWiring<EmptyDB, ()>;