more openssl and no rmp

i like rustls, but we can't use it on everything and so our compile times are bad
This commit is contained in:
Bryan Stitt 2023-10-06 19:20:38 -07:00
parent 159fef9e8d
commit aeb30787dd
11 changed files with 151 additions and 201 deletions

232
Cargo.lock generated

@ -280,7 +280,7 @@ dependencies = [
"hmac",
"http-types",
"hyper",
"hyper-rustls",
"hyper-tls",
"serde",
"serde_json",
"serde_path_to_error",
@ -1059,15 +1059,6 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "counter"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d458e66999348f56fd3ffcfbb7f7951542075ca8359687c703de6500c1ddccd"
dependencies = [
"num-traits",
]
[[package]]
name = "cpufeatures"
version = "0.2.9"
@ -2037,6 +2028,21 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
dependencies = [
"foreign-types-shared",
]
[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.0"
@ -2611,22 +2617,6 @@ dependencies = [
"want",
]
[[package]]
name = "hyper-rustls"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97"
dependencies = [
"futures-util",
"http",
"hyper",
"log",
"rustls",
"rustls-native-certs",
"tokio",
"tokio-rustls",
]
[[package]]
name = "hyper-timeout"
version = "0.4.1"
@ -2639,6 +2629,19 @@ dependencies = [
"tokio-io-timeout",
]
[[package]]
name = "hyper-tls"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
"bytes",
"hyper",
"native-tls",
"tokio",
"tokio-native-tls",
]
[[package]]
name = "iana-time-zone"
version = "0.1.57"
@ -2976,9 +2979,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.148"
version = "0.2.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
[[package]]
name = "libm"
@ -3198,6 +3201,24 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
[[package]]
name = "native-tls"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
dependencies = [
"lazy_static",
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]]
name = "new_debug_unreachable"
version = "1.0.4"
@ -3416,6 +3437,32 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "openssl"
version = "0.10.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c"
dependencies = [
"bitflags 2.4.0",
"cfg-if",
"foreign-types",
"libc",
"once_cell",
"openssl-macros",
"openssl-sys",
]
[[package]]
name = "openssl-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
]
[[package]]
name = "openssl-probe"
version = "0.1.5"
@ -3879,7 +3926,6 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46480520d1b77c9a3482d39939fcf96831537a250ec62d4fd8fbdf8e0302e781"
dependencies = [
"csv",
"encode_unicode",
"is-terminal",
"lazy_static",
@ -4335,22 +4381,21 @@ dependencies = [
"http",
"http-body",
"hyper",
"hyper-rustls",
"hyper-tls",
"ipnet",
"js-sys",
"log",
"mime",
"native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
"rustls",
"rustls-pemfile",
"serde",
"serde_json",
"serde_urlencoded",
"system-configuration",
"tokio",
"tokio-rustls",
"tokio-native-tls",
"tokio-util",
"tower-service",
"url",
@ -4358,7 +4403,6 @@ dependencies = [
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
"webpki-roots 0.25.2",
"winreg",
]
@ -4446,28 +4490,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "rmp"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20"
dependencies = [
"byteorder",
"num-traits",
"paste",
]
[[package]]
name = "rmp-serde"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a"
dependencies = [
"byteorder",
"rmp",
"serde",
]
[[package]]
name = "rpds"
version = "0.13.0"
@ -4549,49 +4571,6 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "rustls"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8"
dependencies = [
"log",
"ring",
"rustls-webpki",
"sct",
]
[[package]]
name = "rustls-native-certs"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2"
dependencies = [
"base64 0.21.4",
]
[[package]]
name = "rustls-webpki"
version = "0.101.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "rustversion"
version = "1.0.14"
@ -4673,16 +4652,6 @@ dependencies = [
"sha2",
]
[[package]]
name = "sct"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "sea-bae"
version = "0.2.0"
@ -4922,8 +4891,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0097a48cd1999d983909f07cb03b15241c5af29e5e679379efac1c06296abecc"
dependencies = [
"httpdate",
"native-tls",
"reqwest",
"rustls",
"sentry-anyhow",
"sentry-backtrace",
"sentry-contexts",
@ -4933,7 +4902,6 @@ dependencies = [
"serde_json",
"tokio",
"ureq",
"webpki-roots 0.25.2",
]
[[package]]
@ -5262,7 +5230,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "siwe"
version = "0.5.2"
source = "git+https://github.com/llamanodes/siwe-rs?rev=013be5204ff1c85778ce21619f4b677a003db8a1#013be5204ff1c85778ce21619f4b677a003db8a1"
source = "git+https://github.com/llamanodes/siwe-rs?rev=266f494143a4ea627e1d4090d725a5ef77535f67#266f494143a4ea627e1d4090d725a5ef77535f67"
dependencies = [
"ethers",
"hex",
@ -5458,12 +5426,11 @@ dependencies = [
"indexmap 2.0.2",
"log",
"memchr",
"native-tls",
"once_cell",
"paste",
"percent-encoding",
"rust_decimal",
"rustls",
"rustls-pemfile",
"serde",
"serde_json",
"sha2",
@ -5476,7 +5443,6 @@ dependencies = [
"tracing",
"url",
"uuid 1.4.1",
"webpki-roots 0.24.0",
]
[[package]]
@ -6001,12 +5967,12 @@ dependencies = [
]
[[package]]
name = "tokio-rustls"
version = "0.24.1"
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
"rustls",
"native-tls",
"tokio",
]
@ -6030,11 +5996,10 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
dependencies = [
"futures-util",
"log",
"rustls",
"native-tls",
"tokio",
"tokio-rustls",
"tokio-native-tls",
"tungstenite",
"webpki-roots 0.25.2",
]
[[package]]
@ -6305,8 +6270,8 @@ dependencies = [
"http",
"httparse",
"log",
"native-tls",
"rand 0.8.5",
"rustls",
"sha1",
"thiserror",
"url",
@ -6425,11 +6390,9 @@ checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3"
dependencies = [
"base64 0.21.4",
"log",
"native-tls",
"once_cell",
"rustls",
"rustls-webpki",
"url",
"webpki-roots 0.25.2",
]
[[package]]
@ -6652,7 +6615,6 @@ dependencies = [
"bytes",
"chrono",
"console-subscriber",
"counter",
"deduped_broadcast",
"deferred-rate-limiter",
"derivative",
@ -6693,7 +6655,6 @@ dependencies = [
"redis-rate-limiter",
"regex",
"reqwest",
"rmp-serde",
"rust_decimal",
"sentry",
"sentry-tracing",
@ -6734,21 +6695,6 @@ dependencies = [
"web3_proxy",
]
[[package]]
name = "webpki-roots"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888"
dependencies = [
"rustls-webpki",
]
[[package]]
name = "webpki-roots"
version = "0.25.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
[[package]]
name = "whoami"
version = "1.4.1"

@ -81,7 +81,7 @@ RUN --mount=type=cache,target=/root/.cargo/git \
FROM rust as rust_with_env
# changing our features doesn't change any of the steps above
ENV WEB3_PROXY_FEATURES "rdkafka-src"
ENV WEB3_PROXY_FEATURES "rdkafka-src,stripe"
# copy the app
COPY . .

@ -11,13 +11,13 @@ path = "src/lib.rs"
[dependencies]
tokio = { version = "1.32.0", features = ["full", "tracing"] }
chrono = "0.4.31"
sea-orm = { version = "0.12.3", features = ["with-chrono"]}
sea-orm = "0.12.3"
[dependencies.sea-orm-migration]
version = "0.12.3"
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.
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
"sqlx-mysql", # `DATABASE_DRIVER` feature
"runtime-tokio-native-tls", # `ASYNC_RUNTIME` feature
"sqlx-mysql", # `DATABASE_DRIVER` feature
]

@ -10,6 +10,7 @@ default = []
mimalloc = ["dep:mimalloc"]
rdkafka-src = ["rdkafka/cmake-build", "rdkafka/libz", "rdkafka/ssl-vendored", "rdkafka/zstd-pkg-config"]
stripe = ["dep:async-stripe"]
tests-needing-docker = []
tokio-console = ["dep:tokio-console", "dep:console-subscriber"]
@ -22,12 +23,13 @@ migration = { path = "../migration" }
payment-contracts = { path = "../payment-contracts" }
redis-rate-limiter = { path = "../redis-rate-limiter" }
#ethers = { git = "https://github.com/llamanodes/ethers-rs/", rev = "eb68f5d60850008cd302762bd3a5a4bdcfecc713", default-features = false, features = ["rustls", "ws"] }
influxdb2 = { git = "https://github.com/llamanodes/influxdb2", default-features = false, features = ["rustls"], rev = "2d125128696a29d7e0b9abc052c928937e7c0579" }
#ethers = { git = "https://github.com/llamanodes/ethers-rs/", rev = "eb68f5d60850008cd302762bd3a5a4bdcfecc713", default-features = false, features = ["openssl", "ws"] }
influxdb2 = { git = "https://github.com/llamanodes/influxdb2", default-features = false, features = ["native-tls"], rev = "2d125128696a29d7e0b9abc052c928937e7c0579" }
influxdb2-structmap = { git = "https://github.com/llamanodes/influxdb2/", rev = "2d125128696a29d7e0b9abc052c928937e7c0579"}
# TODO: we can't actually use 0.6 because they want a Provider and we have an Arc<Provider>
siwe = { git = "https://github.com/llamanodes/siwe-rs", rev = "013be5204ff1c85778ce21619f4b677a003db8a1", features = ["ethers", "serde"] }
# TODO: this has features ethers which probably brings in things. make sure it has the minimal features
siwe = { git = "https://github.com/llamanodes/siwe-rs", rev = "266f494143a4ea627e1d4090d725a5ef77535f67", features = ["ethers", "serde"] }
# TODO: regex has several "perf" features that we might want to use
# TODO: make sure this uuid version matches sea-orm. PR to put this in their prelude
@ -38,22 +40,25 @@ siwe = { git = "https://github.com/llamanodes/siwe-rs", rev = "013be5204ff1c8577
anyhow = { version = "1.0.75", features = ["backtrace"] }
arc-swap = { version = "1.6.0" }
argh = "0.1.12"
async-stripe = { version = "0.25.2", default-features = false, features = ["billing", "checkout", "connect", "runtime-tokio-hyper-rustls", "webhook-events"] }
async-recursion = "1.0.5"
async-stream = "0.3.5"
async-stripe = { version = "0.25.2", default-features = false, features = ["billing", "checkout", "connect", "runtime-tokio-hyper", "webhook-events"], optional = true }
async-trait = "0.1.73"
axum = { version = "0.6.20", features = ["headers", "tracing", "ws"] }
axum-client-ip = "0.4.2"
axum-macros = "0.3.8"
base64 = "0.21.4"
bytes = "1.5.0"
chrono = { version = "0.4.31" }
console-subscriber = { version = "0.2.0", features = ["env-filter", "parking_lot"], optional = true }
counter = "0.5.7"
derivative = "2.2.0"
derive_more = { version = "0.99.17", features = ["nightly"] }
ethbloom = { version = "0.13.0" }
ethers = { version = "2.0.10", default-features = false, features = ["rustls", "ws"] }
ethers = { version = "2.0.10", default-features = false, features = ["openssl", "ws"] }
fdlimit = "0.2.1"
fstrings = "0.2"
futures = { version = "0.3.28" }
futures-util = "0.3.28"
glob = "0.3.1"
handlebars = "4.4.0"
hashbrown = { version = "0.14.1", features = ["serde", "nightly"] }
@ -63,22 +68,21 @@ http = "0.2.9"
hyper = { version = "0.14.27", features = ["full", "nightly"] }
ipnet = { version = "2.8.0" }
itertools = "0.11.0"
listenfd = "1.0.1"
mimalloc = { version = "0.1.39", optional = true}
listenfd = { version = "1.0.1", optional = true }
mimalloc = { version = "0.1.39", optional = true }
moka = { version = "0.12.1", default-features = false, features = ["atomic64", "future", "quanta"] }
nanorand = { version = "0.7.0", default-features = false, features = ["std", "tls", "wyrand"] }
num = { version = "0.4.1" }
num-traits = "0.2.16"
once_cell = { version = "1.18.0" }
ordered-float = {version = "4.1.0" }
pagerduty-rs = { version = "0.1.6", default-features = false, features = ["async", "rustls", "sync"] }
pagerduty-rs = { version = "0.1.6", default-features = false, features = ["async", "sync"] }
parking_lot = { version = "0.12.1", features = ["arc_lock", "nightly"] }
rdkafka = { version = "0.34.0", features = ["tracing"] }
regex = "1.9.6"
reqwest = { version = "0.11.22", default-features = false, features = ["json", "tokio-rustls"] }
rmp-serde = "1.1.2"
reqwest = { version = "0.11.22", default-features = false, features = ["json", "default-tls"] }
rust_decimal = { version = "1.32.0" }
sentry = { version = "0.31.7", default-features = false, features = ["anyhow", "backtrace", "contexts", "panic", "reqwest", "rustls", "serde_json", "tracing"] }
sentry = { version = "0.31.7", default-features = false, features = ["anyhow", "backtrace", "contexts", "panic", "reqwest", "native-tls", "serde_json", "tracing"] }
sentry-tracing = "0.31.7"
serde = { version = "1.0.188" }
serde-inline-default = "0.1.1"
@ -97,19 +101,14 @@ ulid = { version = "1.1.0", features = ["rand", "uuid", "serde"] }
url = { version = "2.4.1" }
uuid = { version = "1.4.1", default-features = false, features = ["fast-rng", "v4", "zerocopy"] }
# TODO: why doesn't this work in dev-dependencies
# TODO: why doesn't this work in dev-dependencies. i think because of how we split web3_proxy and web3_proxy_cli. im not sure that is even helping anymore
test-log = { version = "0.2.12", default-features = false, features = ["trace"] }
bytes = "1.5.0"
futures-util = "0.3.28"
async-recursion = "1.0.5"
async-stream = "0.3.5"
# # TODO: bring this back
# check-if-email-exists = "0.9.0"
[dev-dependencies]
env_logger = "0.10"
test-log = "0.2.12"
tokio = { version = "1.32.0", features = ["full", "test-util"] }
env_logger = { version ="0.10", default-features = true, features = ["auto-color"] }
tokio = { version = "1.32.0", default-features = false, features = ["full", "test-util"] }
tracing = {version = "0.1", default-features = false}
tracing-subscriber = {version = "0.3", default-features = false, features = ["env-filter", "fmt"]}

@ -98,9 +98,6 @@ pub enum Web3ProxyError {
#[display(fmt = "{:?}", _0)]
#[error(ignore)]
JsonRpcErrorData(JsonRpcErrorData),
#[display(fmt = "{:?}", _0)]
#[error(ignore)]
MsgPackEncode(rmp_serde::encode::Error),
NoBlockNumberOrHash,
NoBlocksKnown,
NoConsensusHeadBlock,
@ -159,6 +156,7 @@ pub enum Web3ProxyError {
/// simple way to return an error message to the user and an anyhow to our logs
#[display(fmt = "{}, {}, {:?}", _0, _1, _2)]
StatusCode(StatusCode, Cow<'static, str>, Option<serde_json::Value>),
#[cfg(feature = "stripe")]
StripeWebhookError(stripe::WebhookError),
/// TODO: what should be attached to the timout?
#[display(fmt = "{:?}", _0)]
@ -658,17 +656,6 @@ impl Web3ProxyError {
},
)
}
Self::MsgPackEncode(err) => {
warn!(?err, "MsgPackEncode");
(
StatusCode::INTERNAL_SERVER_ERROR,
JsonRpcErrorData {
message: "msgpack encode error".into(),
code: StatusCode::INTERNAL_SERVER_ERROR.as_u16().into(),
data: Some(serde_json::Value::String(err.to_string())),
},
)
}
Self::NoBlockNumberOrHash => {
warn!("NoBlockNumberOrHash");
(
@ -1009,6 +996,7 @@ impl Web3ProxyError {
},
)
}
#[cfg(feature = "stripe")]
Self::StripeWebhookError(err) => {
trace!(?err, "StripeWebhookError");
(

@ -18,7 +18,7 @@ use axum::{
};
use http::{header::AUTHORIZATION, Request, StatusCode};
use hyper::Body;
use listenfd::ListenFd;
use moka::future::{Cache, CacheBuilder};
use std::sync::Arc;
use std::{iter::once, time::Duration};
@ -30,6 +30,9 @@ use tower_http::{cors::CorsLayer, normalize_path::NormalizePathLayer, trace::Tra
use tracing::{error_span, info, trace_span};
use ulid::Ulid;
#[cfg(feature = "listenfd")]
use listenfd::ListenFd;
/// simple keys for caching responses
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, EnumCount, EnumIter)]
pub enum ResponseCacheKey {
@ -59,7 +62,7 @@ pub async fn serve(
// TODO: read config for if fastest/versus should be available publicly. default off
// build our axum Router
let router = Router::new()
let mut router = Router::new()
// TODO: i think these routes could be done a lot better
//
// HTTP RPC (POST)
@ -179,10 +182,6 @@ pub async fn serve(
"/user/deposits/admin",
get(users::payment::user_admin_deposits_get),
)
.route(
"/user/balance/stripe",
post(users::payment_stripe::user_balance_stripe_post),
)
.route(
"/user/balance/:tx_hash",
post(users::payment::user_balance_post),
@ -247,7 +246,17 @@ pub async fn serve(
.route(
"/admin/imitate_login",
post(admin::admin_imitate_login_post),
)
);
#[cfg(feature = "stripe")]
{
router = router.route(
"/user/balance/stripe",
post(users::payment_stripe::user_balance_stripe_post),
);
}
router = router
//
// Axum layers
// layers are ordered bottom up
@ -301,6 +310,7 @@ pub async fn serve(
// TODO: https://docs.rs/tower-http/latest/tower_http/propagate_header/index.html
#[cfg(feature = "listenfd")]
let server_builder = if let Some(listener) = ListenFd::from_env().take_tcp_listener(0)? {
// use systemd socket magic for no downtime deploys
let addr = listener.local_addr()?;
@ -314,6 +324,12 @@ pub async fn serve(
axum::Server::try_bind(&addr)?
};
#[cfg(not(feature = "listenfd"))]
let server_builder = {
let addr = SocketAddr::from(([0, 0, 0, 0], app.frontend_port.load(Ordering::Relaxed)));
axum::Server::try_bind(&addr)?
};
// into_make_service is enough if we always run behind a proxy
/*

@ -1,12 +1,14 @@
//! Handle registration, logins, and managing account data.
pub mod authentication;
pub mod payment;
pub mod payment_stripe;
pub mod referral;
pub mod rpc_keys;
pub mod stats;
pub mod subuser;
#[cfg(feature = "stripe")]
pub mod payment_stripe;
use crate::app::Web3ProxyApp;
use crate::errors::{Web3ProxyError, Web3ProxyErrorContext, Web3ProxyResponse};
use crate::globals::global_db_transaction;

@ -50,7 +50,7 @@ impl KafkaDebugLogger {
.unwrap_or_default();
let kafka_key =
rmp_serde::to_vec(&rpc_secret_key_id).expect("ids should always serialize with rmp");
serde_json::to_vec(&rpc_secret_key_id).expect("ids should always serialize with rmp");
let chain_id = app.config.chain_id;
@ -134,7 +134,7 @@ impl KafkaDebugLogger {
pub fn log_debug_request(&self, request: &RequestOrMethod) -> JoinHandle<KafkaLogResult> {
// TODO: is rust message pack a good choice? try rkyv instead
let payload =
rmp_serde::to_vec(&request).expect("requests should always serialize with rmp");
serde_json::to_vec(&request).expect("requests should always serialize with rmp");
self.num_requests.fetch_add(1, atomic::Ordering::Relaxed);
@ -146,7 +146,7 @@ impl KafkaDebugLogger {
R: serde::Serialize,
{
let payload =
rmp_serde::to_vec(&response).expect("requests should always serialize with rmp");
serde_json::to_vec(&response).expect("requests should always serialize with rmp");
self.num_responses.fetch_add(1, atomic::Ordering::Relaxed);

@ -19,7 +19,6 @@ pub use pagerduty_rs;
pub use parking_lot;
pub use rdkafka;
pub use reqwest;
pub use rmp_serde;
pub use rust_decimal;
pub use sentry;
pub use sentry_tracing;

@ -11,6 +11,7 @@ default = []
deadlock_detection = ["parking_lot/deadlock_detection"]
mimalloc = ["web3_proxy/mimalloc"]
stripe = ["web3_proxy/stripe"]
rdkafka-src = ["web3_proxy/rdkafka-src"]
tests-needing-docker = ["web3_proxy/tests-needing-docker"]
tokio-console = ["web3_proxy/tokio-console"]
@ -19,15 +20,15 @@ tokio-console = ["web3_proxy/tokio-console"]
web3_proxy = { path = "../web3_proxy" }
parking_lot = { version = "0.12.1", features = ["arc_lock", "nightly"] }
prettytable = "0.10.0"
prettytable = { version = "0.10.0", default-features = false }
serde = { version = "1.0.188" }
serde_json = { version = "1.0.107", default-features = false, features = ["raw_value"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
[dev-dependencies]
env_logger = "0.10"
test-log = "0.2.12"
tokio = { version = "1.32.0", features = ["full", "test-util"] }
tracing = {version = "0.1", default-features = false}
tracing-subscriber = {version = "0.3", default-features = false, features = ["env-filter", "fmt"]}
env_logger = { version ="0.10", default-features = false, features = ["auto-color"] }
test-log = { version ="0.2.12", default-features = false, features = ["trace"] }
tokio = { version = "1.32.0", default-features = false, features = ["full", "test-util"] }
tracing = {version = "0.1", default-features = false }
tracing-subscriber = {version = "0.3", default-features = false, features = ["env-filter", "fmt"] }

@ -9,7 +9,6 @@ use web3_proxy::prelude::rdkafka::{
consumer::{Consumer, StreamConsumer},
ClientConfig, Message,
};
use web3_proxy::prelude::rmp_serde;
use web3_proxy::prelude::uuid::Uuid;
use web3_proxy::secrets::RpcSecretKey;
use web3_proxy::{config::TopConfig, relational_db::connect_db};
@ -50,7 +49,7 @@ impl SearchKafkaSubCommand {
rpc_key_id = Some(x.id);
}
let wanted_kafka_key = rpc_key_id.map(|x| rmp_serde::to_vec(&x).unwrap());
let wanted_kafka_key = rpc_key_id.map(|x| serde_json::to_vec(&x).unwrap());
let wanted_kafka_key = wanted_kafka_key.as_ref().map(|x| &x[..]);