learn to cache more

This commit is contained in:
Bryan Stitt 2023-08-15 16:37:53 -07:00
parent 9bd18250fe
commit 54341c4654
4 changed files with 12 additions and 6 deletions

4
Cargo.lock generated

@ -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",

@ -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

@ -210,7 +210,9 @@ fn get_block_param_id(method: &str) -> Option<usize> {
"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 =

@ -1,6 +1,6 @@
[package]
name = "web3_proxy_cli"
version = "1.42.6"
version = "1.42.7"
edition = "2021"
default-run = "web3_proxy_cli"