Skip to content

Commit

Permalink
chore: rename executor and provider Generic -> Basic (#11788)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez authored Oct 16, 2024
1 parent 248b6b5 commit 87399ae
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions crates/ethereum/evm/src/strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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]
Expand Down
36 changes: 18 additions & 18 deletions crates/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand All @@ -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>
Expand All @@ -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>,
{
Expand All @@ -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>,
Expand Down Expand Up @@ -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>,
{
Expand All @@ -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>,
Expand Down Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions crates/evm/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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>,
{
Expand All @@ -133,7 +133,7 @@ where
}
}

impl<S, DB> GenericBatchExecutor<S, DB>
impl<S, DB> BasicBatchExecutor<S, DB>
where
S: BlockExecutionStrategy<DB>,
{
Expand Down
6 changes: 3 additions & 3 deletions crates/optimism/evm/src/strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 87399ae

Please sign in to comment.