mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: impl evm env provider for noop (#13342)
This commit is contained in:
@ -24,6 +24,8 @@ reth-prune-types.workspace = true
|
||||
reth-revm.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
|
||||
reth-storage-api = { workspace = true, optional = true }
|
||||
|
||||
revm.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
|
||||
@ -66,6 +68,7 @@ test-utils = [
|
||||
"reth-primitives/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
"reth-revm/test-utils",
|
||||
"dep:reth-storage-api",
|
||||
"revm/test-utils",
|
||||
"reth-prune-types/test-utils"
|
||||
]
|
||||
|
||||
@ -5,20 +5,37 @@ use crate::{
|
||||
BasicBatchExecutor, BasicBlockExecutor, BatchExecutor, BlockExecutionInput,
|
||||
BlockExecutionOutput, BlockExecutionStrategy, BlockExecutorProvider, Executor,
|
||||
},
|
||||
provider::EvmEnvProvider,
|
||||
system_calls::OnStateHook,
|
||||
ConfigureEvmEnv,
|
||||
};
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use alloy_primitives::{BlockNumber, U256};
|
||||
use parking_lot::Mutex;
|
||||
use reth_execution_errors::BlockExecutionError;
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_primitives::{BlockWithSenders, EthPrimitives, NodePrimitives, Receipt, Receipts};
|
||||
use reth_prune_types::PruneModes;
|
||||
use reth_storage_errors::provider::ProviderError;
|
||||
use reth_storage_errors::provider::{ProviderError, ProviderResult};
|
||||
use revm::State;
|
||||
use revm_primitives::db::Database;
|
||||
use revm_primitives::{db::Database, BlockEnv, CfgEnvWithHandlerCfg};
|
||||
use std::{fmt::Display, sync::Arc};
|
||||
|
||||
impl<C: Send + Sync, N: NodePrimitives> EvmEnvProvider<N::BlockHeader>
|
||||
for reth_storage_api::noop::NoopProvider<C, N>
|
||||
{
|
||||
fn env_with_header<EvmConfig>(
|
||||
&self,
|
||||
header: &N::BlockHeader,
|
||||
evm_config: EvmConfig,
|
||||
) -> ProviderResult<(CfgEnvWithHandlerCfg, BlockEnv)>
|
||||
where
|
||||
EvmConfig: ConfigureEvmEnv<Header = N::BlockHeader>,
|
||||
{
|
||||
Ok(evm_config.cfg_and_block_env(header, U256::MAX))
|
||||
}
|
||||
}
|
||||
|
||||
/// A [`BlockExecutorProvider`] that returns mocked execution results.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct MockExecutorProvider {
|
||||
|
||||
Reference in New Issue
Block a user