mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rename executor and provider Generic -> Basic (#11788)
This commit is contained in:
@ -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));
|
||||
|
||||
@ -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>,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user