mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: send CanonStateNotifications from execution stage (#7578)
This commit is contained in:
@ -218,11 +218,13 @@ impl BundleStateWithReceipts {
|
||||
self.first_block
|
||||
}
|
||||
|
||||
/// Revert to given block number.
|
||||
/// Revert the state to the given block number.
|
||||
///
|
||||
/// If number is in future, or in the past return false
|
||||
/// Returns false if the block number is not in the bundle state.
|
||||
///
|
||||
/// NOTE: Provided block number will stay inside the bundle state.
|
||||
/// # Note
|
||||
///
|
||||
/// The provided block number will stay inside the bundle state.
|
||||
pub fn revert_to(&mut self, block_number: BlockNumber) -> bool {
|
||||
let Some(index) = self.block_number_to_index(block_number) else { return false };
|
||||
|
||||
|
||||
@ -363,7 +363,6 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
|
||||
}
|
||||
|
||||
// TODO(joshie) TEMPORARY should be moved to trait providers
|
||||
|
||||
/// Unwind or peek at last N blocks of state recreating the [`BundleStateWithReceipts`].
|
||||
///
|
||||
/// If UNWIND it set to true tip and latest state will be unwind
|
||||
@ -388,7 +387,7 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
|
||||
/// 1. Take the old value from the changeset
|
||||
/// 2. Take the new value from the local state
|
||||
/// 3. Set the local state to the value in the changeset
|
||||
fn unwind_or_peek_state<const UNWIND: bool>(
|
||||
pub fn unwind_or_peek_state<const UNWIND: bool>(
|
||||
&self,
|
||||
range: RangeInclusive<BlockNumber>,
|
||||
) -> ProviderResult<BundleStateWithReceipts> {
|
||||
@ -706,8 +705,8 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
|
||||
Ok(block_tx)
|
||||
}
|
||||
|
||||
/// Return range of blocks and its execution result
|
||||
fn get_take_block_range<const TAKE: bool>(
|
||||
/// Get or unwind the given range of blocks.
|
||||
pub fn get_take_block_range<const TAKE: bool>(
|
||||
&self,
|
||||
range: impl RangeBounds<BlockNumber> + Clone,
|
||||
) -> ProviderResult<Vec<SealedBlockWithSenders>> {
|
||||
|
||||
@ -4,14 +4,12 @@ use crate::{bundle_state::BundleStateWithReceipts, StateProvider};
|
||||
use reth_interfaces::executor::BlockExecutionError;
|
||||
use reth_primitives::{BlockNumber, BlockWithSenders, PruneModes, Receipt, U256};
|
||||
|
||||
/// Executor factory that would create the EVM with particular state provider.
|
||||
///
|
||||
/// It can be used to mock executor.
|
||||
/// A factory capable of creating an executor with the given state provider.
|
||||
pub trait ExecutorFactory: Send + Sync + 'static {
|
||||
/// Executor with [`StateProvider`]
|
||||
fn with_state<'a, SP: StateProvider + 'a>(
|
||||
&'a self,
|
||||
_sp: SP,
|
||||
sp: SP,
|
||||
) -> Box<dyn PrunableBlockExecutor<Error = BlockExecutionError> + 'a>;
|
||||
}
|
||||
|
||||
@ -19,7 +17,7 @@ pub trait ExecutorFactory: Send + Sync + 'static {
|
||||
///
|
||||
/// This type is capable of executing (multiple) blocks by applying the state changes made by each
|
||||
/// block. The final state of the executor can extracted using
|
||||
/// [take_output_state](BlockExecutor::take_output_state).
|
||||
/// [`Self::take_output_state`].
|
||||
pub trait BlockExecutor {
|
||||
/// The error type returned by the executor.
|
||||
type Error;
|
||||
|
||||
Reference in New Issue
Block a user