Skip to main content

BlobStore

Trait BlobStore 

Source
pub trait BlobStore:
    Debug
    + Send
    + Sync
    + 'static {
Show 19 methods // Required methods fn insert( &self, tx: FixedBytes<32>, data: PooledBlobSidecar, ) -> Result<(), BlobStoreError>; fn insert_all( &self, txs: Vec<(FixedBytes<32>, PooledBlobSidecar)>, ) -> Result<(), BlobStoreError>; fn delete(&self, tx: FixedBytes<32>) -> Result<(), BlobStoreError>; fn delete_all(&self, txs: Vec<FixedBytes<32>>) -> Result<(), BlobStoreError>; fn cleanup(&self) -> BlobStoreCleanupStat; fn get( &self, tx: FixedBytes<32>, ) -> Result<Option<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>; fn contains(&self, tx: FixedBytes<32>) -> Result<bool, BlobStoreError>; fn get_all( &self, txs: Vec<FixedBytes<32>>, ) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecarVariant>)>, BlobStoreError>; fn get_exact( &self, txs: Vec<FixedBytes<32>>, ) -> Result<Vec<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>; fn get_by_versioned_hashes_v1( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>; fn get_by_versioned_hashes_v2( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Option<Vec<BlobAndProofV2>>, BlobStoreError>; fn get_by_versioned_hashes_v3( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV2>>, BlobStoreError>; fn get_by_versioned_hashes_v4( &self, versioned_hashes: &[FixedBytes<32>], cell_mask: BlobCellMask, ) -> Result<Vec<Option<BlobCellsAndProofsV1>>, BlobStoreError>; fn has_versioned_hashes( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<bool>, BlobStoreError>; fn get_cells( &self, tx_hash: FixedBytes<32>, cell_mask: BlobCellMask, ) -> Result<Option<Vec<FixedBytes<alloy_eips::::eip7594::Cell::{constant#0}>>>, BlobStoreError>; fn data_size_hint(&self) -> Option<usize>; fn blobs_len(&self) -> usize; // Provided methods fn insert_cells( &self, tx: FixedBytes<32>, data: BlobTransactionCellSidecar, ) -> Result<(), BlobStoreError> { ... } fn get_without_blobs( &self, tx: FixedBytes<32>, ) -> Result<Option<BlobTransactionSidecarEip7594>, BlobStoreError> { ... }
}
Expand description

A blob store that can be used to store blob data of EIP4844 transactions.

This type is responsible for keeping track of blob data until it is no longer needed (after finalization).

Note: this is Clone because it is expected to be wrapped in an Arc.

Required Methods§

Source

fn insert( &self, tx: FixedBytes<32>, data: PooledBlobSidecar, ) -> Result<(), BlobStoreError>

Inserts the blob sidecar into the store

Source

fn insert_all( &self, txs: Vec<(FixedBytes<32>, PooledBlobSidecar)>, ) -> Result<(), BlobStoreError>

Inserts multiple blob sidecars into the store

Source

fn delete(&self, tx: FixedBytes<32>) -> Result<(), BlobStoreError>

Deletes the blob sidecar from the store

Source

fn delete_all(&self, txs: Vec<FixedBytes<32>>) -> Result<(), BlobStoreError>

Deletes multiple blob sidecars from the store

Source

fn cleanup(&self) -> BlobStoreCleanupStat

A maintenance function that can be called periodically to clean up the blob store, returns the number of successfully deleted blobs and the number of failed deletions.

This is intended to be called in the background to clean up any old or unused data, in case the store uses deferred cleanup: DiskFileBlobStore

Source

fn get( &self, tx: FixedBytes<32>, ) -> Result<Option<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>

Retrieves the decoded blob data for the given transaction hash.

Source

fn contains(&self, tx: FixedBytes<32>) -> Result<bool, BlobStoreError>

Checks if the given transaction hash is in the blob store.

This is also true for a transaction stored only as cells, even if Self::get cannot rebuild its blobs.

Source

fn get_all( &self, txs: Vec<FixedBytes<32>>, ) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecarVariant>)>, BlobStoreError>

