From 54341c46540ab8b7db8d5fb73f1142692d05196c Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 15 Aug 2023 16:37:53 -0700 Subject: [PATCH] learn to cache more --- Cargo.lock | 4 ++-- web3_proxy/Cargo.toml | 2 +- web3_proxy/src/block_number.rs | 10 ++++++++-- web3_proxy_cli/Cargo.toml | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 55191222..9295061d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7242,7 +7242,7 @@ dependencies = [ [[package]] name = "web3_proxy" -version = "1.42.6" +version = "1.42.7" dependencies = [ "anyhow", "arc-swap", @@ -7323,7 +7323,7 @@ dependencies = [ [[package]] name = "web3_proxy_cli" -version = "1.42.6" +version = "1.42.7" dependencies = [ "env_logger", "parking_lot", diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index c96c5215..8fabcf0e 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web3_proxy" -version = "1.42.6" +version = "1.42.7" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/web3_proxy/src/block_number.rs b/web3_proxy/src/block_number.rs index cf689a11..2ec96eb6 100644 --- a/web3_proxy/src/block_number.rs +++ b/web3_proxy/src/block_number.rs @@ -210,7 +210,9 @@ fn get_block_param_id(method: &str) -> Option { "eth_getTransactionCount" => Some(1), "eth_getUncleByBlockNumberAndIndex" => Some(0), "eth_getUncleCountByBlockNumber" => Some(0), + "trace_block" => Some(0), "trace_call" => Some(2), + "trace_callMany" => Some(1), _ => None, } } @@ -266,8 +268,10 @@ impl CacheMode { } match method { - "net_listening" => Ok(CacheMode::CacheSuccessForever), - "net_version" => Ok(CacheMode::CacheSuccessForever), + "debug_traceTransaction" => { + // TODO: make sure re-orgs work properly! + Ok(CacheMode::CacheSuccessForever) + } "eth_gasPrice" => Ok(CacheMode::Cache { block: head_block.into(), cache_errors: false, @@ -393,6 +397,8 @@ impl CacheMode { cache_errors: false, }) } + "net_listening" => Ok(CacheMode::CacheSuccessForever), + "net_version" => Ok(CacheMode::CacheSuccessForever), method => match get_block_param_id(method) { Some(block_param_id) => { let block = diff --git a/web3_proxy_cli/Cargo.toml b/web3_proxy_cli/Cargo.toml index bf1e9be1..4d277cec 100644 --- a/web3_proxy_cli/Cargo.toml +++ b/web3_proxy_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web3_proxy_cli" -version = "1.42.6" +version = "1.42.7" edition = "2021" default-run = "web3_proxy_cli"