From 4ccbcb8af4864ac0b72449f293d8d576dc9ae333 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 25 Oct 2022 03:41:59 +0000 Subject: [PATCH] update sea-orm and entities --- Cargo.lock | 244 +++--------------- entities/Cargo.toml | 2 +- entities/src/mod.rs | 2 +- entities/src/prelude.rs | 2 +- entities/src/revert_logs.rs | 4 +- entities/src/rpc_accounting.rs | 17 +- entities/src/sea_orm_active_enums.rs | 3 +- entities/src/secondary_user.rs | 4 +- entities/src/user.rs | 4 +- entities/src/user_keys.rs | 5 +- migration/Cargo.toml | 2 +- .../src/m20220101_000001_create_table.rs | 9 +- migration/src/m20220921_181610_log_reverts.rs | 8 +- web3_proxy/Cargo.toml | 3 +- web3_proxy/src/app_stats.rs | 16 +- web3_proxy/src/frontend/authorization.rs | 6 +- web3_proxy/src/rpcs/connections.rs | 2 +- web3_proxy/src/user_queries.rs | 28 +- 18 files changed, 93 insertions(+), 268 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa9c1428..a945996e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -155,57 +155,6 @@ dependencies = [ "synattra", ] -[[package]] -name = "async-attributes" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "async-channel" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "once_cell", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da5b41ee986eed3f524c380e6d64965aea573882a8907682ad100f7859305ca" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", - "tokio", -] - [[package]] name = "async-io" version = "1.7.0" @@ -234,33 +183,6 @@ dependencies = [ "event-listener", ] -[[package]] -name = "async-std" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" -dependencies = [ - "async-attributes", - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - [[package]] name = "async-stream" version = "0.3.3" @@ -282,12 +204,6 @@ dependencies = [ "syn", ] -[[package]] -name = "async-task" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" - [[package]] name = "async-trait" version = "0.1.57" @@ -328,12 +244,6 @@ dependencies = [ "autocfg 1.1.0", ] -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - [[package]] name = "atty" version = "0.2.14" @@ -653,20 +563,6 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "blocking" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" -dependencies = [ - "async-channel", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", -] - [[package]] name = "bs58" version = "0.4.0" @@ -1161,16 +1057,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "ctor" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "ctr" version = "0.8.0" @@ -1777,12 +1663,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - [[package]] name = "fastrand" version = "1.7.0" @@ -2137,18 +2017,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -[[package]] -name = "gloo-timers" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "group" version = "0.12.0" @@ -2615,15 +2483,6 @@ dependencies = [ "libc", ] -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - [[package]] name = "lalrpop" version = "0.19.8" @@ -2694,7 +2553,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", - "value-bag", ] [[package]] @@ -3431,40 +3289,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "postgres-protocol" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878c6cbf956e03af9aa8204b407b9cbf47c072164800aa918c516cd4b056c50c" -dependencies = [ - "base64 0.13.0", - "byteorder", - "bytes", - "fallible-iterator", - "hmac", - "md-5", - "memchr", - "rand 0.8.5", - "sha2 0.10.2", - "stringprep", -] - -[[package]] -name = "postgres-types" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d946ec7d256b04dfadc4e6a3292324e6f417124750fc5c0950f981b703a0f1" -dependencies = [ - "bytes", - "chrono", - "fallible-iterator", - "postgres-protocol", - "serde", - "serde_json", - "time 0.3.16", - "uuid 1.2.1", -] - [[package]] name = "ppv-lite86" version = "0.2.16" @@ -4086,9 +3910,9 @@ dependencies = [ [[package]] name = "sea-orm" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c7282fc3d7f79f6c5bd57e603319862fc778bf74118c0ce2a0dc82d9141dee" +checksum = "bcab4b30f6ba8dffa93ebd9ff60fe9f462b1c6729f66acf3f61600be86cfab2c" dependencies = [ "async-stream", "async-trait", @@ -4101,10 +3925,12 @@ dependencies = [ "rust_decimal", "sea-orm-macros", "sea-query", + "sea-query-binder", "sea-strum", "serde", "serde_json", "sqlx", + "thiserror", "time 0.3.16", "tracing", "url", @@ -4113,14 +3939,12 @@ dependencies = [ [[package]] name = "sea-orm-cli" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de07b4a0fc83b1b7ef8a2fe5d42c2662b1c60315446e6ebb4151a301c35fe484" +checksum = "874476cb7e9550e65acdc7deb1df7aeac4bf92ad35c259da0abb5580fab55450" dependencies = [ - "async-std", "chrono", "clap", - "dotenv", "regex", "sea-schema", "tracing", @@ -4130,9 +3954,9 @@ dependencies = [ [[package]] name = "sea-orm-macros" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f96b8a479d25d8110751a0511265556dd9139bc11e342357a98e60910fbb07e3" +checksum = "8ffc4df1f8caa12f156b57be5d3e32d21c81c8771b44a3a1171cf4f2b1d61355" dependencies = [ "bae", "heck 0.3.3", @@ -4143,13 +3967,13 @@ dependencies = [ [[package]] name = "sea-orm-migration" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f80e3ebbc654c1915686898de119d33a449a9512567009df0a3e95b1afe4e36c" +checksum = "90d368aa1fef75f0a5b1de62f1f51028d068620c95719b181bdbba0a1e3f3345" dependencies = [ "async-trait", "clap", - "dotenv", + "dotenvy", "sea-orm", "sea-orm-cli", "sea-schema", @@ -4159,20 +3983,33 @@ dependencies = [ [[package]] name = "sea-query" -version = "0.26.4" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e36a9680854b4e5d2ea5230f94e7ef81562260905b770fe20c3df9b3e7a536" +checksum = "3497a83851c4be4d1fdc8cbc7215105b828a2a944abb64dd2e0ba233f2ce187f" dependencies = [ "chrono", - "postgres-types", "rust_decimal", "sea-query-derive", - "sea-query-driver", "serde_json", "time 0.3.16", "uuid 1.2.1", ] +[[package]] +name = "sea-query-binder" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dddc5c3889bbc63b7e3374d3a7494551eb801c45f2f9cb460bfa4921653563d" +dependencies = [ + "chrono", + "rust_decimal", + "sea-query", + "serde_json", + "sqlx", + "time 0.3.16", + "uuid 1.2.1", +] + [[package]] name = "sea-query-derive" version = "0.2.0" @@ -4186,22 +4023,11 @@ dependencies = [ "thiserror", ] -[[package]] -name = "sea-query-driver" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d7f0cae2e7ebb2affc378c40bc343c8197181d601d6755c3e66f1bd18cac253" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sea-schema" -version = "0.9.4" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f737a6819fcad9727207d7090ccd6a33c0b384f3794e8838f952b52d599e3a17" +checksum = "9a1b18ed3f8bcadf93ca8b299d7204cd70b5272a52bd80550f2405112bc10db7" dependencies = [ "futures", "sea-query", @@ -5502,16 +5328,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "value-bag" -version = "1.0.0-alpha.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] - [[package]] name = "version_check" version = "0.9.4" diff --git a/entities/Cargo.toml b/entities/Cargo.toml index 7ad65872..14402b76 100644 --- a/entities/Cargo.toml +++ b/entities/Cargo.toml @@ -10,6 +10,6 @@ path = "src/mod.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sea-orm = "0.9.3" +sea-orm = "0.10.0" serde = "1.0.147" uuid = "1.2.1" diff --git a/entities/src/mod.rs b/entities/src/mod.rs index 2189a255..95b696f2 100644 --- a/entities/src/mod.rs +++ b/entities/src/mod.rs @@ -1,4 +1,4 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 pub mod prelude; diff --git a/entities/src/prelude.rs b/entities/src/prelude.rs index 081dd721..03a1bcc6 100644 --- a/entities/src/prelude.rs +++ b/entities/src/prelude.rs @@ -1,4 +1,4 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 pub use super::revert_logs::Entity as RevertLogs; pub use super::rpc_accounting::Entity as RpcAccounting; diff --git a/entities/src/revert_logs.rs b/entities/src/revert_logs.rs index f20bcfe5..5483dff4 100644 --- a/entities/src/revert_logs.rs +++ b/entities/src/revert_logs.rs @@ -1,10 +1,10 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 use super::sea_orm_active_enums::Method; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] #[sea_orm(table_name = "revert_logs")] pub struct Model { #[sea_orm(primary_key)] diff --git a/entities/src/rpc_accounting.rs b/entities/src/rpc_accounting.rs index 7afeee7e..2e239654 100644 --- a/entities/src/rpc_accounting.rs +++ b/entities/src/rpc_accounting.rs @@ -1,11 +1,10 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)] #[sea_orm(table_name = "rpc_accounting")] -/// TODO: make migrations match these items pub struct Model { #[sea_orm(primary_key)] pub id: u64, @@ -14,12 +13,14 @@ pub struct Model { pub method: String, pub error_response: bool, pub period_datetime: DateTimeUtc, - pub frontend_requests: u32, - pub backend_requests: u32, - pub backend_retries: u32, - pub no_servers: u32, - pub cache_misses: u32, - pub cache_hits: u32, + // TODO: migration to make these u32 + pub frontend_requests: u64, + pub backend_requests: u64, + pub backend_retries: u64, + pub no_servers: u64, + pub cache_misses: u64, + pub cache_hits: u64, + // TODO: end migration to make these u32 pub sum_request_bytes: u64, pub min_request_bytes: u64, pub mean_request_bytes: f64, diff --git a/entities/src/sea_orm_active_enums.rs b/entities/src/sea_orm_active_enums.rs index 7726cdb3..1dd920c1 100644 --- a/entities/src/sea_orm_active_enums.rs +++ b/entities/src/sea_orm_active_enums.rs @@ -1,6 +1,7 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 use sea_orm::entity::prelude::*; +use sea_orm::{sea_query, ActiveEnum, EnumIter, Iden}; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] diff --git a/entities/src/secondary_user.rs b/entities/src/secondary_user.rs index 88319e87..df409517 100644 --- a/entities/src/secondary_user.rs +++ b/entities/src/secondary_user.rs @@ -1,10 +1,10 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 use super::sea_orm_active_enums::Role; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] #[sea_orm(table_name = "secondary_user")] pub struct Model { #[sea_orm(primary_key)] diff --git a/entities/src/user.rs b/entities/src/user.rs index 506696cb..b468db4b 100644 --- a/entities/src/user.rs +++ b/entities/src/user.rs @@ -1,9 +1,9 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] #[sea_orm(table_name = "user")] pub struct Model { #[sea_orm(primary_key)] diff --git a/entities/src/user_keys.rs b/entities/src/user_keys.rs index b4765ae7..dfd57bf0 100644 --- a/entities/src/user_keys.rs +++ b/entities/src/user_keys.rs @@ -1,10 +1,9 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1 +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 use sea_orm::entity::prelude::*; -use sea_orm::prelude::Uuid; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] #[sea_orm(table_name = "user_keys")] pub struct Model { #[sea_orm(primary_key)] diff --git a/migration/Cargo.toml b/migration/Cargo.toml index 944f5447..185448aa 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -12,7 +12,7 @@ path = "src/lib.rs" tokio = { version = "1.21.2", features = ["full", "tracing"] } [dependencies.sea-orm-migration] -version = "0.9.3" +version = "0.10.0" features = [ # Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI. # View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime. diff --git a/migration/src/m20220101_000001_create_table.rs b/migration/src/m20220101_000001_create_table.rs index 364446a1..44e48bde 100644 --- a/migration/src/m20220101_000001_create_table.rs +++ b/migration/src/m20220101_000001_create_table.rs @@ -56,7 +56,14 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(SecondaryUser::Email).string()) .col( ColumnDef::new(SecondaryUser::Role) - .enumeration("role", ["owner", "admin", "collaborator"]) + .enumeration( + Alias::new("role"), + [ + Alias::new("owner"), + Alias::new("admin"), + Alias::new("collaborator"), + ], + ) .not_null(), ) .index(sea_query::Index::create().col(SecondaryUser::Address)) diff --git a/migration/src/m20220921_181610_log_reverts.rs b/migration/src/m20220921_181610_log_reverts.rs index 26282c85..80944cc9 100644 --- a/migration/src/m20220921_181610_log_reverts.rs +++ b/migration/src/m20220921_181610_log_reverts.rs @@ -55,8 +55,12 @@ impl MigrationTrait for Migration { .col( ColumnDef::new(RevertLogs::Method) .enumeration( - "method", - ["eth_call", "eth_estimateGas", "eth_sendRawTransaction"], + Alias::new("method"), + [ + Alias::new("eth_call"), + Alias::new("eth_estimateGas"), + Alias::new("eth_sendRawTransaction"), + ], ) .not_null(), ) diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index 0a5393c1..03771dd2 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -54,7 +54,7 @@ reqwest = { version = "0.11.12", default-features = false, features = ["json", " handlebars = "4.3.5" rustc-hash = "1.1.0" siwe = "0.5.0" -sea-orm = { version = "0.9.3", features = ["macros"] } +sea-orm = { version = "0.10.0", features = ["macros"] } sentry = { version = "0.27.0", default-features = false, features = ["backtrace", "contexts", "panic", "anyhow", "reqwest", "rustls"] } sentry-tracing = "0.27.0" serde = { version = "1.0.147", features = [] } @@ -76,4 +76,3 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter", "parking_lo ulid = { version = "1.0.0", features = ["serde"] } url = "2.3.1" uuid = "1.2.1" - diff --git a/web3_proxy/src/app_stats.rs b/web3_proxy/src/app_stats.rs index c1e700c5..54eb6b35 100644 --- a/web3_proxy/src/app_stats.rs +++ b/web3_proxy/src/app_stats.rs @@ -9,7 +9,7 @@ use moka::future::{Cache, CacheBuilder}; use sea_orm::{ActiveModelTrait, DatabaseConnection}; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::Arc; -use std::{sync::atomic::AtomicU32, time::Duration}; +use std::time::Duration; use tokio::sync::{broadcast, Mutex as AsyncMutex}; use tokio::task::JoinHandle; use tracing::{error, info, trace}; @@ -24,7 +24,7 @@ pub struct ProxyResponseStat { period_timestamp: u64, request_bytes: u64, /// if this is 0, there was a cache_hit - backend_requests: u32, + backend_requests: u64, error_response: bool, response_bytes: u64, response_millis: u64, @@ -61,12 +61,12 @@ pub struct ProxyResponseAggregate { // error_response: bool, // TODO: this is the grandparent key. get it from there somehow period_timestamp: u64, - frontend_requests: AtomicU32, - backend_requests: AtomicU32, - backend_retries: AtomicU32, - no_servers: AtomicU32, - cache_misses: AtomicU32, - cache_hits: AtomicU32, + frontend_requests: AtomicU64, + backend_requests: AtomicU64, + backend_retries: AtomicU64, + no_servers: AtomicU64, + cache_misses: AtomicU64, + cache_hits: AtomicU64, sum_request_bytes: AtomicU64, sum_response_bytes: AtomicU64, sum_response_millis: AtomicU64, diff --git a/web3_proxy/src/frontend/authorization.rs b/web3_proxy/src/frontend/authorization.rs index d175301c..baa7769f 100644 --- a/web3_proxy/src/frontend/authorization.rs +++ b/web3_proxy/src/frontend/authorization.rs @@ -15,7 +15,7 @@ use redis_rate_limiter::RedisRateLimitResult; use sea_orm::{prelude::Decimal, ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter}; use serde::Serialize; use std::fmt::Display; -use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64}; +use std::sync::atomic::{AtomicBool, AtomicU64}; use std::{net::IpAddr, str::FromStr, sync::Arc}; use tokio::sync::{OwnedSemaphorePermit, Semaphore}; use tokio::time::Instant; @@ -64,8 +64,8 @@ pub struct RequestMetadata { pub period_seconds: u64, pub request_bytes: u64, /// if this is 0, there was a cache_hit - pub backend_requests: AtomicU32, - pub no_servers: AtomicU32, + pub backend_requests: AtomicU64, + pub no_servers: AtomicU64, pub error_response: AtomicBool, pub response_bytes: AtomicU64, pub response_millis: AtomicU64, diff --git a/web3_proxy/src/rpcs/connections.rs b/web3_proxy/src/rpcs/connections.rs index a51e51c4..72667fab 100644 --- a/web3_proxy/src/rpcs/connections.rs +++ b/web3_proxy/src/rpcs/connections.rs @@ -671,7 +671,7 @@ impl Web3Connections { if let Some(request_metadata) = request_metadata { request_metadata .backend_requests - .fetch_add(active_request_handles.len() as u32, Ordering::Release); + .fetch_add(active_request_handles.len() as u64, Ordering::Release); } let quorum_response = self diff --git a/web3_proxy/src/user_queries.rs b/web3_proxy/src/user_queries.rs index ce8ec371..a4721e1b 100644 --- a/web3_proxy/src/user_queries.rs +++ b/web3_proxy/src/user_queries.rs @@ -111,22 +111,20 @@ fn get_query_start_from_params( ) } -fn get_page_from_params(params: &HashMap) -> anyhow::Result { - params - .get("page") - .map_or_else::, _, _>( - || { - // no page in params. set default - Ok(0) - }, - |x: &String| { - // parse the given timestamp - // TODO: error code 401 - let x = x.parse().context("parsing page query from params")?; +fn get_page_from_params(params: &HashMap) -> anyhow::Result { + params.get("page").map_or_else::, _, _>( + || { + // no page in params. set default + Ok(0) + }, + |x: &String| { + // parse the given timestamp + // TODO: error code 401 + let x = x.parse().context("parsing page query from params")?; - Ok(x) - }, - ) + Ok(x) + }, + ) } fn get_query_window_seconds_from_params(params: &HashMap) -> anyhow::Result {