From 27ba7adea26e8303afe0a67bac75af8661154888 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 10 Oct 2023 23:04:42 -0700 Subject: [PATCH] rustls is faster --- Cargo.lock | 194 +++++++++++++++++++++++------------------- migration/Cargo.toml | 4 +- web3_proxy/Cargo.toml | 14 +-- 3 files changed, 116 insertions(+), 96 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 11b780d4..99d5d132 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,7 @@ dependencies = [ "hmac", "http-types", "hyper", - "hyper-tls", + "hyper-rustls", "serde", "serde_json", "serde_path_to_error", @@ -2017,21 +2017,6 @@ 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" @@ -2606,6 +2591,22 @@ 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" @@ -2618,19 +2619,6 @@ 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" @@ -3181,24 +3169,6 @@ 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" @@ -3417,32 +3387,6 @@ 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" @@ -4367,21 +4311,22 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-tls", + "hyper-rustls", "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-native-tls", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -4389,6 +4334,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", + "webpki-roots 0.25.2", "winreg", ] @@ -4557,6 +4503,49 @@ 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" @@ -4638,6 +4627,16 @@ 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" @@ -4877,8 +4876,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", @@ -4888,6 +4887,7 @@ dependencies = [ "serde_json", "tokio", "ureq", + "webpki-roots 0.25.2", ] [[package]] @@ -5412,11 +5412,12 @@ dependencies = [ "indexmap 2.0.2", "log", "memchr", - "native-tls", "once_cell", "paste", "percent-encoding", "rust_decimal", + "rustls", + "rustls-pemfile", "serde", "serde_json", "sha2", @@ -5429,6 +5430,7 @@ dependencies = [ "tracing", "url", "uuid 1.4.1", + "webpki-roots 0.24.0", ] [[package]] @@ -5953,12 +5955,12 @@ dependencies = [ ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "tokio-rustls" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "native-tls", + "rustls", "tokio", ] @@ -5982,10 +5984,11 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "native-tls", + "rustls", "tokio", - "tokio-native-tls", + "tokio-rustls", "tungstenite", + "webpki-roots 0.25.2", ] [[package]] @@ -6256,8 +6259,8 @@ dependencies = [ "http", "httparse", "log", - "native-tls", "rand 0.8.5", + "rustls", "sha1", "thiserror", "url", @@ -6376,9 +6379,11 @@ checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" dependencies = [ "base64 0.21.4", "log", - "native-tls", "once_cell", + "rustls", + "rustls-webpki", "url", + "webpki-roots 0.25.2", ] [[package]] @@ -6585,7 +6590,7 @@ dependencies = [ [[package]] name = "web3_proxy" -version = "1.43.32" +version = "1.43.27" dependencies = [ "anyhow", "arc-swap", @@ -6681,6 +6686,21 @@ 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" diff --git a/migration/Cargo.toml b/migration/Cargo.toml index 2802adbd..ab83fc43 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -18,6 +18,6 @@ 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-native-tls", # `ASYNC_RUNTIME` feature - "sqlx-mysql", # `DATABASE_DRIVER` feature + "runtime-tokio-rustls", # `ASYNC_RUNTIME` feature + "sqlx-mysql", # `DATABASE_DRIVER` feature ] diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index e4bf5beb..254d3218 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web3_proxy" -version = "1.43.32" +version = "1.43.27" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -24,7 +24,7 @@ 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 = ["openssl", "ws"] } -influxdb2 = { git = "https://github.com/llamanodes/influxdb2", default-features = false, features = ["native-tls"], rev = "2d125128696a29d7e0b9abc052c928937e7c0579" } +influxdb2 = { git = "https://github.com/llamanodes/influxdb2", default-features = false, features = ["rustls"], 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 @@ -42,7 +42,7 @@ arc-swap = { version = "1.6.0" } argh = "0.1.12" 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-stripe = { version = "0.25.2", default-features = false, features = ["billing", "checkout", "connect", "runtime-tokio-hyper-rustls", "webhook-events"], optional = true } async-trait = "0.1.73" axum = { version = "0.6.20", features = ["headers", "tracing", "ws"] } axum-client-ip = "0.4.2" @@ -54,7 +54,7 @@ console-subscriber = { version = "0.2.0", features = ["env-filter", "parking_lot 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 = ["openssl", "ws"] } +ethers = { version = "2.0.10", default-features = false, features = ["rustls", "ws"] } fdlimit = "0.2.1" fstrings = "0.2" futures = { version = "0.3.28" } @@ -76,13 +76,13 @@ num = { version = "0.4.1" } num-traits = "0.2.17" once_cell = { version = "1.18.0" } ordered-float = {version = "4.1.1" } -pagerduty-rs = { version = "0.1.6", default-features = false, features = ["async", "sync"] } +pagerduty-rs = { version = "0.1.6", default-features = false, features = ["async", "rustls", "sync"] } parking_lot = { version = "0.12.1", features = ["arc_lock", "nightly"] } rdkafka = { version = "0.34.0", features = ["tracing"] } regex = "1.10.0" -reqwest = { version = "0.11.22", default-features = false, features = ["json", "default-tls"] } +reqwest = { version = "0.11.22", default-features = false, features = ["json", "rustls"] } rust_decimal = { version = "1.32.0" } -sentry = { version = "0.31.7", default-features = false, features = ["anyhow", "backtrace", "contexts", "panic", "reqwest", "native-tls", "serde_json", "tracing"] } +sentry = { version = "0.31.7", default-features = false, features = ["anyhow", "backtrace", "contexts", "panic", "reqwest", "rustls", "serde_json", "tracing"] } sentry-tracing = "0.31.7" serde = { version = "1.0.188" } serde-inline-default = "0.1.1"