|
1 | 1 | //! Contains an online implementation of the `BlobProvider` trait.
|
2 | 2 |
|
3 |
| -use alloy_eips::eip4844::{Blob, BlobTransactionSidecarItem, IndexedBlobHash}; |
| 3 | +use alloy_eips::eip4844::{BlobTransactionSidecarItem, IndexedBlobHash}; |
4 | 4 | use alloy_rpc_types_beacon::sidecar::{BeaconBlobBundle, BlobData};
|
5 |
| -use async_trait::async_trait; |
6 |
| -use kona_derive::{errors::BlobProviderError, traits::BlobProvider}; |
| 5 | +use kona_derive::errors::BlobProviderError; |
7 | 6 | use op_alloy_protocol::BlockInfo;
|
8 | 7 | use reqwest::Client;
|
9 | 8 |
|
@@ -62,7 +61,7 @@ impl APIGenesisResponse {
|
62 | 61 | }
|
63 | 62 | }
|
64 | 63 |
|
65 |
| -/// An online implementation of the [BlobProvider] trait. |
| 64 | +/// An online provider to fetch blob sidecars. |
66 | 65 | #[derive(Debug, Clone)]
|
67 | 66 | pub struct OnlineBlobProvider {
|
68 | 67 | /// The base url.
|
@@ -198,40 +197,3 @@ impl OnlineBlobProvider {
|
198 | 197 | .collect::<Vec<BlobTransactionSidecarItem>>())
|
199 | 198 | }
|
200 | 199 | }
|
201 |
| - |
202 |
| -#[async_trait] |
203 |
| -impl BlobProvider for OnlineBlobProvider { |
204 |
| - type Error = BlobProviderError; |
205 |
| - |
206 |
| - /// Fetches blob sidecars that were confirmed in the specified L1 block with the given indexed |
207 |
| - /// hashes. The blobs are validated for their index and hashes using the specified |
208 |
| - /// [IndexedBlobHash]. |
209 |
| - async fn get_blobs( |
210 |
| - &mut self, |
211 |
| - block_ref: &BlockInfo, |
212 |
| - blob_hashes: &[IndexedBlobHash], |
213 |
| - ) -> Result<Vec<Box<Blob>>, Self::Error> { |
214 |
| - // Fetch the blob sidecars for the given block reference and blob hashes. |
215 |
| - let sidecars = self.fetch_filtered_sidecars(block_ref, blob_hashes).await?; |
216 |
| - |
217 |
| - // Validate the blob sidecars straight away with the num hashes. |
218 |
| - let blobs = sidecars |
219 |
| - .into_iter() |
220 |
| - .enumerate() |
221 |
| - .map(|(i, sidecar)| { |
222 |
| - let hash = blob_hashes |
223 |
| - .get(i) |
224 |
| - .ok_or(BlobProviderError::Backend("Missing blob hash".to_string()))?; |
225 |
| - match sidecar.verify_blob(&alloy_eips::eip4844::IndexedBlobHash { |
226 |
| - hash: hash.hash, |
227 |
| - index: hash.index, |
228 |
| - }) { |
229 |
| - Ok(_) => Ok(sidecar.blob), |
230 |
| - Err(e) => Err(BlobProviderError::Backend(e.to_string())), |
231 |
| - } |
232 |
| - }) |
233 |
| - .collect::<Result<Vec<Box<Blob>>, BlobProviderError>>() |
234 |
| - .map_err(|e| BlobProviderError::Backend(e.to_string()))?; |
235 |
| - Ok(blobs) |
236 |
| - } |
237 |
| -} |
0 commit comments