Skip to content

Commit cb34319

Browse files
committed
all: Install rustls aws_lc_rs as default crypto provider
With alloy 2.0.0 pulling in rustls with aws_lc_rs and object_store (via reqwest) pulling in rustls with ring, rustls 0.23 refuses to auto-pick and panics on first TLS use. Install aws_lc_rs explicitly at each binary/test-harness entry point via a shared helper.
1 parent cb0c1b3 commit cb34319

10 files changed

Lines changed: 26 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ license = "MIT OR Apache-2.0"
3737
[workspace.dependencies]
3838
alloy = { version = "2.0.0", features = ["dyn-abi", "json-abi", "full", "arbitrary", "json-rpc", "serde"] }
3939
alloy-rpc-types = "2.0.0"
40+
# rustls is pulled in transitively by alloy (aws_lc_rs) and object_store via
41+
# reqwest (ring). With both providers linked, rustls 0.23 requires an explicit
42+
# default provider to be installed before any TLS use. We install aws_lc_rs
43+
# explicitly in each binary/test entry point.
44+
rustls = { version = "0.23", default-features = false, features = ["aws_lc_rs"] }
4045
anyhow = "1.0"
4146
async-graphql = { version = "7.2.1", features = ["chrono"] }
4247
async-graphql-axum = "7.2.1"

gnd/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ fn run_indexer(args: Vec<OsString>) -> Result<()> {
224224

225225
#[tokio::main]
226226
async fn main() -> Result<()> {
227+
graph::tls::install_default_crypto_provider();
227228
unsafe {
228229
std::env::set_var("ETHEREUM_REORG_THRESHOLD", "10");
229230
std::env::set_var("GRAPH_NODE_DISABLE_DEPLOYMENT_HASH_VALIDATION", "true");

graph/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ chrono = "0.4.44"
2727
envconfig = { workspace = true }
2828
Inflector = "0.11.3"
2929
reqwest = { version = "0.12.23", features = ["json", "stream", "multipart", "gzip", "brotli", "deflate"] }
30+
rustls = { workspace = true }
3031
hex = "0.4.3"
3132
http0 = { version = "0", package = "http" }
3233
http = "1"

graph/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ pub mod env;
3333

3434
pub mod ipfs;
3535

36+
pub mod tls;
37+
3638
pub mod abi;
3739

3840
pub mod amp;

graph/src/tls.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! Process-wide TLS crypto provider setup.
2+
//!
3+
//! Our deps pull in `rustls` with both `aws_lc_rs` (via alloy) and `ring`
4+
//! (via object_store/reqwest). With multiple providers linked, `rustls`
5+
//! 0.23 panics on first TLS use unless a default is installed explicitly.
6+
//! Must be called once per process before any TLS connection is built.
7+
8+
/// Install `aws_lc_rs` as the process-wide default `rustls` crypto provider.
9+
/// Idempotent: later calls are no-ops.
10+
pub fn install_default_crypto_provider() {
11+
let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();
12+
}

node/src/bin/manager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,7 @@ impl Context {
11331133

11341134
#[tokio::main]
11351135
async fn main() -> anyhow::Result<()> {
1136+
graph::tls::install_default_crypto_provider();
11361137
// Disable load management for graphman commands
11371138
unsafe {
11381139
env::set_var("GRAPH_LOAD_THRESHOLD", "0");

node/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ lazy_static! {
1515
}
1616

1717
fn main() {
18+
graph::tls::install_default_crypto_provider();
1819
tokio::runtime::Builder::new_multi_thread()
1920
.enable_all()
2021
.max_blocking_threads(*MAX_BLOCKING_THREADS)

store/test-store/src/store.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ pub fn all_shards() -> Vec<Shard> {
619619
}
620620

621621
fn build_store() -> (Arc<Store>, ConnectionPool, Config, Arc<SubscriptionManager>) {
622+
graph::tls::install_default_crypto_provider();
622623
let mut opt = Opt::default();
623624
let url = std::env::var_os("THEGRAPH_STORE_POSTGRES_DIESEL_URL").filter(|s| !s.is_empty());
624625
let file = std::env::var_os("GRAPH_NODE_TEST_CONFIG").filter(|s| !s.is_empty());

tests/src/fixture/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ fn test_logger(test_name: &str) -> Logger {
365365

366366
#[allow(clippy::await_holding_lock)]
367367
pub async fn stores(test_name: &str, store_config_path: &str) -> Stores {
368+
graph::tls::install_default_crypto_provider();
368369
let _mutex_guard = STORE_MUTEX.lock().unwrap();
369370

370371
let config = {

0 commit comments

Comments
 (0)