reth_transaction_pool/blobstore/
noop.rs

1use crate::blobstore::{BlobStore, BlobStoreCleanupStat, BlobStoreError};
2use alloy_eips::eip4844::{BlobAndProofV1, BlobTransactionSidecar};
3use alloy_primitives::B256;
4use std::sync::Arc;
5
6/// A blobstore implementation that does nothing
7#[derive(Clone, Copy, Debug, PartialOrd, PartialEq, Eq, Default)]
8#[non_exhaustive]
9pub struct NoopBlobStore;
10
11impl BlobStore for NoopBlobStore {
12    fn insert(&self, _tx: B256, _data: BlobTransactionSidecar) -> Result<(), BlobStoreError> {
13        Ok(())
14    }
15
16    fn insert_all(&self, _txs: Vec<(B256, BlobTransactionSidecar)>) -> Result<(), BlobStoreError> {
17        Ok(())
18    }
19
20    fn delete(&self, _tx: B256) -> Result<(), BlobStoreError> {
21        Ok(())
22    }
23
24    fn delete_all(&self, _txs: Vec<B256>) -> Result<(), BlobStoreError> {
25        Ok(())
26    }
27
28    fn cleanup(&self) -> BlobStoreCleanupStat {
29        BlobStoreCleanupStat::default()
30    }
31
32    fn get(&self, _tx: B256) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError> {
33        Ok(None)
34    }
35
36    fn contains(&self, _tx: B256) -> Result<bool, BlobStoreError> {
37        Ok(false)
38    }
39
40    fn get_all(
41        &self,
42        _txs: Vec<B256>,
43    ) -> Result<Vec<(B256, Arc<BlobTransactionSidecar>)>, BlobStoreError> {
44        Ok(vec![])
45    }
46
47    fn get_exact(
48        &self,
49        txs: Vec<B256>,
50    ) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError> {
51        if txs.is_empty() {
52            return Ok(vec![])
53        }
54        Err(BlobStoreError::MissingSidecar(txs[0]))
55    }
56
57    fn get_by_versioned_hashes(
58        &self,
59        versioned_hashes: &[B256],
60    ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
61        Ok(vec![None; versioned_hashes.len()])
62    }
63
64    fn data_size_hint(&self) -> Option<usize> {
65        Some(0)
66    }
67
68    fn blobs_len(&self) -> usize {
69        0
70    }
71}