StateWriter

Trait StateWriter 

Source
pub trait StateWriter {
    type Receipt: 'static;

    // Required methods
    fn write_state<'a>(
        &self,
        execution_outcome: impl Into<WriteStateInput<'a, Self::Receipt>>,
        is_value_known: OriginalValuesKnown,
        config: StateWriteConfig,
    ) -> Result<(), ProviderError>;
    fn write_state_reverts(
        &self,
        reverts: PlainStateReverts,
        first_block: u64,
        config: StateWriteConfig,
    ) -> 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) -> Result<(), ProviderError>;
    fn take_state_above(
        &self,
        block: u64,
    ) -> Result<ExecutionOutcome<Self::Receipt>, ProviderError>;
}
Expand description

A trait specifically for writing state changes or reverts

Required Associated Types§

Source

type Receipt: 'static

Receipt type included into ExecutionOutcome.

Required Methods§

Source

fn write_state<'a>( &self, execution_outcome: impl Into<WriteStateInput<'a, Self::Receipt>>, is_value_known: OriginalValuesKnown, config: StateWriteConfig, ) -> Result<(), ProviderError>

Write the state and optionally receipts to the database.

Use config to skip writing certain data types when they are written elsewhere.

Source

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

Write state reverts to the database.

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

Use config to skip writing certain data types when they are written elsewhere.

Source

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

Write state changes to the database.

Source

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

Writes the hashed state changes to the database

Source

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

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: u64, ) -> Result<ExecutionOutcome<Self::Receipt>, ProviderError>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§