Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/blobber/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ reth-chainspec.workspace = true
reth-transaction-pool = { workspace = true, optional = true }

serde.workspace = true
smallvec.workspace = true
tokio.workspace = true
tracing.workspace = true
reqwest.workspace = true
Expand Down
24 changes: 17 additions & 7 deletions crates/blobber/src/blobs/fetch.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::{BlobFetcherBuilder, FetchError, FetchResult, utils::extract_blobs_from_bundle};
use crate::{BlobFetcherBuilder, FetchError, FetchResult};
use alloy::{
consensus::{Blob, BlobTransactionSidecar},
eips::eip7594::{BlobTransactionSidecarEip7594, BlobTransactionSidecarVariant},
primitives::{B256, TxHash},
};
use reth::{rpc::types::beacon::sidecar::BeaconBlobBundle, transaction_pool::TransactionPool};
use reth::{rpc::types::beacon::sidecar::GetBlobsResponse, transaction_pool::TransactionPool};
use std::{ops::Deref, sync::Arc};
use tokio::select;
use tracing::instrument;
Expand Down Expand Up @@ -218,15 +218,25 @@ where
return Err(FetchError::ConsensusClientUrlNotSet);
};

let url = url
.join(&format!("/eth/v1/beacon/blob_sidecars/{slot}"))
.map_err(FetchError::UrlParse)?;
let mut url =
url.join(&format!("/eth/v1/beacon/blobs/{slot}")).map_err(FetchError::UrlParse)?;

let versioned_hashes =
versioned_hashes.iter().map(|hash| hash.to_string()).collect::<Vec<_>>().join(",");
url.query_pairs_mut().append_pair("versioned_hashes", &versioned_hashes);

let response = self.client.get(url).header("accept", "application/json").send().await?;

let response: BeaconBlobBundle = response.json().await?;
let response: GetBlobsResponse = response.json().await?;

debug_assert!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is an assert. instead we should document the not-found behavior

response.data.len() == versioned_hashes.len(),
"Expected {} blobs, got {}",
versioned_hashes.len(),
response.data.len()
);

extract_blobs_from_bundle(response, versioned_hashes)
Ok(Arc::new(response.data).into())
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/blobber/src/coder/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ where
#[cfg(test)]
mod test {
use super::*;
use crate::{Blobs, utils::tests::PYLON_BLOB_RESPONSE};
use crate::{Blobs, test::PYLON_BLOB_RESPONSE};
use alloy::{
consensus::{Blob, BlobTransactionSidecar, Bytes48, SimpleCoder},
primitives::{Address, B256, U256, b256},
Expand Down
7 changes: 4 additions & 3 deletions crates/blobber/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ pub use error::{BlobberError, BlobberResult};
mod shim;
pub use shim::ExtractableChainShim;

pub(crate) mod utils;

#[cfg(test)]
mod test {
use crate::utils::tests::BLOBSCAN_BLOB_RESPONSE;
pub(crate) const BLOBSCAN_BLOB_RESPONSE: &str =
include_str!("../../../tests/artifacts/blob.json");
pub(crate) const PYLON_BLOB_RESPONSE: &str =
include_str!("../../../tests/artifacts/pylon_blob.json");
use foundry_blob_explorers::TransactionDetails;

// Sanity check on dependency compatibility.
Expand Down
87 changes: 0 additions & 87 deletions crates/blobber/src/utils.rs

This file was deleted.