mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: move RPC cache constants and type (#8597)
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
use clap::Args;
|
||||
use reth_rpc::eth::cache::{
|
||||
use reth_rpc_server_types::constants::cache::{
|
||||
DEFAULT_BLOCK_CACHE_MAX_LEN, DEFAULT_CONCURRENT_DB_REQUESTS, DEFAULT_ENV_CACHE_MAX_LEN,
|
||||
DEFAULT_RECEIPT_CACHE_MAX_LEN,
|
||||
};
|
||||
|
||||
@ -65,3 +65,30 @@ pub mod gas_oracle {
|
||||
/// The default minimum gas price, under which the sample will be ignored
|
||||
pub const DEFAULT_IGNORE_GAS_PRICE: U256 = U256::from_limbs([2u64, 0, 0, 0]);
|
||||
}
|
||||
|
||||
/// Cache specific constants
|
||||
pub mod cache {
|
||||
// TODO: memory based limiter is currently disabled pending <https://github.com/paradigmxyz/reth/issues/3503>
|
||||
/// Default cache size for the block cache: 500MB
|
||||
///
|
||||
/// With an average block size of ~100kb this should be able to cache ~5000 blocks.
|
||||
pub const DEFAULT_BLOCK_CACHE_SIZE_BYTES_MB: usize = 500;
|
||||
|
||||
/// Default cache size for the receipts cache: 500MB
|
||||
pub const DEFAULT_RECEIPT_CACHE_SIZE_BYTES_MB: usize = 500;
|
||||
|
||||
/// Default cache size for the env cache: 1MB
|
||||
pub const DEFAULT_ENV_CACHE_SIZE_BYTES_MB: usize = 1;
|
||||
|
||||
/// Default cache size for the block cache: 5000 blocks.
|
||||
pub const DEFAULT_BLOCK_CACHE_MAX_LEN: u32 = 5000;
|
||||
|
||||
/// Default cache size for the receipts cache: 2000 receipts.
|
||||
pub const DEFAULT_RECEIPT_CACHE_MAX_LEN: u32 = 2000;
|
||||
|
||||
/// Default cache size for the env cache: 1000 envs.
|
||||
pub const DEFAULT_ENV_CACHE_MAX_LEN: u32 = 1000;
|
||||
|
||||
/// Default number of concurrent database requests.
|
||||
pub const DEFAULT_CONCURRENT_DB_REQUESTS: usize = 512;
|
||||
}
|
||||
|
||||
25
crates/rpc/rpc/src/eth/cache/config.rs
vendored
25
crates/rpc/rpc/src/eth/cache/config.rs
vendored
@ -1,29 +1,6 @@
|
||||
use reth_rpc_server_types::constants::cache::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// TODO: memory based limiter is currently disabled pending <https://github.com/paradigmxyz/reth/issues/3503>
|
||||
/// Default cache size for the block cache: 500MB
|
||||
///
|
||||
/// With an average block size of ~100kb this should be able to cache ~5000 blocks.
|
||||
pub const DEFAULT_BLOCK_CACHE_SIZE_BYTES_MB: usize = 500;
|
||||
|
||||
/// Default cache size for the receipts cache: 500MB
|
||||
pub const DEFAULT_RECEIPT_CACHE_SIZE_BYTES_MB: usize = 500;
|
||||
|
||||
/// Default cache size for the env cache: 1MB
|
||||
pub const DEFAULT_ENV_CACHE_SIZE_BYTES_MB: usize = 1;
|
||||
|
||||
/// Default cache size for the block cache: 5000 blocks.
|
||||
pub const DEFAULT_BLOCK_CACHE_MAX_LEN: u32 = 5000;
|
||||
|
||||
/// Default cache size for the receipts cache: 2000 receipts.
|
||||
pub const DEFAULT_RECEIPT_CACHE_MAX_LEN: u32 = 2000;
|
||||
|
||||
/// Default cache size for the env cache: 1000 envs.
|
||||
pub const DEFAULT_ENV_CACHE_MAX_LEN: u32 = 1000;
|
||||
|
||||
/// Default number of concurrent database requests.
|
||||
pub const DEFAULT_CONCURRENT_DB_REQUESTS: usize = 512;
|
||||
|
||||
/// Settings for the [`EthStateCache`](crate::eth::cache::EthStateCache).
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
Reference in New Issue
Block a user