reth_provider

Trait StateWriter

Source
pub trait StateWriter {
    type Receipt;

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

A trait specifically for writing state changes or reverts

Required Associated Types§

Source

type Receipt

Receipt type included into ExecutionOutcome.

Required Methods§

Source

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

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.

Source

fn write_state_reverts( &self, reverts: PlainStateReverts, first_block: BlockNumber, ) -> ProviderResult<()>

Write state reverts to the database.

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

Source

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

Write state changes to the database.

Source

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

Writes the hashed state changes to the database

Source

fn remove_state_above( &self, block: BlockNumber, remove_receipts_from: StorageLocation, ) -> ProviderResult<()>

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

Source

fn take_state_above( &self, block: BlockNumber, remove_receipts_from: StorageLocation, ) -> ProviderResult<ExecutionOutcome<Self::Receipt>>

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

Implementors§

Source§

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

Source§

type Receipt = <<N as NodeTypes>::Primitives as NodePrimitives>::Receipt