reth_transaction_pool/blobstore/
noop.rs

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