From 1185b2d0f96ca1502f2b13d96df9784df7763053 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 28 Jul 2023 10:38:12 -0700 Subject: [PATCH] cache eth_maxPriorityFeePerGas with the head block --- web3_proxy/src/block_number.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web3_proxy/src/block_number.rs b/web3_proxy/src/block_number.rs index 24641529..47db3817 100644 --- a/web3_proxy/src/block_number.rs +++ b/web3_proxy/src/block_number.rs @@ -234,11 +234,13 @@ impl CacheMode { "eth_getBlockByHash" => { // TODO: double check that any node can serve this // TODO: can a block change? like what if it gets orphaned? + // TODO: make sure re-orgs work properly! return Ok(CacheMode::CacheSuccessForever); } "eth_getBlockByNumber" => { // TODO: double check that any node can serve this // TODO: CacheSuccessForever if the block is old enough + // TODO: make sure re-orgs work properly! return Ok(CacheMode::Cache { block: head_block.into(), cache_errors: true, @@ -351,6 +353,13 @@ impl CacheMode { return Ok(CacheMode::CacheSuccessForever); } "eth_getUncleCountByBlockNumber" => 0, + "eth_maxPriorityFeePerGas" => { + // TODO: this might be too aggressive. i think it can change before a block is mined + return Ok(CacheMode::Cache { + block: head_block.into(), + cache_errors: false, + }); + } _ => { // some other command that doesn't take block numbers as an argument // since we are caching with the head block, it should be safe to cache_errors