Consensus, Embedded Contracts & P2P Hardening
TL;DR: Upgrading user
AccountBlocks is necessary but not sufficient. A complete post-quantum Zenon upgrade must also transition PillarMomentumseals (and futureMomentumVersionV3Narwhal/Tusk certificates), replace single-keysecp256k1TSS ECDSA inBridgeContractwith at-of-nGuardianML-DSA-44quorum, deprecate discrete-logPtlcContractpoint locks in favor ofSHA3-256HTLCs and PQ signature locks, sunsetPillar.RegisterLegacy, and upgradego-libp2pstream handshakes to hybridX25519 + ML-KEM-768.
1. Pillar Momentum Signing & Narwhal/Tusk BFT (MomentumVersionV3)
LegacyDposV1 (10-Second Single-Leader Momentums)
In internal/consensus/engine/legacy_dpos.go:274-306 and internal/vm/verifier/momentum.go:87-114:
- Every 10 seconds, the elected slot Pillar signs
m.Hash(32 B) using itsBlockProducingAddresskeypair. - Fortunately,
Pillar.UpdatePillar(internal/vm/contracts/pillar/pillar.go:82-88) ALREADY allows every Pillar operator to hot-swapproducerAddresson-chain without revoking their Pillar or touching their coldStakeAddress! - Upgrade Rule (
PostQuantumConsensusSpork):- Pillar operators generate a fresh
0x02ML-DSA-44(orFN-DSA-512) producing keypair on their validator node (znnd) and submitPillar.UpdatePillar(..., newPQProducerAddr, ...). Momentum.PublicKey(tag 10) carries[algID] || RawPublicKeyBytes(1,313 BforML-DSA-44or898 BforFN-DSA-512), andMomentum.Signature(tag 11) carries[algID] || RawSignatureBytes(2,421 Bor667 B).- After a grace window (e.g.,
30epochs = 30 days),VerifyMomentumStaticrejectsalgID == 0x00(Ed25519) onMomentumheaders—securing 100% of block production against Shor's algorithm.
- Pillar operators generate a fresh
Future MomentumVersionV3: Narwhal & Tusk DAG-BFT (internal/consensus/engine/seam.go)
go-zenon-v1 defines the consensus seam for Narwhal & Tusk (seam.go:189-236), where a Certificate attests 2f+1 stake-weighted Pillar signatures over a VertexHeader.
Classical Narwhal/HotStuff implementations use BLS12-381 aggregate signatures, which are completely broken by Shor's algorithm. Meanwhile, Ethereum's Lean Consensus needs heavy STARK-aggregated XMSS proofs only because Ethereum has ~1,000,000 validators per epoch.
Zenon elects NodeCount = 30 Pillars per tick (2f+1 = 21 signers) (internal/common/params.go:280)!
With NodeCount = 30, a simple concatenated multi-signature + 32-bit signer bitmask (storing Pillar producing public keys in ElectionData so certificates omit public keys) is tiny and verifies in under 1 ms across 8 cores:
BFT Certificate Scheme (21 of 30 Pillars) | Certificate Signature Size | Parallel Verify Latency (8 Cores) | Pairing / Lattice Assumptions |
|---|---|---|---|
FN-DSA-512 (algID = 0x02) | 4 B bitmap + 21 × 666 B = 13,990 B (~13.7 KiB) | ~0.10 ms | NTRU Lattice (FIPS 206) |
ML-DSA-44 (algID = 0x01) | 4 B bitmap + 21 × 2,420 B = 50,824 B (~49.6 KiB) | ~0.14 ms | Module-LWE (FIPS 204, Go 1.26 stdlib) |
Epoch-Bound XMSS-SHAKE_14_256 (2^14 sigs/day) | 4 B bitmap + 21 × 2,692 B = 56,536 B (~55.2 KiB) | ~1.10 ms | Pure SHAKE256 (Zero Lattice!) |
2. BridgeContract: From secp256k1 TSS to t-of-n PQ Guardian Quorum
In internal/vm/contracts/bridge/methods_bridge.go:215-249, 330-383:
UpdateWrapRequestandUnwrapTokencurrently verify a single 65-byte recoverablesecp256k1ECDSA signature (maxECDSASigBase64Len = 88) againstBridgeInfo.DecompressedTssECDSAPubKey.- While post-quantum threshold lattice MPC (
TRaccoon/ thresholdML-DSA) is an active NIST MPTC standardization area, multi-party lattice signing ceremonies carry complex abort/noise-flooding state and larger communication rounds than classical GG20/FROST. - Look at
internal/common/params.go:412-413: Zenon'sBridgeContractalready bounds Guardians toMinGuardians = 5 .. MaxGuardiansPostDP = 30!
Recommended Bridge Upgrade (Bridge.UnwrapTokenPQ / SetBridgePQGuardians)
- Register an ordered list of up to
N <= 30Orchestrator/GuardianML-DSA-44public keys ([0x09]storage prefix inBridgeContract) with thresholdT = floor(2*N/3) + 1(e.g.,11-of-15or21-of-30). - Inbound (
UnwrapTokenPQ— External Chain → Zenon): Guardians independently verify the external chain lock event and produce deterministicML-DSA-44signatures overUnwrapMessageHash(ctx = "zenon-bridge:v2"). A15-of-22quorum witness (4 B bitmap + 15 × 2,420 B = 36,304 B, or15 × 666 B = 9,994 BwithFN-DSA-512) fits inside a singleAccountBlock(raisingMaxDataLengthfrom16 KiBto64 KiBforBridgeContract, or preferringFN-DSA-512which fits inside the existing16,384-byteMaxDataLengthwith 6 KiB to spare!). - Outbound (
WrapToken— Zenon → External Chain): Outbound signature format is dictated by the destination chain's smart contract (e.g., ECDSA until Ethereum/BNB deployEIP-8051/EIP-8052precompiles, at which pointUpdateWrapRequestPQstores the PQ quorum signature).
3. PtlcContract, HtlcContract & Legacy SwapContract
PtlcContract (internal/vm/contracts/ptlc/ptlc.go:29-33)
Currently supports three pointTypes:
0:PointTypeEd25519(32 Block,64 Bsig)1:PointTypeBIP340(32 Bx-only lock,64 BSchnorr sig)2:PointTypeSecp256k1Point(33 Bcompressed point[k]G, unlocked by revealing scalark)
Post-Quantum Action:
- Cross-Chain Atomic Swaps → Use
HtlcContract:PointTypeSecp256k1Point([k]Gscalar adapter lock) relies directly on discrete-log hardness and has no drop-in compact stateless equivalent without lattice adaptor proofs (~40+ KB). By contrast,HtlcContract(internal/vm/contracts/htlc/htlc.go) uses 32-byteSHA3-256/SHA-256preimages, which already provide 128-bit post-quantum security against Grover's algorithm! - Signature-Locked Escrows → Add
PointType3&4: AddPointTypeMLDSA44 = 3(32 BSHA3-256(pk)lock commitment, witness =pk[1312] || sig[2420]) andPointTypeFNDSA512 = 4(32 BSHA3-256(pk)lock commitment, witness =pk[897] || sig[666]) toPtlcContract, keeping storage recordsptlcInfocompact (32 Block!) regardless of PQ public-key size. - Phase 3 Sunset: Reject
Create/CreateWithReclaimLockforpointType∈{0, 1, 2}onceLegacyCryptoSunsetSporkactivates.
SwapContract & Pillar.RegisterLegacy
SwapContract(internal/vm/contracts/swap/swap.go:205-228):DecayPercentage(epoch)already reached0%atepoch >= 389(~1 year after Alphanet Genesis). Even if a CRQC forges a legacy Bitcoin-stylesecp256k1signature inSwap.RetrieveAssets,znnOutandqsrOutevaluate to0!Pillar.RegisterLegacy(internal/vm/contracts/pillar/pillar.go:38, 73): Still checksPrefixLegacyPillarEntry([0x03] || keyIdHash) viasecp256k1signature recovery. SunsetSelectorRegisterLegacy(0xe4588207) in Phase 3 so unclaimed legacy.znnswap entries cannot be hijacked to mint discounted Pillar slots.
4. P2P Transport (go-libp2p & RLPx Retirement)
In internal/p2p/libp2p/server.go:26, 65-95 and internal/p2p/legacy/rlpx.go:
- Retire Legacy DevP2P
RLPx(secp256k1ECIES): Now thatLibp2pSporkis active on Alphanet, deprecate legacyenode://RLPxanddiscv4completely. - Upgrade Stream Security to Hybrid
X25519 + ML-KEM-768: Go 1.26's standard library includescrypto/mlkem(mlkem.GenerateKey768(),X25519MLKEM768incrypto/tls). Configurego-libp2pTLS 1.3 (libp2p-tlswith Go 1.26 defaultX25519MLKEM768curve preferences) or PQ-Noise (Noise_XX_25519_MLKEM768) so all/znn/eth/1and/znn/kad/1.0.0traffic is immediately immune to Harvest-Now-Decrypt-Later recording. - Post-Quantum Peer Identity (
peer.ID):NodeIDFromPeerID(server.go:75) currently enforcespub.Type() == lp2pcrypto.Secp256k1to map onto legacy 64-bytep2p.NodeID. Decouple internal peer tracking (peer.IDmultihash string) from 64-byte uncompressedsecp256k1coordinates, and register a multicodecML-DSA-44host identity key (network-pq-private-key,32-byteseed) so Sentinels and Pillar sentry nodes cannot be MITM-impersonated by a CRQC.