mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: abstract over Evm::Error (#14085)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -11,10 +11,9 @@ use reth::{
|
||||
api::{ConfigureEvm, NodeTypesWithEngine},
|
||||
builder::{components::ExecutorBuilder, BuilderContext, FullNodeTypes},
|
||||
cli::Cli,
|
||||
providers::ProviderError,
|
||||
revm::{
|
||||
primitives::{address, Address},
|
||||
Database, DatabaseCommit, State,
|
||||
DatabaseCommit, State,
|
||||
},
|
||||
};
|
||||
use reth_chainspec::{ChainSpec, EthereumHardforks};
|
||||
@ -23,7 +22,7 @@ use reth_evm::{
|
||||
BlockExecutionError, BlockExecutionStrategy, BlockExecutionStrategyFactory, ExecuteOutput,
|
||||
InternalBlockExecutionError,
|
||||
},
|
||||
Evm,
|
||||
Database, Evm,
|
||||
};
|
||||
use reth_evm_ethereum::EthEvmConfig;
|
||||
use reth_node_ethereum::{node::EthereumAddOns, BasicBlockExecutorProvider, EthereumNode};
|
||||
@ -90,11 +89,11 @@ pub struct CustomExecutorStrategyFactory {
|
||||
|
||||
impl BlockExecutionStrategyFactory for CustomExecutorStrategyFactory {
|
||||
type Primitives = EthPrimitives;
|
||||
type Strategy<DB: Database<Error: Into<ProviderError> + Display>> = CustomExecutorStrategy<DB>;
|
||||
type Strategy<DB: Database> = CustomExecutorStrategy<DB>;
|
||||
|
||||
fn create_strategy<DB>(&self, db: DB) -> Self::Strategy<DB>
|
||||
where
|
||||
DB: Database<Error: Into<ProviderError> + Display>,
|
||||
DB: Database,
|
||||
{
|
||||
let state =
|
||||
State::builder().with_database(db).with_bundle_update().without_state_clear().build();
|
||||
@ -108,7 +107,7 @@ impl BlockExecutionStrategyFactory for CustomExecutorStrategyFactory {
|
||||
|
||||
pub struct CustomExecutorStrategy<DB>
|
||||
where
|
||||
DB: Database<Error: Into<ProviderError> + Display>,
|
||||
DB: Database,
|
||||
{
|
||||
/// The chainspec
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
@ -120,7 +119,7 @@ where
|
||||
|
||||
impl<DB> BlockExecutionStrategy for CustomExecutorStrategy<DB>
|
||||
where
|
||||
DB: Database<Error: Into<ProviderError> + Display>,
|
||||
DB: Database,
|
||||
{
|
||||
type DB = DB;
|
||||
type Primitives = EthPrimitives;
|
||||
|
||||
@ -15,15 +15,17 @@ use reth::{
|
||||
handler::register::EvmHandler,
|
||||
inspector_handle_register,
|
||||
precompile::{Precompile, PrecompileOutput, PrecompileSpecId},
|
||||
primitives::{CfgEnvWithHandlerCfg, Env, HandlerCfg, PrecompileResult, SpecId, TxEnv},
|
||||
ContextPrecompiles, Database, EvmBuilder, GetInspector,
|
||||
primitives::{
|
||||
CfgEnvWithHandlerCfg, EVMError, Env, HandlerCfg, PrecompileResult, SpecId, TxEnv,
|
||||
},
|
||||
ContextPrecompiles, EvmBuilder, GetInspector,
|
||||
},
|
||||
rpc::types::engine::PayloadAttributes,
|
||||
tasks::TaskManager,
|
||||
transaction_pool::{PoolTransaction, TransactionPool},
|
||||
};
|
||||
use reth_chainspec::{Chain, ChainSpec};
|
||||
use reth_evm::env::EvmEnv;
|
||||
use reth_evm::{env::EvmEnv, Database};
|
||||
use reth_evm_ethereum::{EthEvm, EthEvmConfig};
|
||||
use reth_node_api::{
|
||||
ConfigureEvm, ConfigureEvmEnv, FullNodeTypes, NextBlockEnvAttributes, NodeTypes,
|
||||
@ -109,6 +111,7 @@ impl ConfigureEvmEnv for MyEvmConfig {
|
||||
|
||||
impl ConfigureEvm for MyEvmConfig {
|
||||
type Evm<'a, DB: Database + 'a, I: 'a> = EthEvm<'a, I, DB>;
|
||||
type EvmError<DBError: core::error::Error + Send + Sync + 'static> = EVMError<DBError>;
|
||||
|
||||
fn evm_with_env<DB: Database>(&self, db: DB, evm_env: EvmEnv) -> Self::Evm<'_, DB, ()> {
|
||||
let cfg_env_with_handler_cfg = CfgEnvWithHandlerCfg {
|
||||
|
||||
@ -14,15 +14,15 @@ use reth::{
|
||||
inspector_handle_register,
|
||||
precompile::{Precompile, PrecompileSpecId},
|
||||
primitives::{
|
||||
CfgEnvWithHandlerCfg, Env, HandlerCfg, PrecompileResult, SpecId, StatefulPrecompileMut,
|
||||
TxEnv,
|
||||
CfgEnvWithHandlerCfg, EVMError, Env, HandlerCfg, PrecompileResult, SpecId,
|
||||
StatefulPrecompileMut, TxEnv,
|
||||
},
|
||||
ContextPrecompile, ContextPrecompiles, Database, EvmBuilder, GetInspector,
|
||||
ContextPrecompile, ContextPrecompiles, EvmBuilder, GetInspector,
|
||||
},
|
||||
tasks::TaskManager,
|
||||
};
|
||||
use reth_chainspec::{Chain, ChainSpec};
|
||||
use reth_evm::env::EvmEnv;
|
||||
use reth_evm::{env::EvmEnv, Database};
|
||||
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv, FullNodeTypes, NodeTypes};
|
||||
use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
|
||||
use reth_node_ethereum::{
|
||||
@ -173,6 +173,7 @@ impl ConfigureEvmEnv for MyEvmConfig {
|
||||
|
||||
impl ConfigureEvm for MyEvmConfig {
|
||||
type Evm<'a, DB: Database + 'a, I: 'a> = EthEvm<'a, I, DB>;
|
||||
type EvmError<DBError: core::error::Error + Send + Sync + 'static> = EVMError<DBError>;
|
||||
|
||||
fn evm_with_env<DB: Database>(&self, db: DB, evm_env: EvmEnv) -> Self::Evm<'_, DB, ()> {
|
||||
let cfg_env_with_handler_cfg = CfgEnvWithHandlerCfg {
|
||||
|
||||
Reference in New Issue
Block a user