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 || {
26 let _permit = permit;
27 sidecar.try_into_7594(EnvKzgSettings::Default.get())
28 })
29 .await
30 .ok()?
31 .ok()
32 }
33}