Skip to content

Fix rustls for out-of-the-box use#274

Merged
alawrenc merged 2 commits intomainfrom
andrew/fixing-rustls
Mar 13, 2026
Merged

Fix rustls for out-of-the-box use#274
alawrenc merged 2 commits intomainfrom
andrew/fixing-rustls

Conversation

@alawrenc
Copy link
Copy Markdown
Contributor

  1. Reset the default to use the system TLS for full backwards compatability.
  2. Enable a crate feature for Rustls that automatically registers a provider as well.
  3. Uses secp256k1::rand::rng(); to avoid dependency collisions.

kevin-ip
kevin-ip previously approved these changes Mar 13, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Rust SDK’s TLS setup to work out-of-the-box by defaulting to the platform-native TLS backend while optionally supporting rustls + aws-lc-rs, and reduces RNG dependency/version friction in secp256k1-related tests.

Changes:

  • Introduce mutually-exclusive TLS feature flags (tls-native-tls default, optional tls-rustls) and add a one-time TLS runtime initializer for rustls provider installation.
  • Update REST entrypoints to call ensure_tls_runtime() before making API requests.
  • Update secp256k1 test RNG usage to use secp256k1::rand::rng() and expand CI to cargo check both TLS configurations.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rust/src/tls_runtime.rs Adds process-wide TLS runtime initialization + feature gating for TLS backends.
rust/src/lib.rs Wires TLS runtime module + re-exports ensure_tls_runtime via prelude.
rust/src/env.rs Calls ensure_tls_runtime() before exchange info REST calls.
rust/src/authenticate.rs Calls ensure_tls_runtime() before auth REST calls; updates secp256k1 test RNG usage.
rust/src/create_order.rs Updates secp256k1 test RNG usage.
rust/src/withdraw.rs Updates secp256k1 test RNG usage.
rust/src/update_leverage.rs Updates secp256k1 test RNG usage.
rust/src/adjust_isolated_margin.rs Updates secp256k1 test RNG usage.
rust/src/account_authorization.rs Updates secp256k1 test RNG usage (authorize/deauthorize tests).
rust/Cargo.toml Adds TLS feature flags; makes reqwest default-features=false; adds optional rustls dep; updates dev rand version.
rust/README.md Documents TLS backend selection and how to enable rustls.
.github/workflows/typecheck.yaml Triggers on Rust changes; adds cargo check for default + rustls feature sets.
rust/Cargo.lock Updates lockfile for new reqwest/rustls/native-tls dependency graph.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread rust/src/tls_runtime.rs Outdated
Comment thread rust/README.md
@alawrenc alawrenc merged commit 38f12af into main Mar 13, 2026
7 checks passed
@alawrenc alawrenc deleted the andrew/fixing-rustls branch March 13, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants