Skip to content

Commit 5a2f52d

Browse files
committed
fix(stm): stop forcing rustls in the future_snark feature
The TLS backend of the SRS download is now selected by the callers, which makes the native-tls feature usable.
1 parent bc9d8c1 commit 5a2f52d

13 files changed

Lines changed: 60 additions & 45 deletions

File tree

.github/workflows/test-rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
test-args: --features full,unstable --workspace
2020
cargo-profile: ci-tests
2121
- os: ubuntu-24.04
22-
test-args: --features future_snark -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-relay
22+
test-args: --features future_snark,rustls -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-relay
2323
artifact-suffix: -future-snark
2424
# Default to the fast profile; the `prepare` step upgrades to `slow-cargo-profile`
2525
# only when the slow SNARK tests are actually in scope for this run (so we don't pay

demo/protocol-demo/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ license = { workspace = true }
99
repository = { workspace = true }
1010

1111
[features]
12+
default = ["rustls"]
1213
# Enable experimental SNARK support in mithril-stm and mithril-common.
1314
future_snark = ["mithril-stm/future_snark", "mithril-common/future_snark"]
15+
# Enable the TLS features of mithril-stm.
16+
rustls = ["mithril-stm/rustls"]
1417

1518
[dependencies]
1619
clap = { workspace = true }

docs/runbook/update-circuit-keys/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ Reviewers:
2929
Commands to run the integrity tests:
3030

3131
```bash
32-
cargo test -p mithril-stm --features future_snark --release integrity_test_for_non_recursive_production_key -- --ignored
32+
cargo test -p mithril-stm --features future_snark,rustls --release integrity_test_for_non_recursive_production_key -- --ignored
3333
```
3434

3535
and
3636

3737
```bash
38-
cargo test -p mithril-stm --features future_snark --release integrity_test_for_recursive_production_key -- --ignored
38+
cargo test -p mithril-stm --features future_snark,rustls --release integrity_test_for_recursive_production_key -- --ignored
3939
```
4040

4141
Release manager:
@@ -52,13 +52,13 @@ The author needs to update the golden value of the verification keys in the gold
5252
To update the production circuit verification keys, one needs to run the following commands:
5353

5454
```bash
55-
cargo test -p mithril-stm --features future_snark --release write_non_recursive_circuit_verification_key_for_production_to_file -- --ignored
55+
cargo test -p mithril-stm --features future_snark,rustls --release write_non_recursive_circuit_verification_key_for_production_to_file -- --ignored
5656
```
5757

5858
and
5959

6060
```bash
61-
cargo test -p mithril-stm --features future_snark --release write_recursive_circuit_verification_key_for_production_to_file -- --ignored
61+
cargo test -p mithril-stm --features future_snark,rustls --release write_recursive_circuit_verification_key_for_production_to_file -- --ignored
6262
```
6363

6464
that will update the files holding the values of the production keys, `mithril-stm/src/circuits/halo2/non_recursive_circuit_verification_key_for_production.bin` and `mithril-stm/src/circuits/halo2_ivc/recursive_circuit_verification_key_for_production.bin`.

mithril-aggregator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository = { workspace = true }
1111

1212
[features]
1313
default = ["rustls"]
14-
rustls = ["reqwest/rustls"]
14+
rustls = ["mithril-common/rustls", "reqwest/rustls"]
1515

1616
future_snark = ["mithril-common/future_snark", "dep:ciborium"]
1717

mithril-client/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ unstable = []
3030

3131
# These features are for support of dependent crates only.
3232
# They do not change the operation of the main crate.
33-
native-tls = ["reqwest/native-tls"]
34-
native-tls-no-alpn = ["reqwest/native-tls-no-alpn"]
35-
native-tls-vendored = ["reqwest/native-tls-vendored"]
36-
native-tls-vendored-no-alpn = ["reqwest/native-tls-vendored-no-alpn"]
33+
native-tls = ["mithril-common/native-tls", "reqwest/native-tls"]
34+
native-tls-no-alpn = ["mithril-common/native-tls", "reqwest/native-tls-no-alpn"]
35+
native-tls-vendored = ["mithril-common/native-tls", "reqwest/native-tls-vendored"]
36+
native-tls-vendored-no-alpn = ["mithril-common/native-tls", "reqwest/native-tls-vendored-no-alpn"]
3737

