bitcoindevkit / bitcoindevkit/rust-electrum-client

use-rustls-ring transitively enables rustls/default (aws-lc-rs), breaking ring-only builds

Open Beginner friendly
#219 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
89
Forks
82
Avg merge
2d 3h
Merged PRs (30d)
1

Description

In 0.25.0 the `rustls-ring` feature is defined as:

```toml
rustls-ring = [
"webpki-roots",
"dep:rustls",
"rustls/ring",
"rustls/logging",
"rustls/std",
"rustls/tls12",
]
```

The `"rustls/ring"` entries (without `?`) also activate the crate's explicit `rustls` feature:

```toml
rustls = [
"webpki-roots",
"dep:rustls",
"rustls/default",
]
```

which enables `rustls/default`, i.e. the aws-lc-rs provider. So a downstream crate asking for `use-rustls-ring` (expecting ring only) ends up with **both** `ring` and `aws-lc-rs` enabled on rustls. `cargo tree -e features` shows the chain:

```
electrum-client feature "rustls"
└── electrum-client feature "rustls-ring"
└── electrum-client feature "use-rustls-ring"
```

Consequences downstream: rustls can no longer auto-select a process-level CryptoProvider, so any other crate in the same binary that relies on the process default panics on first TLS use with:

```
Could not automatically determine the process-level CryptoProvider from Rustls crate features.
```

(electrum-client itself is unaffected since it selects its provider explicitly.) We hit this in a project after bumping electrum-client 0.21 -> 0.25: the shared rustls went from `ring` only to `ring + aws-lc-rs + default`, and an unrelated tokio-tungstenite connection in the same binary started panicking.

## Suggested fix

Use the `?` syntax so `rustls-ring` does not activate the `rustls` feature:

```toml
rustls-ring = [
"webpki-roots",
"dep:rustls",
"rustls?/ring",
"rustls?/logging",
"rustls?/std",
"rustls?/tls12",
]
```

(0.21 did not have this problem; the regression came with the feature reshuffle in later releases.)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Cargo feature definitions for rustls-ring and rustls shown in the issue, then run cargo tree -e features to confirm the current feature chain. Update the optional rustls feature references so use-rustls-ring does not enable rustls/default, and verify that ring-only builds no longer include aws-lc-rs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.