From 10c4ffc9d2c8e9e5501d27ca9d7b58f4c2a45d15 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 19 Sep 2023 10:55:52 -0700 Subject: [PATCH] smarter archive retry --- Cargo.lock | 4 ++-- web3_proxy/Cargo.toml | 2 +- web3_proxy/src/app/mod.rs | 4 +++- web3_proxy_cli/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3e44497..141b20d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6732,7 +6732,7 @@ dependencies = [ [[package]] name = "web3_proxy" -version = "1.43.2" +version = "1.43.3" dependencies = [ "anyhow", "arc-swap", @@ -6812,7 +6812,7 @@ dependencies = [ [[package]] name = "web3_proxy_cli" -version = "1.43.2" +version = "1.43.3" dependencies = [ "env_logger", "parking_lot", diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index cdfadbd4..84d3a5a9 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web3_proxy" -version = "1.43.2" +version = "1.43.3" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/web3_proxy/src/app/mod.rs b/web3_proxy/src/app/mod.rs index a90d3c4d..4cd8b490 100644 --- a/web3_proxy/src/app/mod.rs +++ b/web3_proxy/src/app/mod.rs @@ -1441,6 +1441,7 @@ impl Web3ProxyApp { }; if try_archive { + // TODO: only charge for archive if it gave a result request_metadata .archive_request .store(true, atomic::Ordering::Relaxed); @@ -1454,7 +1455,8 @@ impl Web3ProxyApp { Some(Duration::from_secs(30)), // TODO: should this be block 0 instead? Some(&U64::one()), - None, + // TODO: is this a good way to allow lagged archive nodes a try + Some(&head_block.unwrap().number().saturating_sub(5.into()).clamp(U64::one(), U64::MAX)), ) .await; } diff --git a/web3_proxy_cli/Cargo.toml b/web3_proxy_cli/Cargo.toml index 155657b2..d192d773 100644 --- a/web3_proxy_cli/Cargo.toml +++ b/web3_proxy_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web3_proxy_cli" -version = "1.43.2" +version = "1.43.3" edition = "2021" default-run = "web3_proxy_cli"