feat(crypto): add post-quantum signature support for nile - #38
feat(crypto): add post-quantum signature support for nile #38Federico2014 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
4 issues found across 72 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Summary
Adds post-quantum (PQ) signature support to TRON across protocol, crypto, transaction/block validation, TVM precompiles, witness configuration, consensus signing, relay handshakes, governance flags, and tests.
This PR currently supports two PQ schemes:
FN_DSA_512/ Falcon-512ML_DSA_44/ Dilithium-2Each scheme is independently gated by a committee proposal and dispatched through
PQSchemeRegistry.Protocol changes
PQSchemewithUNKNOWN_PQ_SCHEME,FN_DSA_512, andML_DSA_44.PQAuthSig { scheme, public_key, signature }as the common PQ authentication envelope.repeated pq_auth_sigtoTransactionso ECDSA signatures and PQ signatures can co-exist for account permission threshold checks.pq_auth_sigtoBlockHeader; block headers must use either legacywitness_signatureor PQpq_auth_sig.pq_auth_sigtoHelloMessagefor fast-forward / relay authentication by PQ witnesses.Address derivation
0x41 || deriveHash(scheme, public_key)[12..32].PQSchemeRegistry.computeAddress(scheme, publicKey)is the single address derivation entry point.Crypto module
FNDSA512for Falcon-512 signing and verification.MLDSA44for ML-DSA-44 signing and verification.PQSignature,PQSchemeRegistry, andPqKeypairas the shared PQ abstraction layer.PQSchemeRegistry.Governance and activation
ALLOW_FN_DSA_512proposal parameter.ALLOW_ML_DSA_44proposal parameter.VERSION_4_8_2.Witness and consensus support
localwitness_pq.keys.Transaction validation
TransactionCapsulevalidates mixed ECDSA + PQ signatures against the same account permission threshold.Permission.keys[].address.Block validation
TVM precompiles
0x16 verifyFnDsa512: single Falcon-512 verification.0x18 batchValidateFnDsa512: batch Falcon-512 verification with bitmap result.0x12 verifyMlDsa44Eip8051: EIP-8051VERIFY_MLDSAverification using[msg 32B | sig 2420B | expandedPk 20512B].0x19 verifyMlDsa44: existing TRON draft ML-DSA-44 verification using the standard 1312-byte public key.0x1a validateMultiPQSig: unified ECDSA + PQ account-permission threshold verification.0x1b batchValidateMlDsa44: batch ML-DSA-44 verification with bitmap result.Relay / fast-forward support
RelayServicecan sign and verifyHelloMessageusing either legacy signatures orPQAuthSig.Compatibility
UNKNOWN_PQ_SCHEMEis reserved and never treated as a valid signing scheme.Tests
PQSchemeRegistryandPQSignaturetests.Summary by cubic
Adds post-quantum signatures to Nile with FN-DSA-512 (Falcon-512) and ML-DSA-44, including new TX/block auth, VM precompiles, and governance-controlled activation at fork v4.8.2. ECDSA paths remain unchanged.
New Features
PQSchemeenum andPQAuthSigmessage; TXs and blocks can carry per-signer PQ auth bound toPermission.keys[].addressvia scheme-specific address derivation.localPqWitnessAccountAddressandlocalwitness_pq.keysconfig;LocalWitnessesand DPoS miner paths accept PQ keypairs.VMConfig.allowMlDsa44/allowFnDsa512.ALLOW_FN_DSA_512andALLOW_ML_DSA_44; activated only afterVERSION_4_8_2. Chain parameters exposegetAllowFnDsa512andgetAllowMlDsa44.PQAuthSigbytes; added TX fetch and handshake latency histograms.org.bouncycastle:bcprov-jdk18onto1.84.Migration
ALLOW_FN_DSA_512,ALLOW_ML_DSA_44).localPqWitnessAccountAddressand definelocalwitness_pq.keysentries withschemeand key or seed; restart the node.