PQ-TLS for miner connections#572
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e691633. Configure here.
| .map_err(|e| format!("Failed to set protocol versions: {}", e))? | ||
| .with_no_client_auth() | ||
| .with_single_cert(cert_chain, key) | ||
| .map_err(|e| format!("Failed to create server config: {}", e))?; |
There was a problem hiding this comment.
ALPN protocol setting dropped during TLS refactor
High Severity
The old code set server_config.alpn_protocols = vec![b"quantus-miner".to_vec()] before creating the QUIC config, but the new rustls::ServerConfig is created and immediately consumed by QuicServerConfig::try_from() without setting ALPN. The QUIC specification (RFC 9001) requires ALPN, and the project documentation (MINING.md) explicitly specifies the ALPN identifier as quantus-miner. Miners connecting with ALPN set will fail the TLS handshake since the server advertises no application protocols.
Reviewed by Cursor Bugbot for commit e691633. Configure here.
|
I have a complete picture. Here is my review of PR #572. Review: PR #572 — PQ-TLS for miner connectionsA really cool direction — moving the miner control plane to ML‑DSA‑87 + X25519MLKEM768 is a great forward‑looking move and the rationale (harvest‑now‑decrypt‑later) is sound. That said, there are a few blockers and several rough edges that should be cleaned up before this goes in. Verdict: Request changesThe PR has one definite crash‑on‑startup‑style bug for any miner that respects the documented protocol, a failing CI check, and a chunk of dead code that needs cleanup. The cryptographic direction is right; the implementation needs another pass. Blockers1. ALPN identifier
|


Post-Quantum TLS for Miner Connections
This PR upgrades the QUIC/TLS stack for miner connections to use post-quantum cryptography.
Changes
Dependencies (
node/Cargo.toml):quinn: 0.10 → 0.11rustls: 0.21 → 0.23 withaws_lc_rsbackend (required for ML-DSA support)rcgen: 0.11 → 0.14 withaws_lc_rs_unstablefeaturerustls-post-quantumfor X25519MLKEM768 key exchangesha2for certificate fingerprint computationMiner Server (
node/src/miner_server.rs):--node-cert-fingerprintminer_tls_cert.der/miner_tls_key.deralongside node keyNote: Due to a limitation in rcgen 0.14 (cannot reload ML-DSA keys from DER), the certificate fingerprint changes on each node restart. This will be fixed upstream.
Security Model
--node-cert-fingerprint) prevents MITM attacks for remote minersExample
Node startup logs:
Miner connection:
Note
High Risk
Changes TLS/crypto for miner connectivity and bumps quinn/rustls/rcgen; certificate fingerprints are unstable across restarts until rcgen supports ML-DSA key reload, affecting remote pinning workflows.
Overview
This PR upgrades QUIC/TLS for external miner connections to post-quantum algorithms and refreshes the surrounding dependency stack.
The node moves to quinn 0.11, rustls 0.23 (aws-lc-rs), rcgen 0.14, and
rustls-post-quantum. The miner server now issues ML-DSA-87 certificates and negotiates X25519MLKEM768 via the PQ rustls provider, logs asha256:cert fingerprint for pinning, and optionally writes TLS material next to the node key (miner_tls_cert.der/miner_tls_key.der).MinerServer::starttakes an optionalnode_key_pathderived from the network config inservice.rs.MiningRequestrenamesdistance_thresholdtodifficulty(still a decimalU512string); job broadcast and API docs align with that name. A small QPoW runtime API comment is updated to say “mining difficulty” instead of distance-threshold wording.Operational caveat: rcgen cannot reload ML-DSA private keys from DER yet, so the logged fingerprint changes on each restart even when cert files exist—documented in logs and module comments.
Reviewed by Cursor Bugbot for commit b0a543c. Bugbot is set up for automated code reviews on this repo. Configure here.