refactor(blobber): abstract blob sources and remove reth deps#112
refactor(blobber): abstract blob sources and remove reth deps#112
Conversation
Code reviewFound 1 issue:
node-components/crates/blobber/src/blobs/fetch.rs Lines 136 to 158 in f138e32 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
b21848c to
b2fd16d
Compare
1cd7a2b to
8e7eca9
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…cies - Extract BlobExplorerSource, BeaconBlobSource, PylonBlobSource as AsyncBlobSource impls - Make BlobFetcher non-generic with trait object sources - Replace LruMap with schnellru, GetBlobsResponse with alloy import - Replace BlobStoreError with boxed error - Remove dead FetchError variants (ConsensusClientUrlNotSet, PylonClientUrlNotSet, BlobCountMismatch) - Delete shim.rs (RecoveredBlockShim moves to host-reth in later task) - Remove reth, reth-chainspec, reth-transaction-pool dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ug.rs Replace reth type re-exports with signet-types and alloy equivalents. Remove reth from Cargo.toml entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lobs - Log source errors at DEBUG level in fetch_blobs (errors only matter if ALL sources fail) - Return Ok(None) instead of Ok(Some(empty)) when sources return zero blobs, so the fetcher continues to the next source - Fix stale comment referencing tokio::select (uses select_all) - Merge split alloy imports in rpc_debug.rs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8e7eca9 to
84ba68b
Compare
| /// Boxed error type for blob source operations. | ||
| type BlobSourceError = Box<dyn core::error::Error + Send + Sync>; | ||
|
|
||
| /// Boxed future returned by [`AsyncBlobSource::get_blob`]. | ||
| type BlobFuture<'a> = | ||
| Pin<Box<dyn Future<Output = Result<Option<Blobs>, BlobSourceError>> + Send + 'a>>; |
There was a problem hiding this comment.
Should we make these pub(crate) so they can be reused? (they're defined identically in a handful of files)
There was a problem hiding this comment.
[Claude Code]
Done — made them pub(crate) in source.rs and imported from the three concrete source files.
| let hashes = versioned_hashes.iter().map(|h| h.to_string()).collect::<Vec<_>>().join(","); | ||
| url.query_pairs_mut().append_pair("versioned_hashes", &hashes); | ||
|
|
||
| let response = client.get(url).header("accept", "application/json").send().await?; |
There was a problem hiding this comment.
| let response = client.get(url).header("accept", "application/json").send().await?; | |
| let response = client.get(url).header("accept", "application/json").send().await?.error_for_status()?; |
| ) -> Result<Blobs, BlobSourceError> { | ||
| let url = base_url.join(&format!("sidecar/{tx_hash}"))?; | ||
|
|
||
| let response = client.get(url).header("accept", "application/json").send().await?; |
There was a problem hiding this comment.
| let response = client.get(url).header("accept", "application/json").send().await?; | |
| let response = client.get(url).header("accept", "application/json").send().await?.error_for_status()?; |
crates/blobber/src/blobs/builder.rs
Outdated
| /// The client failed to build. | ||
| #[error("failed to build client: {0}")] | ||
| Client(#[from] reqwest::Error), |
There was a problem hiding this comment.
We don't use this variant any more either.
There was a problem hiding this comment.
[Claude Code]
Removed. Added Copy/Clone derives to BuilderError since it is now single-variant.
There was a problem hiding this comment.
Maybe Blobs::FromPool should be renamed to Blobs::FromSidecar?
There was a problem hiding this comment.
[Claude Code]
Renamed to Blobs::FromSidecar — fits better now that non-pool sources like MemoryBlobSource also produce this variant.
- Consolidate BlobFuture/BlobSourceError type aliases into source.rs as pub(crate) and import from concrete source files - Add .error_for_status()? to beacon and pylon HTTP requests - Remove unused BuilderError::Client variant - Rename Blobs::FromPool to Blobs::FromSidecar Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
[Claude Code]
Summary
BlobSource(sync) andAsyncBlobSource(async) traits insignet-blobberBlobFetchernon-generic — holdsVec<Box<dyn BlobSource>>andVec<Box<dyn AsyncBlobSource>>BlobExplorerSource,BeaconBlobSource,PylonBlobSourceas standaloneAsyncBlobSourceimplsreth::network::cache::LruMapwith directschnellrudepreth::rpc::types::beacon::sidecar::GetBlobsResponsewith alloy importBlobStoreErrorwithBox<dyn Error + Send + Sync>MemoryBlobSourcebehindtest-utilsfeature for in-memory blob testingRecoveredBlockShimfrom blobber tosignet-host-rethRethBlobSource<P>newtype insignet-host-reth(orphan rule wrapper)reth,reth-chainspec,reth-transaction-poolfromsignet-blobberreth,reth-exex-test-utilsfromsignet-node-testsPR stack
Linear
ENG-2077 (child of ENG-2056)
Test plan
cargo clippy -p signet-blobber --all-features --all-targets— cleancargo clippy -p signet-blobber --no-default-features --all-targets— cleancargo clippy -p signet-host-reth --all-features --all-targets— cleancargo clippy -p signet-node-tests --all-features --all-targets— cleancargo +nightly fmt --check— cleancargo t -p signet-blobber— 4 passedcargo t -p signet-host-reth— passcargo tree -p signet-blobber | grep reth— no output (zero reth deps)cargo tree -p signet-node-tests --depth 1 | grep reth— no output (no direct reth dep)cargo t -p signet-node-tests— integration tests (to be run)🤖 Generated with Claude Code
Review Fixes
tracing::debug!events for sync and async blob source errors infetch_blobsOk(None)instead ofOk(Some(empty))tokio::select(code usesselect_all)use alloy::imports inrpc_debug.rsBlobFuture/BlobSourceErrortype aliases intosource.rsaspub(crate).error_for_status()?to beacon and pylon HTTP requestsBuilderError::ClientvariantBlobs::FromPool→Blobs::FromSidecar