chore: rename executor and provider Generic -> Basic (#11788)

This commit is contained in:
Federico Gimenez
2024-10-16 13:20:42 +02:00
committed by GitHub
parent 248b6b5905
commit 87399ae2c1
4 changed files with 28 additions and 28 deletions

View File

@ -274,7 +274,7 @@ mod tests {
use alloy_primitives::{b256, fixed_bytes, keccak256, Bytes, TxKind, B256};
use reth_chainspec::{ChainSpecBuilder, ForkCondition};
use reth_evm::execute::{
BatchExecutor, BlockExecutorProvider, Executor, GenericBlockExecutorProvider,
BasicBlockExecutorProvider, BatchExecutor, BlockExecutorProvider, Executor,
};
use reth_execution_types::BlockExecutionOutput;
use reth_primitives::{
@ -328,11 +328,11 @@ mod tests {
fn executor_provider(
chain_spec: Arc<ChainSpec>,
) -> GenericBlockExecutorProvider<EthExecutionStrategyFactory> {
) -> BasicBlockExecutorProvider<EthExecutionStrategyFactory> {
let strategy_factory =
EthExecutionStrategyFactory::new(chain_spec.clone(), EthEvmConfig::new(chain_spec));
GenericBlockExecutorProvider::new(strategy_factory)
BasicBlockExecutorProvider::new(strategy_factory)
}
#[test]

View File

@ -227,7 +227,7 @@ pub trait BlockExecutionStrategyFactory: Send + Sync + Clone + Unpin + 'static {
DB: Database<Error: Into<ProviderError> + Display>;
}
impl<F> Clone for GenericBlockExecutorProvider<F>
impl<F> Clone for BasicBlockExecutorProvider<F>
where
F: Clone,
{
@ -238,33 +238,33 @@ where
/// A generic block executor provider that can create executors using a strategy factory.
#[allow(missing_debug_implementations)]
pub struct GenericBlockExecutorProvider<F> {
pub struct BasicBlockExecutorProvider<F> {
strategy_factory: F,
}
impl<F> GenericBlockExecutorProvider<F> {
/// Creates a new `GenericBlockExecutorProvider` with the given strategy factory.
impl<F> BasicBlockExecutorProvider<F> {
/// Creates a new `BasicBlockExecutorProvider` with the given strategy factory.
pub const fn new(strategy_factory: F) -> Self {
Self { strategy_factory }
}
}
impl<F> BlockExecutorProvider for GenericBlockExecutorProvider<F>
impl<F> BlockExecutorProvider for BasicBlockExecutorProvider<F>
where
F: BlockExecutionStrategyFactory,
{
type Executor<DB: Database<Error: Into<ProviderError> + Display>> =
GenericBlockExecutor<F::Strategy<DB>, DB>;
BasicBlockExecutor<F::Strategy<DB>, DB>;
type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>> =
GenericBatchExecutor<F::Strategy<DB>, DB>;
BasicBatchExecutor<F::Strategy<DB>, DB>;
fn executor<DB>(&self, db: DB) -> Self::Executor<DB>
where
DB: Database<Error: Into<ProviderError> + Display>,
{
let strategy = self.strategy_factory.create_strategy(db);
GenericBlockExecutor::new(strategy)
BasicBlockExecutor::new(strategy)
}
fn batch_executor<DB>(&self, db: DB) -> Self::BatchExecutor<DB>
@ -273,14 +273,14 @@ where
{
let strategy = self.strategy_factory.create_strategy(db);
let batch_record = BlockBatchRecord::default();
GenericBatchExecutor::new(strategy, batch_record)
BasicBatchExecutor::new(strategy, batch_record)
}
}
/// A generic block executor that uses a [`BlockExecutionStrategy`] to
/// execute blocks.
#[allow(missing_debug_implementations, dead_code)]
pub struct GenericBlockExecutor<S, DB>
pub struct BasicBlockExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
{
@ -289,17 +289,17 @@ where
_phantom: PhantomData<DB>,
}
impl<S, DB> GenericBlockExecutor<S, DB>
impl<S, DB> BasicBlockExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
{
/// Creates a new `GenericBlockExecutor` with the given strategy.
/// Creates a new `BasicBlockExecutor` with the given strategy.
pub const fn new(strategy: S) -> Self {
Self { strategy, _phantom: PhantomData }
}
}
impl<S, DB> Executor<DB> for GenericBlockExecutor<S, DB>
impl<S, DB> Executor<DB> for BasicBlockExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
DB: Database<Error: Into<ProviderError> + Display>,
@ -368,7 +368,7 @@ where
/// A generic batch executor that uses a [`BlockExecutionStrategy`] to
/// execute batches.
#[allow(missing_debug_implementations)]
pub struct GenericBatchExecutor<S, DB>
pub struct BasicBatchExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
{
@ -379,17 +379,17 @@ where
_phantom: PhantomData<DB>,
}
impl<S, DB> GenericBatchExecutor<S, DB>
impl<S, DB> BasicBatchExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
{
/// Creates a new `GenericBatchExecutor` with the given strategy.
/// Creates a new `BasicBatchExecutor` with the given strategy.
pub const fn new(strategy: S, batch_record: BlockBatchRecord) -> Self {
Self { strategy, batch_record, _phantom: PhantomData }
}
}
impl<S, DB> BatchExecutor<DB> for GenericBatchExecutor<S, DB>
impl<S, DB> BatchExecutor<DB> for BasicBatchExecutor<S, DB>
where
S: BlockExecutionStrategy<DB, Error = BlockExecutionError>,
DB: Database<Error: Into<ProviderError> + Display>,
@ -661,7 +661,7 @@ mod tests {
.clone(),
finish_result: expected_finish_result.clone(),
};
let provider = GenericBlockExecutorProvider::new(strategy_factory);
let provider = BasicBlockExecutorProvider::new(strategy_factory);
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
let executor = provider.executor(db);
let result = executor.execute(BlockExecutionInput::new(&Default::default(), U256::ZERO));

View File

@ -2,8 +2,8 @@
use crate::{
execute::{
BatchExecutor, BlockExecutionInput, BlockExecutionOutput, BlockExecutionStrategy,
BlockExecutorProvider, Executor, GenericBatchExecutor, GenericBlockExecutor,
BasicBatchExecutor, BasicBlockExecutor, BatchExecutor, BlockExecutionInput,
BlockExecutionOutput, BlockExecutionStrategy, BlockExecutorProvider, Executor,
},
system_calls::OnStateHook,
};
@ -112,7 +112,7 @@ impl<DB> BatchExecutor<DB> for MockExecutorProvider {
}
}
impl<S, DB> GenericBlockExecutor<S, DB>
impl<S, DB> BasicBlockExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
{
@ -133,7 +133,7 @@ where
}
}
impl<S, DB> GenericBatchExecutor<S, DB>
impl<S, DB> BasicBatchExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
{

View File

@ -278,7 +278,7 @@ mod tests {
use alloy_consensus::TxEip1559;
use alloy_primitives::{b256, Address, StorageKey, StorageValue};
use reth_chainspec::MIN_TRANSACTION_GAS;
use reth_evm::execute::{BatchExecutor, BlockExecutorProvider, GenericBlockExecutorProvider};
use reth_evm::execute::{BasicBlockExecutorProvider, BatchExecutor, BlockExecutorProvider};
use reth_optimism_chainspec::{optimism_deposit_tx_signature, OpChainSpecBuilder};
use reth_primitives::{Account, Block, BlockBody, Signature, Transaction, TransactionSigned};
use reth_revm::{
@ -315,11 +315,11 @@ mod tests {
fn executor_provider(
chain_spec: Arc<OpChainSpec>,
) -> GenericBlockExecutorProvider<OpExecutionStrategyFactory> {
) -> BasicBlockExecutorProvider<OpExecutionStrategyFactory> {
let strategy_factory =
OpExecutionStrategyFactory::new(chain_spec.clone(), OptimismEvmConfig::new(chain_spec));
GenericBlockExecutorProvider::new(strategy_factory)
BasicBlockExecutorProvider::new(strategy_factory)
}
#[test]