reth::providers

Trait StateWriter

pub trait StateWriter {
    type Receipt;

    // Required methods
    fn write_state(
        &self,
        execution_outcome: ExecutionOutcome<Self::Receipt>,
        is_value_known: OriginalValuesKnown,
        write_receipts_to: StorageLocation,
    ) -> Result<(), ProviderError>;
    fn write_state_reverts(
        &self,
        reverts: PlainStateReverts,
        first_block: u64,
    ) -> Result<(), ProviderError>;
    fn write_state_changes(
        &self,
        changes: StateChangeset,
    ) -> Result<(), ProviderError>;
    fn write_hashed_state(
        &self,
        hashed_state: &HashedPostStateSorted,
    ) -> Result<(), ProviderError>;
    fn remove_state_above(
        &self,
        block: u64,
        remove_receipts_from: StorageLocation,
    ) -> Result<(), ProviderError>;
    fn take_state_above(
        &self,
        block: u64,
        remove_receipts_from: StorageLocation,
    ) -> Result<ExecutionOutcome<Self::Receipt>, ProviderError>;
}
Expand description

A trait specifically for writing state changes or reverts

Required Associated Types§

type Receipt

Receipt type included into ExecutionOutcome.

Required Methods§

fn write_state( &self, execution_outcome: ExecutionOutcome<Self::Receipt>, is_value_known: OriginalValuesKnown, write_receipts_to: StorageLocation, ) -> Result<(), ProviderError>

Write the state and receipts to the database or static files if static_file_producer is Some. It should be None if there is any kind of pruning/filtering over the receipts.

fn write_state_reverts( &self, reverts: PlainStateReverts, first_block: u64, ) -> Result<(), ProviderError>

Write state reverts to the database.

NOTE: Reverts will delete all wiped storage from plain state.

fn write_state_changes( &self, changes: StateChangeset, ) -> Result<(), ProviderError>

Write state changes to the database.

fn write_hashed_state( &self, hashed_state: &HashedPostStateSorted, ) -> Result<(), ProviderError>

Writes the hashed state changes to the database

fn remove_state_above( &self, block: u64, remove_receipts_from: StorageLocation, ) -> Result<(), ProviderError>

Remove the block range of state above the given block. The state of the passed block is not removed.

fn take_state_above( &self, block: u64, remove_receipts_from: StorageLocation, ) -> Result<ExecutionOutcome<Self::Receipt>, ProviderError>

Take the block range of state, recreating the ExecutionOutcome. The state of the passed block is not removed.

Implementors§

§

impl<TX, N> StateWriter for DatabaseProvider<TX, N>
where TX: DbTxMut + DbTx + 'static, N: NodeTypesForProvider,