Litep2p clean#574
Conversation
Removed: - qp-wormhole-verifier, sp-keyring from runtime - codec from sp-consensus-qpow - qp-poseidon, sp-io from qp-dilithium-crypto - qp-poseidon from qp-wormhole - log from pallet-multisig, pallet-zk-tree - sp-weights from pallet-scheduler - sp-metadata-ir from pallet-wormhole - num-traits, sp-arithmetic from pallet-qpow - qp-poseidon from pallet-mining-rewards - qp-high-security from pallet-reversible-transfers - qp-poseidon, qp-rusty-crystals-dilithium from node - sc-service from sc-consensus-qpow Note: codec and scale-info are required by frame macros even if not directly imported - cargo-machete reports false positives for pallets.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 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 bc0f44a. Configure here.
|
v12 pls audit |
|
Warning GitHub user @n13 is not connected to an V12 account. Please sign in at the dashboard and connect your GitHub account. |
Security & correctness reviewFocused on the novel post-quantum code (Dilithium identity, pqXX/ML-KEM Noise, QUIC TLS) and the identity/key plumbing — not the bulk-vendored litep2p internals. Overall the Noise identity-binding design is sound (each side signs its static ML-KEM key, verified against the session's authenticated remote static before any transport socket is returned). One critical issue stands out, plus several lower-severity items. 🔴 CRITICAL —
|
|
Review complete and posted to the PR: #574 (comment) SummaryI reviewed the 186-file PR by fetching the branch into a throwaway worktree (your working tree was untouched) and focusing on the novel security-critical code — Dilithium identity, pqXX/ML-KEM Noise, QUIC TLS, and the key/identity plumbing — rather than the bulk-vendored litep2p internals. The headline finding is a critical key-generation flaw that the Bugbot pass missed:
Plus, with severity calibrated against actual reachability:
I confirmed the good parts too: the Noise handshake verifies the remote's Dilithium signature over its authenticated static ML-KEM key before returning a transport socket, secret files are written One note in line with your "don't comment on GitHub automatically" rule — I only posted because you explicitly asked. I did not push any code or open fix PRs; happy to do the one-line |
Addresses audit finding: 'Stored public key unchecked' Previously, Keypair stored both seed and public key bytes. When loading from file, a corrupted public key could cause the advertised PeerId to differ from the key actually used for signatures and Noise handshakes. Now Keypair stores only the 32-byte seed. The public key is derived deterministically on demand via derive_internal(). This eliminates the possibility of inconsistency between stored and derived public keys. For backwards compatibility, try_from_bytes() still accepts the old format (seed + public key) but ignores the public key bytes and regenerates from seed. to_bytes() now returns only the 32-byte seed, reducing stored key size from 2624 bytes to 32 bytes.

The litep2p code was first copied from the official source, then modified to add dilithium and kyber support, then elliptic curve support was removed.
The idea behind litep2p and our adoption of it is to reduce the attack surface in the networking stack.
The node connects to testnet and syncs without issues because the wire protocol is identical to the libp2p stack, but we should probably run a few more tests to be sure.
Note
High Risk
Replaces the entire Substrate networking stack and changes peer authentication/encryption (Dilithium, pqXX Noise, PQ TLS); interoperability and security regressions need thorough testnet and adversarial validation.
Overview
This PR replaces libp2p with a vendored
litep2pstack as the only P2P backend: workspace and lockfile droplibp2p/ patched identity-noise crates, add a newclient/litep2pcrate (patched via[patch.crates-io]), and wiresc-networkthroughLitep2pNetworkBackendwhile removing the old libp2p swarm/transport modules.Node identity and handshakes move to post-quantum crypto: Dilithium ML-DSA-87 for local keys and
PeerId, pqXX Noise with ML-KEM 768 (clatter), and QUIC/TLS viarustls-post-quantum/ aws-lc-rs with libp2p-style certificate extensions. CLI defaults andgenerate-node-key/inspect-node-keynow uselitep2ptypes;--network-backenddefaults to Litep2p (libp2p option removed).Smaller lockfile/pallet dependency trims are secondary to the networking swap.
Reviewed by Cursor Bugbot for commit bc0f44a. Bugbot is set up for automated code reviews on this repo. Configure here.