diff --git a/crates/rpc/rpc/src/eth/cache.rs b/crates/rpc/rpc/src/eth/cache.rs index 8a44169909..2b3f21a16d 100644 --- a/crates/rpc/rpc/src/eth/cache.rs +++ b/crates/rpc/rpc/src/eth/cache.rs @@ -21,6 +21,14 @@ use tokio::sync::{ }; use tokio_stream::wrappers::UnboundedReceiverStream; +/// Default cache size for the block cache: 500MB +/// +/// With an average block size of ~100kb this should be able to cache ~5000 blocks. +const DEFAULT_BLOCK_CACHE_SIZE_BYTES: usize = 500 * 1024 * 1024; + +/// Default cache size for the receipts cache: 500MB +const DEFAULT_RECEIPT_CACHE_SIZE_BYTES: usize = 500 * 1024 * 1024; + /// The type that can send the response to a requested [Block] type BlockResponseSender = oneshot::Sender>>; @@ -50,24 +58,24 @@ type EnvLruCache = MultiConsumerLruCache Self { Self { - max_block_bytes: 50 * 1024 * 1024, - max_receipt_bytes: 50 * 1024 * 1024, - max_env_bytes: 500 * 1024, + max_block_bytes: DEFAULT_BLOCK_CACHE_SIZE_BYTES, + max_receipt_bytes: DEFAULT_RECEIPT_CACHE_SIZE_BYTES, + max_env_bytes: 1024 * 1024, } } }