From ed0b74f18692bda3eecc010fc79537f8dff1ace9 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Thu, 9 Nov 2023 17:49:53 -0800 Subject: [PATCH] 1.43.88 --- Cargo.lock | 33 ++++++++++++----------- deduped_broadcast/Cargo.toml | 2 +- deferred-rate-limiter/Cargo.toml | 2 +- latency/Cargo.toml | 4 +-- migration/Cargo.toml | 2 +- rate-counter/Cargo.toml | 2 +- redis-rate-limiter/Cargo.toml | 2 +- rust-toolchain.toml | 2 +- web3_proxy/Cargo.toml | 10 +++---- web3_proxy/src/frontend/mod.rs | 9 ++++--- web3_proxy/src/frontend/rpc_proxy_http.rs | 14 +++++++--- web3_proxy/src/rpcs/request.rs | 5 +++- web3_proxy_cli/Cargo.toml | 2 +- 13 files changed, 50 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d9d9701d..d6e494bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1938,11 +1938,12 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdlimit" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b" +checksum = "e182f7dbc2ef73d9ef67351c5fbbea084729c48362d3ce9dd44c28e32e277fe5" dependencies = [ "libc", + "thiserror", ] [[package]] @@ -2302,9 +2303,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.4.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" dependencies = [ "log", "pest", @@ -4556,9 +4557,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64 0.21.5", ] @@ -5283,9 +5284,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "smart-default" @@ -5688,9 +5689,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "svm-rs" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0cc95be7cc2c384a2f57cac56548d2178650905ebe5725bc8970ccc25529060" +checksum = "20689c7d03b6461b502d0b95d6c24874c7d24dea2688af80486a130a06af3b07" dependencies = [ "dirs 5.0.1", "fs2", @@ -5912,9 +5913,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -5972,9 +5973,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -6637,7 +6638,7 @@ dependencies = [ [[package]] name = "web3_proxy" -version = "1.43.87" +version = "1.43.88" dependencies = [ "anyhow", "arc-swap", @@ -6714,7 +6715,7 @@ dependencies = [ [[package]] name = "web3_proxy_cli" -version = "1.43.87" +version = "1.43.88" dependencies = [ "console-subscriber", "env_logger", diff --git a/deduped_broadcast/Cargo.toml b/deduped_broadcast/Cargo.toml index 57d0f03b..69ae87fa 100644 --- a/deduped_broadcast/Cargo.toml +++ b/deduped_broadcast/Cargo.toml @@ -8,4 +8,4 @@ edition = "2021" [dependencies] moka = { version = "0.12.1", features = ["future"] } serde = "1" -tokio = { version = "1.33.0", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } diff --git a/deferred-rate-limiter/Cargo.toml b/deferred-rate-limiter/Cargo.toml index 85140923..d5e5cb40 100644 --- a/deferred-rate-limiter/Cargo.toml +++ b/deferred-rate-limiter/Cargo.toml @@ -9,5 +9,5 @@ redis-rate-limiter = { path = "../redis-rate-limiter" } anyhow = "1.0.75" moka = { version = "0.12.1", features = ["future"] } -tokio = "1.33.0" +tokio = "1.34.0" tracing = "0.1.40" diff --git a/latency/Cargo.toml b/latency/Cargo.toml index 33d8f924..1ffaeac7 100644 --- a/latency/Cargo.toml +++ b/latency/Cargo.toml @@ -8,9 +8,9 @@ edition = "2021" [dependencies] portable-atomic = { version = "1.5.1", features = ["float"] } serde = { version = "1.0.192", features = [] } -tokio = { version = "1.33.0", features = ["full"] } +tokio = { version = "1.34.0", features = ["full"] } tracing = "0.1.40" watermill = "0.1.1" [dev-dependencies] -tokio = { version = "1.33.0", features = ["full", "test-util"] } +tokio = { version = "1.34.0", features = ["full", "test-util"] } diff --git a/migration/Cargo.toml b/migration/Cargo.toml index 2989839e..3a18191b 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -9,7 +9,7 @@ name = "migration" path = "src/lib.rs" [dependencies] -tokio = { version = "1.33.0", features = ["full", "tracing"] } +tokio = { version = "1.34.0", features = ["full", "tracing"] } chrono = "0.4.31" [dependencies.sea-orm-migration] diff --git a/rate-counter/Cargo.toml b/rate-counter/Cargo.toml index aeb1bf18..69ca3a7e 100644 --- a/rate-counter/Cargo.toml +++ b/rate-counter/Cargo.toml @@ -5,4 +5,4 @@ authors = ["Bryan Stitt "] edition = "2021" [dependencies] -tokio = { version = "1.33.0", features = ["time"] } +tokio = { version = "1.34.0", features = ["time"] } diff --git a/redis-rate-limiter/Cargo.toml b/redis-rate-limiter/Cargo.toml index 2d60536c..0a540df2 100644 --- a/redis-rate-limiter/Cargo.toml +++ b/redis-rate-limiter/Cargo.toml @@ -8,4 +8,4 @@ edition = "2021" anyhow = "1.0.75" chrono = "0.4.31" deadpool-redis = { version = "0.13.0", features = ["rt_tokio_1", "serde"] } -tokio = "1.33.0" +tokio = "1.34.0" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f2c9ba01..af54d2b7 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2023-11-03" +channel = "nightly-2023-11-09" diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index d4e83a0f..0e1f26b6 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web3_proxy" -version = "1.43.87" +version = "1.43.88" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -50,12 +50,12 @@ chrono = { version = "0.4.31" } derivative = "2.2.0" derive_more = { version = "0.99.17", features = ["nightly"] } ethers = { version = "2.0.10", default-features = false, features = ["rustls", "ws"] } -fdlimit = "0.2.1" +fdlimit = "0.3.0" fstrings = "0.2" futures = { version = "0.3.29" } futures-util = "0.3.29" glob = "0.3.1" -handlebars = "4.4.0" +handlebars = "4.5.0" hashbrown = { version = "0.14.2", features = ["serde", "nightly"] } hdrhistogram = "7.5.2" hostname = "0.3.1" @@ -84,7 +84,7 @@ serde_json = { version = "1.0.108", default-features = false, features = ["raw_v serde_prometheus = "0.2.4" strum = { version = "0.25.0", features = ["derive"] } time = { version = "0.3" } -tokio = { version = "1.33.0", features = ["full", "tracing"] } +tokio = { version = "1.34.0", features = ["full", "tracing"] } tokio-stream = { version = "0.1.14", features = ["sync"] } toml = "0.8.8" tower-http = { version = "0.4.4", features = ["cors", "normalize-path", "sensitive-headers", "trace"] } @@ -103,6 +103,6 @@ test-log = { version = "0.2.13", default-features = false, features = ["trace"] [dev-dependencies] env_logger = { version ="0.10", default-features = true, features = ["auto-color"] } -tokio = { version = "1.33.0", default-features = false, features = ["full", "test-util"] } +tokio = { version = "1.34.0", default-features = false, features = ["full", "test-util"] } tracing = {version = "0.1", default-features = false} tracing-subscriber = {version = "0.3", features = ["env-filter"]} diff --git a/web3_proxy/src/frontend/mod.rs b/web3_proxy/src/frontend/mod.rs index 2f078818..878e32c4 100644 --- a/web3_proxy/src/frontend/mod.rs +++ b/web3_proxy/src/frontend/mod.rs @@ -7,11 +7,11 @@ pub mod admin; pub mod authorization; pub mod errors; +pub mod request_id; pub mod rpc_proxy_http; pub mod rpc_proxy_ws; pub mod status; pub mod users; -pub mod request_id; use crate::app::App; use crate::errors::Web3ProxyResult; @@ -19,9 +19,9 @@ use axum::{ routing::{get, post}, Extension, Router, }; -use request_id::RequestId; use http::{header::AUTHORIZATION, Request, StatusCode}; use hyper::Body; +use request_id::RequestId; use moka::future::{Cache, CacheBuilder}; use std::sync::Arc; @@ -60,7 +60,8 @@ pub fn make_router(app: Arc) -> Router<()> { let response_cache = Arc::new(response_cache); - let mut router = Router::new() + #[allow(unused_mut)] + let mut router = Router::>::new() // TODO: i think these routes could be done a lot better // // HTTP RPC (POST) @@ -270,7 +271,7 @@ pub fn make_router(app: Arc) -> Router<()> { // Axum layers // layers are ordered bottom up // the last layer is first for requests and last for responses - let router = router + let router: Router<(), _> = router // Remove trailing slashes // TODO: this isn't working for me. why? .layer(NormalizePathLayer::trim_trailing_slash()) diff --git a/web3_proxy/src/frontend/rpc_proxy_http.rs b/web3_proxy/src/frontend/rpc_proxy_http.rs index 767a5cad..0b5c8169 100644 --- a/web3_proxy/src/frontend/rpc_proxy_http.rs +++ b/web3_proxy/src/frontend/rpc_proxy_http.rs @@ -9,8 +9,8 @@ use axum::extract::rejection::JsonRejection; use axum::extract::{Path, State}; use axum::headers::{Origin, Referer, UserAgent}; use axum::response::Response; -use axum::TypedHeader; use axum::{response::IntoResponse, Json}; +use axum::{Extension, TypedHeader}; use axum_client_ip::InsecureClientIp; use axum_macros::debug_handler; use http::HeaderMap; @@ -154,14 +154,16 @@ async fn _proxy_web3_rpc( /// Can optionally authorized based on origin, referer, or user agent. /// If possible, please use a WebSocket instead. #[debug_handler] +#[allow(clippy::too_many_arguments)] pub async fn proxy_web3_rpc_with_key( State(app): State>, InsecureClientIp(ip): InsecureClientIp, origin: Option>, referer: Option>, - user_agent: Option>, - Path(rpc_key): Path, Extension(RequestId(request_id)): Extension, + Path(rpc_key): Path, + user_agent: Option>, + // body extractors always have to be last payload: Result, JsonRejection>, ) -> Result { _proxy_web3_rpc_with_key( @@ -190,6 +192,7 @@ pub async fn debug_proxy_web3_rpc_with_key( request_headers: HeaderMap, Path(rpc_key): Path, Extension(RequestId(request_id)): Extension, + // body extractors always have to be last payload: Result, JsonRejection>, ) -> Result { let mut response = match _proxy_web3_rpc_with_key( @@ -227,14 +230,16 @@ pub async fn debug_proxy_web3_rpc_with_key( } #[debug_handler] +#[allow(clippy::too_many_arguments)] pub async fn fastest_proxy_web3_rpc_with_key( State(app): State>, InsecureClientIp(ip): InsecureClientIp, origin: Option>, referer: Option>, - user_agent: Option>, Path(rpc_key): Path, Extension(RequestId(request_id)): Extension, + user_agent: Option>, + // body extractors always have to be last payload: Result, JsonRejection>, ) -> Result { _proxy_web3_rpc_with_key( @@ -251,6 +256,7 @@ pub async fn fastest_proxy_web3_rpc_with_key( .await } +#[allow(clippy::too_many_arguments)] #[debug_handler] pub async fn versus_proxy_web3_rpc_with_key( State(app): State>, diff --git a/web3_proxy/src/rpcs/request.rs b/web3_proxy/src/rpcs/request.rs index 28ef9b6f..49111e3c 100644 --- a/web3_proxy/src/rpcs/request.rs +++ b/web3_proxy/src/rpcs/request.rs @@ -213,9 +213,12 @@ impl OpenRequestHandle { if request.method == "eth_sendRawTransaction" { if let Some(ref request_id) = self.web3_request.request_id { let mut headers = reqwest::header::HeaderMap::with_capacity(1); - let request_id = reqwest::header::HeaderValue::from_str(&request_id) + let request_id = reqwest::header::HeaderValue::from_str(request_id) .expect("request id should be a valid header"); headers.insert("x-amzn-trace-id", request_id); + + // TODO: more headers for the various rpc protection modes + request_builder = request_builder.headers(headers); } } diff --git a/web3_proxy_cli/Cargo.toml b/web3_proxy_cli/Cargo.toml index 0020df17..787a64fa 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.87" +version = "1.43.88" edition = "2021" default-run = "web3_proxy_cli"