38-
rustls = ["reqwest/rustls"]
39-
rustls-no-provider = ["reqwest/rustls-no-provider"]
38+
rustls = ["mithril-common/rustls", "reqwest/rustls"]
39+
rustls-no-provider = ["mithril-common/rustls", "reqwest/rustls-no-provider"]
4040

4141
# Support compressed traffic with `reqwest`
4242
enable-http-compression = ["reqwest/gzip", "reqwest/zstd", "reqwest/deflate", "reqwest/brotli"]

mithril-common/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ allow_skip_signer_certification = []
3232
# Enables the future SNARK implementation for the `mithril-stm` dependency
3333
future_snark = ["mithril-stm/future_snark"]
3434

35+
# Enables the TLS features for the `mithril-stm` dependency
36+
# Exactly one of these must be enabled together with `future_snark`
37+
native-tls = ["mithril-stm/native-tls"]
38+
rustls = ["mithril-stm/rustls"]
39+
3540
[dependencies]
3641
anyhow = { workspace = true }
3742
async-trait = { workspace = true }

mithril-relay/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repository = { workspace = true }
1313
default = ["rustls"]
1414
# For activating snark features
1515
future_snark = ["mithril-common/future_snark"]
16-
rustls = ["reqwest/rustls"]
16+
rustls = ["mithril-common/rustls", "reqwest/rustls"]
1717

1818
[dependencies]
1919
anyhow = { workspace = true }

mithril-signer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ignored = ["reqwest"]
1616
[features]
1717
default = ["rustls"]
1818
future_snark = ["mithril-common/future_snark"]
19-
rustls = ["reqwest/rustls"]
19+
rustls = ["mithril-common/rustls", "reqwest/rustls"]
2020

2121
[dependencies]
2222
anyhow = { workspace = true }

mithril-stm/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ future_snark = [
3131
"dep:sha2",
3232
"dep:rand_chacha",
3333
"dep:reqwest",
34-
# Temporarily activate rustls before it is activated in the caller
35-
"rustls",
3634
]
3735
# TLS backend for the SRS download client (used by `future_snark`).
3836
# Exactly one of these must be enabled together with `future_snark`.

mithril-stm/README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ cd mithril-stm
4343
cargo build --release
4444
```
4545

46+
## TLS backend
47+
48+
The `future_snark` feature downloads the SRS of the trusted setup over HTTPS and lets the caller pick the TLS backend. Enable exactly one of the `rustls` or `native-tls` features along with it:
49+
50+
```shell
51+
cargo build --release --features future_snark,rustls
52+
```
53+
4654
## Running the tests
4755

4856
For running rust tests, simply run (to run the tests faster, the use of `--release` flag is recommended):
@@ -247,15 +255,15 @@ Three metrics are measured per tier: VK/PK setup time, proof generation time, an
247255
Small and medium tiers use Criterion (10 samples, flat sampling — one iteration per sample):
248256

249257
```bash
250-
cargo bench -p mithril-stm --features future_snark,benchmark-internals --bench halo2_snark -- certificate/small
251-
cargo bench -p mithril-stm --features future_snark,benchmark-internals --bench halo2_snark -- certificate/medium
258+
cargo bench -p mithril-stm --features future_snark,rustls,benchmark-internals --bench halo2_snark -- certificate/small
259+
cargo bench -p mithril-stm --features future_snark,rustls,benchmark-internals --bench halo2_snark -- certificate/medium
252260
```
253261

254262
Large and production tiers run a single timed measurement (Criterion's 10-sample minimum is impractical at this scale):
255263

256264
```bash
257-
cargo bench -p mithril-stm --features future_snark,benchmark-internals --bench halo2_snark -- certificate/large
258-
cargo bench -p mithril-stm --features future_snark,benchmark-internals --bench halo2_snark -- certificate/production
265+
cargo bench -p mithril-stm --features future_snark,rustls,benchmark-internals --bench halo2_snark -- certificate/large
266+
cargo bench -p mithril-stm --features future_snark,rustls,benchmark-internals --bench halo2_snark -- certificate/production
259267
```
260268

261269
## CI Parameter Benchmarks
@@ -294,5 +302,5 @@ All tiers complete in under 15 minutes on any developer machine with at least 4
294302
### Running the benchmarks
295303

296304
```bash
297-
cargo bench -p mithril-stm --features future_snark,benchmark-internals --bench halo2_prover_modes
305+
cargo bench -p mithril-stm --features future_snark,rustls,benchmark-internals --bench halo2_prover_modes
298306
```

0 commit comments

Comments
 (0)