Repository navigation
feat: Add ml-dsa 65 key type - #5875
Conversation
Greptile SummaryThis PR adds ML-DSA-65 (NIST FIPS 204, a post-quantum lattice-based signature scheme) as a new validator key type in CometBFT, using the
Confidence Score: 5/5The core cryptographic wiring is correct — circl's Verify and SignTo are called with consistent (nil) context, the LRU public-key cache is correctly keyed and sized, proto field numbering is stable, and the block-size math checks out against the updated test fixtures. The implementation is well-structured and the key invariants hold: deterministic signing, cache-assisted verification, correct varint overhead for ML-DSA-65 signatures, and consistent proto/JSON registration. No new correctness or security defects were found beyond the performance and API-shape concerns already raised in earlier review threads. crypto/mldsa65/key.go warrants a second look for the private-key deserialization cost on every Sign and PubKey call; types/block.go for the const→var change to MaxCommitSigBytes — both tracked in earlier review threads. Important Files Changed
|
|
The latest Buf updates on your PR. Results from workflow Protobuf Lint / lint (pull_request).
|
|
@greptile review |
There was a problem hiding this comment.
Did an initial pass and targeted validations:
go test ./crypto/mldsa65 ./crypto/encoding ./types ./test/e2e/pkg -run 'TestMlDsa65Network|TestSignAndVerify|TestDeterministicFromSeed|TestRoundTripBytes|TestAddressIs20Bytes|TestCachingVerifierHitsCache|TestBlockMaxDataBytes|TestBlockMaxDataBytesNoEvidence' -count=1
These checks pass locally.
Thank you for the review Alex-Bot. |
|
ran a local benchmark comparing `Sign()` vs ed25519: ``` ~37x slower because `Sign()` calls `sk.UnmarshalBinary(privKey)` on every call (re-parses the 4032-byte key). `VerifySignature` already has an LRU cache to avoid this — `Sign()` doesn't. benchmark used: ```go func BenchmarkEd25519Sign(b *testing.B) { not a blocker for now, but worth revisiting if this lands on a consensus hot path in production. |
--- Adds ML-DSA-65 key type as an option for validators looking for post-quantum secure signing algorithms. * Uses the `circl` library for all of the crypto. * Minimally integrates into the places it needs to in comet as an option for validator keys. * Adds e2e tests for networks fully based on the new key type #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `CHANGELOG.md` - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Adds ML-DSA-65 key type as an option for validators looking for post-quantum secure signing algorithms.
circllibrary for all of the crypto.PR checklist
CHANGELOG.mddocs/orspec/) and code comments