diff --git a/node/cli-opt/src/lib.rs b/node/cli-opt/src/lib.rs index 6330d53f51..ac82ca7d29 100644 --- a/node/cli-opt/src/lib.rs +++ b/node/cli-opt/src/lib.rs @@ -74,5 +74,6 @@ pub struct RpcConfig { pub ethapi_max_permits: u32, pub ethapi_trace_max_count: u32, pub ethapi_trace_cache_duration: u64, + pub eth_log_block_cache: usize, pub max_past_logs: u32, } diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index 9d00244cb7..1bfa45308a 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -169,6 +169,10 @@ pub struct RunCmd { #[structopt(long, default_value = "300")] pub ethapi_trace_cache_duration: u64, + /// Size of the LRU cache for block data and their transaction statuses. + #[structopt(long, default_value = "3000")] + pub eth_log_block_cache: usize, + /// Maximum number of logs in a query. #[structopt(long, default_value = "10000")] pub max_past_logs: u32, diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 4ce00b4297..2fb1f661f0 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -550,6 +550,7 @@ pub fn run() -> Result<()> { ethapi_max_permits: cli.run.ethapi_max_permits, ethapi_trace_max_count: cli.run.ethapi_trace_max_count, ethapi_trace_cache_duration: cli.run.ethapi_trace_cache_duration, + eth_log_block_cache: cli.run.eth_log_block_cache, max_past_logs: cli.run.max_past_logs, }; diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 602bc4c479..a9f00ecbde 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -523,18 +523,19 @@ where }; let deps = rpc::FullDeps { + backend: backend.clone(), client: client.clone(), - pool: pool.clone(), - graph: pool.pool().clone(), + command_sink: None, deny_unsafe, - is_authority: collator, - network: network.clone(), - filter_pool: filter_pool.clone(), ethapi_cmd: ethapi_cmd.clone(), - command_sink: None, + eth_log_block_cache: rpc_config.eth_log_block_cache, + filter_pool: filter_pool.clone(), frontier_backend: frontier_backend.clone(), - backend: backend.clone(), + graph: pool.pool().clone(), + pool: pool.clone(), + is_authority: collator, max_past_logs, + network: network.clone(), transaction_converter, }; #[allow(unused_mut)] @@ -868,18 +869,19 @@ where }; let deps = rpc::FullDeps { + backend: backend.clone(), client: client.clone(), - pool: pool.clone(), - graph: pool.pool().clone(), + command_sink: command_sink.clone(), deny_unsafe, - is_authority: collator, - network: network.clone(), - filter_pool: filter_pool.clone(), ethapi_cmd: ethapi_cmd.clone(), - command_sink: command_sink.clone(), + eth_log_block_cache: rpc_config.eth_log_block_cache, + filter_pool: filter_pool.clone(), frontier_backend: frontier_backend.clone(), - backend: backend.clone(), + graph: pool.pool().clone(), + pool: pool.clone(), + is_authority: collator, max_past_logs, + network: network.clone(), transaction_converter, }; #[allow(unused_mut)] diff --git a/node/service/src/rpc.rs b/node/service/src/rpc.rs index 61e8b1265c..ffd6884aa4 100644 --- a/node/service/src/rpc.rs +++ b/node/service/src/rpc.rs @@ -77,6 +77,8 @@ pub struct FullDeps { pub filter_pool: Option, /// The list of optional RPC extensions. pub ethapi_cmd: Vec, + /// Size of the LRU cache for block data and their transaction statuses. + pub eth_log_block_cache: usize, /// Frontier Backend. pub frontier_backend: Arc>, /// Backend. @@ -115,6 +117,7 @@ where network, filter_pool, ethapi_cmd, + eth_log_block_cache, command_sink, frontier_backend, backend: _, @@ -133,7 +136,10 @@ where // TODO: are we supporting signing? let signers = Vec::new(); - let block_data_cache = Arc::new(EthBlockDataCache::new(3000, 3000)); + let block_data_cache = Arc::new(EthBlockDataCache::new( + eth_log_block_cache, + eth_log_block_cache, + )); let mut overrides_map = BTreeMap::new(); overrides_map.insert(