Skip to content

Commit c7b857f

Browse files
authored
fix: remove spurious tracing info and use let-else (#25)
1 parent 42991b8 commit c7b857f

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

crates/blobber/src/fetch.rs

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -205,48 +205,51 @@ where
205205
}
206206

207207
/// Returns the blob from the pylon blob indexer.
208-
#[instrument(skip_all, err)]
208+
#[instrument(skip_all)]
209209
async fn get_blobs_from_pylon(&self, tx: TxHash) -> FetchResult<Blobs> {
210-
if let Some(url) = &self.pylon_url {
211-
let url = url.join(&format!("sidecar/{tx}"))?;
212-
213-
let response = self.client.get(url).header("accept", "application/json").send().await?;
214-
response
215-
.json::<Arc<BlobTransactionSidecarVariant>>()
216-
.await
217-
.map(Into::into)
218-
.map_err(Into::into)
219-
} else {
220-
Err(BlobFetcherError::Unrecoverable(UnrecoverableBlobError::ConsensusClientUrlNotSet))
221-
}
210+
let Some(url) = &self.pylon_url else {
211+
return Err(BlobFetcherError::Unrecoverable(
212+
UnrecoverableBlobError::ConsensusClientUrlNotSet,
213+
));
214+
};
215+
let url = url.join(&format!("sidecar/{tx}"))?;
216+
217+
let response = self.client.get(url).header("accept", "application/json").send().await?;
218+
response
219+
.json::<Arc<BlobTransactionSidecarVariant>>()
220+
.await
221+
.map(Into::into)
222+
.map_err(Into::into)
222223
}
223224

224225
/// Queries the connected consensus client for the blob transaction
225-
#[instrument(skip_all, err)]
226+
#[instrument(skip_all)]
226227
async fn get_blobs_from_cl(
227228
&self,
228229
slot: usize,
229230
versioned_hashes: &[B256],
230231
) -> FetchResult<Blobs> {
231-
if let Some(url) = &self.cl_url {
232-
let url = url.join(&format!("/eth/v1/beacon/blob_sidecars/{slot}")).map_err(|err| {
233-
BlobFetcherError::Unrecoverable(UnrecoverableBlobError::UrlParse(err))
234-
})?;
232+
let Some(url) = &self.cl_url else {
233+
return Err(BlobFetcherError::Unrecoverable(
234+
UnrecoverableBlobError::ConsensusClientUrlNotSet,
235+
));
236+
};
235237

236-
let response = self.client.get(url).header("accept", "application/json").send().await?;
238+
let url = url.join(&format!("/eth/v1/beacon/blob_sidecars/{slot}")).map_err(|err| {
239+
BlobFetcherError::Unrecoverable(UnrecoverableBlobError::UrlParse(err))
240+
})?;
237241

238-
let response: BeaconBlobBundle = response.json().await?;
242+
let response = self.client.get(url).header("accept", "application/json").send().await?;
239243

240-
extract_blobs_from_bundle(response, versioned_hashes)
241-
} else {
242-
Err(BlobFetcherError::Unrecoverable(UnrecoverableBlobError::ConsensusClientUrlNotSet))
243-
}
244+
let response: BeaconBlobBundle = response.json().await?;
245+
246+
extract_blobs_from_bundle(response, versioned_hashes)
244247
}
245248

246249
/// Get the Zenith block from the extracted event.
247250
/// For 4844 transactions, this fetches the transaction's blobs and decodes them.
248251
/// For any other type of transactions, it returns a Non4844Transaction error.
249-
#[tracing::instrument(skip(self, extract), fields(eip4844 = extract.is_eip4844(), tx = %extract.tx_hash(), url = self.explorer.baseurl()))]
252+
#[tracing::instrument(skip(self, extract), fields(tx = %extract.tx_hash(), url = self.explorer.baseurl()))]
250253
async fn get_signet_block(
251254
&self,
252255
extract: &ExtractedEvent<'_, Receipt, BlockSubmitted>,

0 commit comments

Comments
 (0)