Files
reth/examples/custom-node/src/evm/config.rs

63 lines
1.7 KiB
Rust

use crate::evm::CustomBlockAssembler;
use alloy_consensus::{Block, Header};
use alloy_evm::EvmEnv;
use alloy_op_evm::OpBlockExecutionCtx;
use op_revm::OpSpecId;
use reth_ethereum::{
node::api::ConfigureEvm,
primitives::{SealedBlock, SealedHeader},
};
use reth_op::{
node::{OpEvmConfig, OpNextBlockEnvAttributes},
OpPrimitives, OpTransactionSigned,
};
#[derive(Debug, Clone)]
pub struct CustomEvmConfig {
pub(super) inner: OpEvmConfig,
pub(super) block_assembler: CustomBlockAssembler,
}
impl ConfigureEvm for CustomEvmConfig {
type Primitives = OpPrimitives;
type Error = <OpEvmConfig as ConfigureEvm>::Error;
type NextBlockEnvCtx = <OpEvmConfig as ConfigureEvm>::NextBlockEnvCtx;
type BlockExecutorFactory = Self;
type BlockAssembler = CustomBlockAssembler;
fn block_executor_factory(&self) -> &Self::BlockExecutorFactory {
self
}
fn block_assembler(&self) -> &Self::BlockAssembler {
&self.block_assembler
}
fn evm_env(&self, header: &Header) -> EvmEnv<OpSpecId> {
self.inner.evm_env(header)
}
fn next_evm_env(
&self,
parent: &Header,
attributes: &OpNextBlockEnvAttributes,
) -> Result<EvmEnv<OpSpecId>, Self::Error> {
self.inner.next_evm_env(parent, attributes)
}
fn context_for_block(
&self,
block: &SealedBlock<Block<OpTransactionSigned>>,
) -> OpBlockExecutionCtx {
self.inner.context_for_block(block)
}
fn context_for_next_block(
&self,
parent: &SealedHeader,
attributes: Self::NextBlockEnvCtx,
) -> OpBlockExecutionCtx {
self.inner.context_for_next_block(parent, attributes)
}
}