From fb62243c3ee78e8b48fac40d38127b499f835992 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 6 Jan 2023 15:58:52 -0800 Subject: [PATCH] Revert "cargo upgrade and use trailing slash route extra" This reverts commit 5bfba3a87afbf4157c2b0bd36273e3dcc4075578. --- Cargo.lock | 28 ++++------------------------ deferred-rate-limiter/Cargo.toml | 2 +- migration/Cargo.toml | 2 +- redis-rate-limiter/Cargo.toml | 2 +- web3_proxy/Cargo.toml | 5 ++--- web3_proxy/src/frontend/mod.rs | 13 ++++++++++--- web3_proxy/src/frontend/status.rs | 1 + 7 files changed, 20 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f62b429..e106b51b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -405,25 +405,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "axum-extra" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a320103719de37b7b4da4c8eb629d4573f6bcfd3dfe80d3208806895ccf81d" -dependencies = [ - "axum", - "bytes", - "futures-util", - "http", - "mime", - "pin-project-lite", - "tokio", - "tower", - "tower-http", - "tower-layer", - "tower-service", -] - [[package]] name = "axum-macros" version = "0.3.0" @@ -2080,9 +2061,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "group" @@ -5002,9 +4983,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.24.1" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" +checksum = "38a54aca0c15d014013256222ba0ebed095673f89345dd79119d912eb561b7a8" dependencies = [ "autocfg", "bytes", @@ -5555,7 +5536,6 @@ dependencies = [ "argh", "axum", "axum-client-ip", - "axum-extra", "axum-macros", "chrono", "counter", diff --git a/deferred-rate-limiter/Cargo.toml b/deferred-rate-limiter/Cargo.toml index e5ee532a..81dad0d6 100644 --- a/deferred-rate-limiter/Cargo.toml +++ b/deferred-rate-limiter/Cargo.toml @@ -11,4 +11,4 @@ anyhow = "1.0.68" hashbrown = "0.13.1" log = "0.4.17" moka = { version = "0.9.6", default-features = false, features = ["future"] } -tokio = "1.24.1" +tokio = "1.23.1" diff --git a/migration/Cargo.toml b/migration/Cargo.toml index fd1e4a12..62cbdc8a 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -9,7 +9,7 @@ name = "migration" path = "src/lib.rs" [dependencies] -tokio = { version = "1.24.1", features = ["full", "tracing"] } +tokio = { version = "1.23.1", features = ["full", "tracing"] } [dependencies.sea-orm-migration] version = "0.10.6" diff --git a/redis-rate-limiter/Cargo.toml b/redis-rate-limiter/Cargo.toml index fcc05372..3c81d19a 100644 --- a/redis-rate-limiter/Cargo.toml +++ b/redis-rate-limiter/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] anyhow = "1.0.68" deadpool-redis = { version = "0.11.1", features = ["rt_tokio_1", "serde"] } -tokio = "1.24.1" +tokio = "1.23.1" diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index c90d486f..f1a29895 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -60,7 +60,7 @@ serde_json = { version = "1.0.91", default-features = false, features = ["alloc" serde_prometheus = "0.1.6" # TODO: make sure this time version matches siwe. PR to put this in their prelude time = "0.3.17" -tokio = { version = "1.24.1", features = ["full"] } +tokio = { version = "1.23.1", features = ["full"] } # TODO: make sure this uuid version matches sea-orm. PR to put this in their prelude tokio-stream = { version = "0.1.11", features = ["sync"] } toml = "0.5.10" @@ -70,5 +70,4 @@ ulid = { version = "1.0.0", features = ["serde"] } url = "2.3.1" uuid = "1.2.2" itertools = "0.10.5" -glob = "0.3.1" -axum-extra = "0.4.2" +glob = "0.3.0" diff --git a/web3_proxy/src/frontend/mod.rs b/web3_proxy/src/frontend/mod.rs index da022e7a..4d94367c 100644 --- a/web3_proxy/src/frontend/mod.rs +++ b/web3_proxy/src/frontend/mod.rs @@ -13,7 +13,6 @@ use axum::{ routing::{get, post, put}, Extension, Router, }; -use axum_extra::routing::RouterExt; use http::header::AUTHORIZATION; use log::info; use moka::future::Cache; @@ -46,14 +45,22 @@ pub async fn serve(port: u16, proxy_app: Arc) -> anyhow::Result<() // routes should be ordered most to least common .route("/", post(rpc_proxy_http::proxy_web3_rpc)) .route("/", get(rpc_proxy_ws::websocket_handler)) - .route_with_tsr( + .route( "/rpc/:rpc_key", post(rpc_proxy_http::proxy_web3_rpc_with_key), ) - .route_with_tsr( + .route( + "/rpc/:rpc_key/", + post(rpc_proxy_http::proxy_web3_rpc_with_key), + ) + .route( "/rpc/:rpc_key", get(rpc_proxy_ws::websocket_handler_with_key), ) + .route( + "/rpc/:rpc_key/", + get(rpc_proxy_ws::websocket_handler_with_key), + ) .route("/health", get(status::health)) .route("/user/login/:user_address", get(users::user_login_get)) .route( diff --git a/web3_proxy/src/frontend/status.rs b/web3_proxy/src/frontend/status.rs index 2e4a8198..714dab9e 100644 --- a/web3_proxy/src/frontend/status.rs +++ b/web3_proxy/src/frontend/status.rs @@ -7,6 +7,7 @@ use super::{FrontendResponseCache, FrontendResponseCaches}; use crate::app::Web3ProxyApp; use axum::{http::StatusCode, response::IntoResponse, Extension, Json}; use axum_macros::debug_handler; +use moka::future::ConcurrentCacheExt; use serde_json::json; use std::sync::Arc;