reth_transaction_pool/blobstore/
converter.rs1use alloy_consensus::{BlobTransactionSidecar, EnvKzgSettings};
2use alloy_eips::eip7594::BlobTransactionSidecarEip7594;
3use tokio::sync::Semaphore;
4
5static SEMAPHORE: Semaphore = Semaphore::const_new(5);
7
8#[derive(Debug, Clone, Default)]
10#[non_exhaustive]
11pub struct BlobSidecarConverter;
12
13impl BlobSidecarConverter {
14 pub const fn new() -> Self {
16 Self
17 }
18
19 pub async fn convert(
21 &self,
22 sidecar: BlobTransactionSidecar,
23 ) -> Option<BlobTransactionSidecarEip7594> {
24 let _permit = SEMAPHORE.acquire().await.ok()?;
25 tokio::task::spawn_blocking(move || sidecar.try_into_7594(EnvKzgSettings::Default.get()))
26 .await
27 .ok()?
28 .ok()
29 }
30}