Skip to main content

SnapCatchUpStore

Trait SnapCatchUpStore 

Source
pub trait SnapCatchUpStore {
    // Required methods
    fn catch_up_progress(
        &self,
        write: SnapWrite,
    ) -> Result<Option<CatchUpProgress>, SnapSyncError>;
    fn downloaded_account(
        &self,
        coverage: AccountCoverage,
        hashed_address: B256,
    ) -> Result<DownloadedAccount, SnapSyncError>
       where Self: DBProvider;
    fn block_access_list_update(
        &self,
        coverage: AccountCoverage,
        storage: StorageProgress,
        bal: &[AccountChanges],
    ) -> Result<BalStateUpdate, SnapSyncError>
       where Self: DBProvider;
    fn commit_block_access_list(
        &self,
        write: SnapWrite,
        block: BlockNumHash,
        parent: B256,
        bal: &[AccountChanges],
    ) -> Result<CatchUpProgress, SnapSyncError>
       where Self: BlockHashReader + MetadataWriter + StateWriter + DBProvider<Tx: DbTxMut>;
}
Expand description

Persistence for the block access lists an attempt applies to its downloaded state.

Blanket-implemented over the node’s writers, so the state a list changes, the code it deploys and the progress it advances join the caller’s transaction and commit together or not at all.

Required Methods§

Source

fn catch_up_progress( &self, write: SnapWrite, ) -> Result<Option<CatchUpProgress>, SnapSyncError>

Returns the progress recorded for the attempt write belongs to, if any.

Source

fn downloaded_account( &self, coverage: AccountCoverage, hashed_address: B256, ) -> Result<DownloadedAccount, SnapSyncError>
where Self: DBProvider,

Returns what the downloaded state holds for hashed_address under coverage.

Source

fn block_access_list_update( &self, coverage: AccountCoverage, storage: StorageProgress, bal: &[AccountChanges], ) -> Result<BalStateUpdate, SnapSyncError>
where Self: DBProvider,

Returns the state update implied by bal, reading downloaded accounts from this provider.

The list must already be verified against its header. Accounts outside coverage remain unresolved, except for slots of contracts storage holds ahead of their range.

Source

fn commit_block_access_list( &self, write: SnapWrite, block: BlockNumHash, parent: B256, bal: &[AccountChanges], ) -> Result<CatchUpProgress, SnapSyncError>
where Self: BlockHashReader + MetadataWriter + StateWriter + DBProvider<Tx: DbTxMut>,

Applies bal to the downloaded state and records block as the last one applied.

The list must be authenticated against block’s header commitment, and block must be canonical and the child of the last applied one.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§