Skip to content

Commit c77ae5b

Browse files
committed
refactor: improve constants
1 parent 466623d commit c77ae5b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

crates/blobber/src/cache.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use crate::{BlobFetcherError, Blobs, FetchResult};
22
use alloy::consensus::{SidecarCoder, SimpleCoder, Transaction as _};
3+
use alloy::eips::eip7691::MAX_BLOBS_PER_BLOCK_ELECTRA;
4+
use alloy::eips::merge::EPOCH_SLOTS;
35
use alloy::primitives::{keccak256, Bytes, B256};
46
use reth::transaction_pool::TransactionPool;
57
use reth::{network::cache::LruMap, primitives::Receipt};
@@ -13,7 +15,8 @@ use std::{
1315
use tokio::sync::{mpsc, oneshot};
1416
use tracing::{error, info, instrument, warn};
1517

16-
const BLOB_CACHE_SIZE: u32 = 144;
18+
const BLOB_CACHE_SIZE: u32 = (MAX_BLOBS_PER_BLOCK_ELECTRA * EPOCH_SLOTS) as u32;
19+
const CACHE_REQUEST_CHANNEL_SIZE: usize = (MAX_BLOBS_PER_BLOCK_ELECTRA * 2) as usize;
1720
const FETCH_RETRIES: usize = 3;
1821
const BETWEEN_RETRIES: Duration = Duration::from_millis(250);
1922

@@ -198,7 +201,7 @@ impl<Pool: TransactionPool + 'static> BlobCacher<Pool> {
198201
/// # Panics
199202
/// This function will panic if the cache task fails to spawn.
200203
pub fn spawn(self) -> CacheHandle {
201-
let (sender, inst) = mpsc::channel(12);
204+
let (sender, inst) = mpsc::channel(CACHE_REQUEST_CHANNEL_SIZE);
202205
tokio::spawn(Arc::new(self).task_future(inst));
203206
CacheHandle { sender }
204207
}

crates/blobber/src/fetch.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,16 @@ mod tests {
339339
},
340340
eips::Encodable2718,
341341
primitives::{TxKind, U256, bytes},
342+
rlp::encode,
343+
signers::{SignerSync, local::PrivateKeySigner},
342344
};
343345
use foundry_blob_explorers::TransactionDetails;
346+
use reth::primitives::Transaction;
344347
use reth_transaction_pool::{
345348
PoolTransaction, TransactionOrigin,
346349
test_utils::{MockTransaction, testing_pool},
347350
};
348-
use signet_types::constants::SignetSystemConstants;
351+
use signet_types::{constants::SignetSystemConstants, primitives::TransactionSigned};
349352

350353
const BLOBSCAN_BLOB_RESPONSE: &str = include_str!("../../../tests/artifacts/blob.json");
351354
/// Blob from Slot 2277733, corresponding to block 277722 on Pecorino host.

0 commit comments

Comments
 (0)