Retrieves all decoded blob data for the given transaction hashes.

This only returns the blobs that were found in the store. If there’s no blob it will not be returned.

Note: this is not guaranteed to return the blobs in the same order as the input.

Source

fn get_exact( &self, txs: Vec<FixedBytes<32>>, ) -> Result<Vec<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>

Returns the exact [BlobTransactionSidecarVariant] for the given transaction hashes in the exact order they were requested.

Returns an error if any of the blobs are not found in the blob store.

Source

fn get_by_versioned_hashes_v1( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>

Return the BlobAndProofV1s for a list of blob versioned hashes.

Source

fn get_by_versioned_hashes_v2( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Option<Vec<BlobAndProofV2>>, BlobStoreError>

Return the BlobAndProofV2s for a list of blob versioned hashes. Blobs and proofs are returned only if they are present for all requested versioned hashes.

This differs from BlobStore::get_by_versioned_hashes_v1 in that it also returns all the cell proofs in BlobAndProofV2 supported by the EIP-7594 blob sidecar variant.

The response also differs from BlobStore::get_by_versioned_hashes_v1 in that this returns None if any of the requested versioned hashes are not present in the blob store: e.g. where v1 would return [A, None, C] v2 would return None. See also https://github.com/ethereum/execution-apis/blob/main/src/engine/osaka.md#engine_getblobsv2

Source

fn get_by_versioned_hashes_v3( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV2>>, BlobStoreError>

Return the BlobAndProofV2s for a list of blob versioned hashes.

The response is always the same length as the request. Missing or older-version blobs are returned as None elements.

Source

fn get_by_versioned_hashes_v4( &self, versioned_hashes: &[FixedBytes<32>], cell_mask: BlobCellMask, ) -> Result<Vec<Option<BlobCellsAndProofsV1>>, BlobStoreError>

Return the BlobCellsAndProofsV1s for a list of blob versioned hashes and requested cell indices.

The response is always the same length as the request. Missing or older-version blobs are returned as None elements.

Source

fn has_versioned_hashes( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<bool>, BlobStoreError>

Return whether each requested blob versioned hash is available.

A blob stored only as cells counts as available only if enough of them are kept to rebuild it. The response is always the same length and order as the request.

Source

fn get_cells( &self, tx_hash: FixedBytes<32>, cell_mask: BlobCellMask, ) -> Result<Option<Vec<FixedBytes<alloy_eips::::eip7594::Cell::{constant#0}>>>, BlobStoreError>

Returns all requested cells for all blobs belonging to the transaction.

The cell_mask is applied independently to every blob in the tx.

Returned cells are flattened in blob order, then cell-index order. Returns None if the transaction isn’t stored or its cells can’t be computed within the budget.

Example: If the tx contains blobs [blob0, blob1] and the requested indices are [2, 5, 9], the returned vector is:

[
  blob0_cell2,
  blob0_cell5,
  blob0_cell9,
  blob1_cell2,
  blob1_cell5,
  blob1_cell9,
]
Source

fn data_size_hint(&self) -> Option<usize>

Data size of all transactions in the blob store.

Source

fn blobs_len(&self) -> usize

How many blobs are in the blob store.

Provided Methods§

Source

fn insert_cells( &self, tx: FixedBytes<32>, data: BlobTransactionCellSidecar, ) -> Result<(), BlobStoreError>

Inserts a validated sidecar that keeps only some cells, preserving any full sidecar and replacing an earlier sample for the same transaction.

The default rebuilds the blobs and inserts the full sidecar, so it fails with too few cells. A store meant to hold samples must override it, because a sample the store rejects stays pooled but is never announced or included.

Source

fn get_without_blobs( &self, tx: FixedBytes<32>, ) -> Result<Option<BlobTransactionSidecarEip7594>, BlobStoreError>

Retrieves the EIP-7594 sidecar of tx without its blobs, as served to eth/72 peers.

Unlike Self::get, this also returns sidecars stored only as cells. Returns None if tx is missing or has a legacy sidecar.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§