Skip to main content

Consensus, Embedded Contracts & P2P Hardening

TL;DR: Upgrading user AccountBlocks is necessary but not sufficient. A complete post-quantum Zenon upgrade must also transition Pillar Momentum seals (and future MomentumVersionV3 Narwhal/Tusk certificates), replace single-key secp256k1 TSS ECDSA in BridgeContract with a t-of-n Guardian ML-DSA-44 quorum, deprecate discrete-log PtlcContract point locks in favor of SHA3-256 HTLCs and PQ signature locks, sunset Pillar.RegisterLegacy, and upgrade go-libp2p stream handshakes to hybrid X25519 + 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 its BlockProducingAddress keypair.
  • Fortunately, Pillar.UpdatePillar (internal/vm/contracts/pillar/pillar.go:82-88) ALREADY allows every Pillar operator to hot-swap producerAddress on-chain without revoking their Pillar or touching their cold StakeAddress!
  • Upgrade Rule (PostQuantumConsensusSpork):
    1. Pillar operators generate a fresh 0x02 ML-DSA-44 (or FN-DSA-512) producing keypair on their validator node (znnd) and submit Pillar.UpdatePillar(..., newPQProducerAddr, ...).
    2. Momentum.PublicKey (tag 10) carries [algID] || RawPublicKeyBytes (1,313 B for ML-DSA-44 or 898 B for FN-DSA-512), and Momentum.Signature (tag 11) carries [algID] || RawSignatureBytes (2,421 B or 667 B).
    3. After a grace window (e.g., 30 epochs = 30 days), VerifyMomentumStatic rejects algID == 0x00 (Ed25519) on Momentum headers—securing 100% of block production against Shor's algorithm.

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.

Why Zenon Should NOT Use BLS12-381 or Complex STARK Vote Aggregation

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 SizeParallel 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 msNTRU Lattice (FIPS 206)
ML-DSA-44 (algID = 0x01)4 B bitmap + 21 × 2,420 B = 50,824 B (~49.6 KiB)~0.14 msModule-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 msPure 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:

  • UpdateWrapRequest and UnwrapToken currently verify a single 65-byte recoverable secp256k1 ECDSA signature (maxECDSASigBase64Len = 88) against BridgeInfo.DecompressedTssECDSAPubKey.
  • While post-quantum threshold lattice MPC (TRaccoon / threshold ML-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's BridgeContract already bounds Guardians to MinGuardians = 5 .. MaxGuardiansPostDP = 30!
  1. Register an ordered list of up to N <= 30 Orchestrator/Guardian ML-DSA-44 public keys ([0x09] storage prefix in BridgeContract) with threshold T = floor(2*N/3) + 1 (e.g., 11-of-15 or 21-of-30).
  2. Inbound (UnwrapTokenPQ — External Chain → Zenon): Guardians independently verify the external chain lock event and produce deterministic ML-DSA-44 signatures over UnwrapMessageHash (ctx = "zenon-bridge:v2"). A 15-of-22 quorum witness (4 B bitmap + 15 × 2,420 B = 36,304 B, or 15 × 666 B = 9,994 B with FN-DSA-512) fits inside a single AccountBlock (raising MaxDataLength from 16 KiB to 64 KiB for BridgeContract, or preferring FN-DSA-512 which fits inside the existing 16,384-byte MaxDataLength with 6 KiB to spare!).
  3. Outbound (WrapToken — Zenon → External Chain): Outbound signature format is dictated by the destination chain's smart contract (e.g., ECDSA until Ethereum/BNB deploy EIP-8051/EIP-8052 precompiles, at which point UpdateWrapRequestPQ stores 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 B lock, 64 B sig)
  • 1: PointTypeBIP340 (32 B x-only lock, 64 B Schnorr sig)
  • 2: PointTypeSecp256k1Point (33 B compressed point [k]G, unlocked by revealing scalar k)

Post-Quantum Action:

  1. Cross-Chain Atomic Swaps → Use HtlcContract: PointTypeSecp256k1Point ([k]G scalar 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-byte SHA3-256 / SHA-256 preimages, which already provide 128-bit post-quantum security against Grover's algorithm!
  2. Signature-Locked Escrows → Add PointType 3 & 4: Add PointTypeMLDSA44 = 3 (32 B SHA3-256(pk) lock commitment, witness = pk[1312] || sig[2420]) and PointTypeFNDSA512 = 4 (32 B SHA3-256(pk) lock commitment, witness = pk[897] || sig[666]) to PtlcContract, keeping storage records ptlcInfo compact (32 B lock!) regardless of PQ public-key size.
  3. Phase 3 Sunset: Reject Create / CreateWithReclaimLock for pointType ∈ {0, 1, 2} once LegacyCryptoSunsetSpork activates.

SwapContract & Pillar.RegisterLegacy​

  • SwapContract (internal/vm/contracts/swap/swap.go:205-228): DecayPercentage(epoch) already reached 0% at epoch >= 389 (~1 year after Alphanet Genesis). Even if a CRQC forges a legacy Bitcoin-style secp256k1 signature in Swap.RetrieveAssets, znnOut and qsrOut evaluate to 0!
  • Pillar.RegisterLegacy (internal/vm/contracts/pillar/pillar.go:38, 73): Still checks PrefixLegacyPillarEntry ([0x03] || keyIdHash) via secp256k1 signature recovery. Sunset SelectorRegisterLegacy (0xe4588207) in Phase 3 so unclaimed legacy .znn swap 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:

  1. Retire Legacy DevP2P RLPx (secp256k1 ECIES): Now that Libp2pSpork is active on Alphanet, deprecate legacy enode:// RLPx and discv4 completely.
  2. Upgrade Stream Security to Hybrid X25519 + ML-KEM-768: Go 1.26's standard library includes crypto/mlkem (mlkem.GenerateKey768(), X25519MLKEM768 in crypto/tls). Configure go-libp2p TLS 1.3 (libp2p-tls with Go 1.26 default X25519MLKEM768 curve preferences) or PQ-Noise (Noise_XX_25519_MLKEM768) so all /znn/eth/1 and /znn/kad/1.0.0 traffic is immediately immune to Harvest-Now-Decrypt-Later recording.
  3. Post-Quantum Peer Identity (peer.ID): NodeIDFromPeerID (server.go:75) currently enforces pub.Type() == lp2pcrypto.Secp256k1 to map onto legacy 64-byte p2p.NodeID. Decouple internal peer tracking (peer.ID multihash string) from 64-byte uncompressed secp256k1 coordinates, and register a multicodec ML-DSA-44 host identity key (network-pq-private-key, 32-byte seed) so Sentinels and Pillar sentry nodes cannot be MITM-impersonated by a CRQC.