# ZENON PHASE 1 (ZNN-SPEC-PHASE1-v4) — COMPLETE MASTER SPECIFICATION, CHANGELOG & GO 1.27+ BLUEPRINT Repository: https://github.com/0x3639/zenon-phase-1 Live Documentation Portal: https://0x3639.com/zenon-phase-1/ Target Node Codebase: https://github.com/0x3639/go-zenon-v1 (Go 1.27+) Supersedes: ZNN-SPEC-PHASE1-v3, ZNN-SPEC-PHASE1-v4-Candidate-RC3, ZNN-SPEC-PHASE1-v2 (cee69c0), and ZNN-SPEC-PHASE1-v1 (4f8e3c7) This single-file Markdown corpus contains all 31 normative v4 chapters and iterative hostile-review ledgers of Zenon Phase 1, tracking 118 findings across Round 1 (MM4-HR-001 + ER-01 + PQ-01..10), Round 2 (ZDC-ZP1-HR-001 37/37), Round 3 (ZDC-QS-DEEZ-HR-001 26/26), and Round 4 (v4-RC3 + R4-01..09 14/14). ================================================================================ CHAPTER 01 / 31: Zenon Phase 1: Master Executive Overview (ZNN-SPEC-PHASE1-v4) FILE: docs/intro.md | URL: https://0x3639.com/zenon-phase-1/docs/intro ================================================================================ # Zenon Phase 1 (`ZNN-SPEC-PHASE1-v4`) > **For Humans & AI Coding Agents:** Every chapter opens with a **60-second TL;DR**, followed by **byte-exact wire layouts, formal state-machine invariants, hardware/storage bounds, and qualification gates (`G1–G10` + `ZP-Q11–Q30`)** mapped against [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1), [`0x3639/zenon-rs`](https://github.com/0x3639/zenon-rs), [`Zeno-L2`](https://github.com/Zeno-L2), and [`syrius`](https://syrius.zenon.foo/). > > **Iterative Hostile Review Tracking (`118` Findings Across Rounds 1–4, `v0 → v4`):** See **[Master Iteration History & Changelog](https://0x3639.com/zenon-phase-1/docs/reviews/iteration-changelog)**, **[Round-2 `ZDC-ZP1-HR-001` (`37/37`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-2-zp1-hr-001-maintainer-response)**, **[Round-3 `ZDC-QS-DEEZ-HR-001` (`26/26`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-3-deez-pq-hr-001-maintainer-response)**, and **[Round-4 `v4-RC3` + Independent Crypto/Source Audit (`14/14`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit)**. > > **Single-File LLM Ingestion:** [`/llms-full.txt`](pathname:///llms-full.txt) (complete normative `v4` corpus) · [`/llms.txt`](pathname:///llms.txt) (structured index + raw `.md` endpoints) · **[`go-zenon-v1` PQ Validator Implementation Spec (`ZNN-IMP-PQ-V1` · `v4`)](https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec)**. --- ## 60-Second Plain-English TL;DR Alphanet (**Phase 0**, launched November 2021 on legacy [`zenon-network/go-zenon`](https://github.com/zenon-network/go-zenon)) proved Zenon's feeless dual-ledger account-chain model (`Block-Lattice`) and `QSR` Plasma / PoW anti-spam economics, while running on single-threaded `goleveldb` storage, legacy DevP2P `RLPx` networking, static Plasma limits, and a temporary 10-second single-leader DPoS chain secured by quantum-vulnerable elliptic curves (`Ed25519` and `secp256k1`). **Zenon Phase 1 (`ZNN-SPEC-PHASE1-v4`)** completes the 2020 Network of Momentum vision. **Implementation begins independently at `Phase 1.0` by upgrading mainnet from `go-zenon` to [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1)**—unlocking multi-core **`pebble/v2` storage & 4-stage parallel sync** (independently benchmarked under `ZP-Q22`), activating **`DynamicPlasmaSpork`** and **`Libp2pSpork`**, and preparing `v1.1` (`Go 1.27+` `X25519MLKEM768` transport, `uint64 SporkMask`, `25/100 Mbps` node shaper, and `>= 85%` active-stake spork readiness signaling). Atop that qualified `go-zenon-v1` foundation, five additive Spork stages (`Phase 1A` → `1E`) deliver four unified architectural pillars: ![Zenon Phase 1 Unified Four-Pillar Architecture](https://0x3639.com/zenon-phase-1/img/phase1/00-zenon-phase1-four-pillars.svg) 1. **Pillar I — Post-Quantum Accounts, `BoundSigningDigest` & Two-Lane Feeless Plasma (`AccountBlock v2` + `O(1)`-Exposure `PoKoS`):** Upgrades user accounts to an algorithm-agile NIST post-quantum stack (**`0x01` `ML-DSA-44`** via **`Go 1.27+`** stdlib `crypto/mldsa` `[E1]`, **`0x02` `FN-DSA-512`** pure-Go `fn-dsa v0.3` `[E2]`, and **`0x03` `SLH-DSA-SHAKE-128s`** pure Keccak) bound via **`BoundSigningDigest`** (`R4-01`, eliminating `0x81 <-> 0x00` hybrid stripping and Path-C ransomware) while keeping `types.Address` at **20 bytes** (`0x02` `z1q{2,f,g,t}...` Bech32 + `PrecommitKey`), caching public keys in `AccountStore[0x09]` (`35.2%–57.4%` witness savings) with sidecar `[0x11]` `ProofWitness` storage (`R4-07`), rotating locked `Stake`/`Pillar`/`Sentinel` keys in place via **`AuthRegistryContract` (`Embedded #14`)** under **`InclusionMomentumHeight` (`H_inc + 1`)** & `179-byte` PoP rules, and enabling **Day-1 `Ed25519-PoKoS`** backed by an **`O(1)` legacy exposure resolver** (`R4-02`, binding `32B` `pubKey_A` at `~2^126` Grover on all exposed accounts). 2. **Pillar II — Asynchronous Post-Quantum Meta-DAG Consensus (`Momentum-Mahi` `stride = 5` + Pure-`SHA3` `HashRand-PQ`):** Replaces 10-second single-leader slots (`LegacyDposV1`) with **Non-Overlapping `stride = 5` `Mahi-Mahi` (`Profile C-AS` shipping default; `Steelhead` `Profile B` gated on `ZP-Q11`)** over a **direct `1-hop` validator mesh (`3.83 Mbps` base + `1.49–2.54 Mbps` `1.0 Hz` coin = `5.32–6.37 Mbps` TX at `5 Hz`)** behind `ZDC-MM-ER-01`'s 3-horizon adapter (`1.0 s` `Momentum v4` headers + `qc_wal` `/znn/dag/qc/v2` `MomentumPQQC`). Uses **`M_shares = 4,096 = 3 * 1,365 + 1`** voting shares (`Q_vote = 2,731`), **`FN-DSA-512` (`666 B`)** validator signatures, **Pure-`SHA3-256` `HashRand-PQ`** (`M_coin = 256 = 3 * 85 + 1`, `2.03 MiB` matrix, `AVID-FP` `0.69–1.34 Mbps` dealing, `0` lattice assumptions `R4-05`), **`SunsetAnchorCheckpoint` (`<= MaxPreCRQCBitcoinHeight`, `R4-09`)**, and `30`-day rolling Sovereign Pi 5 retention (`<= 450 GB` on `1 TB` NVMe). 3. **Pillar III — Proof-First State & `Zeno` Execution (Domain-Separated `smt-v1` + `2^-128` QROM `WHIR-SHA3-v1` STARKs):** Commits a RFC-6962 domain-separated (`[0x00]`/`[0x01]`) `SHA3-256` Sparse Merkle Tree (`smt-v1`, `R4-07`) `StateRoot` in every `Momentum` (`1.2 KB` proofs backed by `EpochTerminalQC` light-client chains) and anchors off-chain `Zeno` domains (`d_wasm`, `d_zvm` EVM, `d_accounts`) in **`SettlementContract` (`Embedded #13`)**. Eliminates both `BN254` pairings and `Poseidon2` algebraic hashes on L1 by verifying **pure-`SHA3-256` `WHIR-SHA3-v1` STARK proofs (`57–86 KiB` at full `2^-128` `CMS19` QROM security, `<= 128 KiB` cap, `<= 8,000` Keccak perms = `<= 3.5 ms` on Pi 5 Cortex-A76 `R4-04`)**. 4. **Pillar IV — Trust-Minimized Bitcoin (`d_btc`) & Adjudicated Edge Channels (`ChannelContract #15`):** Mints feeless `zBTC` via `SHA-256d` Bitcoin SPV proven inside `d_btc` PQ-STARKs, settles atomic multi-hop swaps over `256-bit`-entropy `SHA-256` **`HTLC`s** / Lightning, classifies `FROST` and `BitVM2` (`BN254` + Taproot `[E3]`) as **pre-CRQC transitional vaults** (with keyless covenants contingent on Bitcoin `BIP-360 P2MR` + `OP_CAT` `[E4]`), and specifies **`ChannelContract` (`Embedded #15`, `z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2`)** with lockout-free in-`CLOSING` `ClaimHTLC`, hostage-free `FinalizeBasePayouts` (`R4-08`), and a `1,538 B` constant `fixed64` wire vector. --- ## Master Phase 0 → Phase 1 (`v4`) Comparison Matrix | Architectural Dimension | Phase 0 Alphanet (`zenon-network/go-zenon`) | Zenon Phase 1 (`0x3639/go-zenon-v1` · `ZNN-SPEC-PHASE1-v4`) | |---|---|---| | **Node Engine (`Phase 1.0` Start)** | Legacy Go + `goleveldb`, coarse locks, static Plasma, `RLPx` | **`go-zenon-v1` (`Go 1.27+`):** `pebble/v2`, 4-stage parallel sync + **`DynamicPlasmaSpork`** + **`Libp2pSpork` (`X25519MLKEM768`)** *(gate `ZP-Q22`)* | | **Consensus & Quorums (`1B`)** | Single-leader 10s DPoS (`30` block reorgs) | **`Mahi-Mahi` (`C-AS` `stride=5` default) + `Steelhead` (`ZP-Q11`)** (`M = 4,096` voting shares, `Q = 2,731`, `1.0 s` `Momentum v4` + `qc_wal` `MomentumPQQC`) | | **Asynchronous Coin (`1B`)** | Predictable height-seeded PRNG | **Pure-`SHA3-256` `HashRand-PQ`** (`M_coin = 256`, `T_coin = 86`, `2.03 MiB` matrix, `AVID-FP` `0.69–1.34 Mbps` dealing, `0` lattice assumptions `R4-05`) | | **User Crypto & Sunset (`1A, 1E`)** | Classical `Ed25519` & `secp256k1` (`0` PQ bits) | **`BoundSigningDigest`** (`0x01` `ML-DSA-44`, `0x02` `FN-DSA-512`, `0x03` `SLH-DSA-128s`, `0x02` `z1q{2,f,g,t}`) + `H_inc` Sunset + `O(1)`-resolved `PoKoS` (`R4-01..03`) | | **State & Bootstrap (`1A, 1C, 1E`)** | Full-replay classical history | **`[0x00]/[0x01]` `smt-v1` `StateRoot`** + **`SunsetAnchorCheckpoint` (`<= MaxPreCRQCBitcoinHeight`)** + **`2^-128` QROM `WHIR-SHA3-v1`** (`57–86 KiB`, `<= 8k` Keccak perms `R4-04, 07`) | | **Sovereign Validator Floor** | Unbounded history growth | **Raspberry Pi 5 (`4c, 8GB, 1 TB NVMe, 100/25 Mbps`)**: `5.32–6.37 Mbps` `5 Hz` DAG+Coin TX, `16.4 MB/yr` `EpochTerminalQC`s, `<= 450 GB` rolling NVMe | | **Bitcoin & Edge (`1D`)** | Centralized/TSS `secp256k1` multisig | **`d_btc` SPV STARK** + `99B` BTC checkpoints + `SHA-256` `HTLC`s + transitional `BitVM2` + **`ChannelContract (#15)`** (`1,538 B` wire, `FinalizeBasePayouts` `R4-08`) | ================================================================================ CHAPTER 02 / 31: 2020 Whitepaper vs. Alphanet Phase 0 Forensics FILE: docs/research/whitepaper-vs-mainnet.md | URL: https://0x3639.com/zenon-phase-1/docs/research/whitepaper-vs-mainnet ================================================================================ # 2020 Whitepaper Vision vs. Live Alphanet Phase 0 Reality > **60-Second TL;DR:** Direct source inspection of [`zenon-network/go-zenon`](https://github.com/zenon-network/go-zenon), [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1), and [`0x3639/zenon-rs`](https://github.com/0x3639/zenon-rs) confirms that **Alphanet ("Phase 0") built the transactional Block-Lattice half cleanly and faithfully**—including SegWit-style witness separation and per-account state isolation—while substituting a temporary **10-second single-leader DPoS chain (`LegacyDposV1`)** secured by classical `Ed25519` for the whitepaper's asynchronous Meta-DAG. **Zenon Phase 1** upgrades consensus, programmability, and cryptography behind existing clean seams without breaking account-chains or contract ABIs. --- ## 1. What the 2020 Whitepaper Designed The March 2020 whitepaper (*Network of Momentum — Leaderless BFT Dual Ledger Architecture* `[R1]`) diagnosed the root bottleneck of monolithic blockchains (§III-A): packing independent user transactions into a single sequentially executed VM forces unrelated accounts to contend for global state locks and blockspace. To eliminate that bottleneck, the whitepaper specified four foundational mechanisms: 1. **Dual-Ledger Architecture (§III-A.4, §V-A):** * **Block-Lattice (Transactional Ledger):** Every user account maintains its own independent chain of `Send` and `Receive` blocks (extending the Nano block-lattice model `[R25]`). Non-conflicting account-chains grow asynchronously. * **Meta-DAG (Consensus Ledger):** Pillar consensus nodes maintain a leaderless Directed Acyclic Graph organized into virtual epochs that orders and finalizes account-chain updates. 2. **Stake-Weighted Virtual Voting (§I, §IV-A Def. 4, §V-C):** * Drawing on Moser & Melliar-Smith (1999), Hashgraph, PARSEC, Blockmania, and Aleph `[R1]`, Pillars deduce supermajority (`zeta = floor(2*N / 3) + 1`) agreement locally from causal DAG relationships without exchanging separate per-vertex vote storms. 3. **Unconditional Asynchronous Network Model + Coin Round (§IV-B, §V-C, §VII-D):** * Section IV-B explicitly specifies: *"the system is considered asynchronous i.e. there are no bounds on messages delivery."* * Algorithm 2 (lines 34–44) introduces a **shared random coin round** after `4–5` undecided rounds so that even an adversary controlling internet routing delays cannot prevent termination (`P = 1` as waves progress). 4. **Three-Tier Node Separation (§IV-A Def. 3):** * **Pillars:** Stake-weighted consensus validators constructing the Meta-DAG and anchoring state commitments. * **Sentinels:** Public-IP trustless ingress/dissemination nodes filtering spam, relaying erasure-coded data availability stripes, and serving ledger proofs without holding consensus voting power. * **Sentries / Light Clients:** Lightweight wallet-embedded verifiers checking individual account-chains and `1.2 KB` `smt-v1` state proofs with minimal hardware. --- ## 2. What Alphanet Phase 0 Shipped (`go-zenon`) vs. Why `go-zenon-v1` Starts Phase 1 Alphanet (**Phase 0**, launched November 2021) runs on legacy [`zenon-network/go-zenon`](https://github.com/zenon-network/go-zenon) (`goleveldb`, single-threaded sync, legacy DevP2P `RLPx`, static Plasma limits, and `10s` single-leader `LegacyDposV1`). Therefore, **the very start of Zenon Phase 1 (`Phase 1.0`) is upgrading mainnet nodes from `go-zenon` to [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1)**—replacing `goleveldb` with multi-core `pebble/v2` and a 4-stage parallel sync pipeline (independently benchmarked under `ZP-Q22`) while activating **`DynamicPlasmaSpork`** and **`Libp2pSpork`**. ### 2.1 Structural Strengths Ready Today in `0x3639/go-zenon-v1` (`Phase 1.0` Launchpad) 1. **True Per-Address Block-Lattice Isolation:** * `internal/nom/account_block.go` defines five block types: `GenesisReceive (1)`, `UserSend (2)`, `UserReceive (3)`, `ContractSend (4)`, and `ContractReceive (5)`. * `internal/chain/account_pool.go` isolates uncommitted state per `types.Address`. * In `internal/vm/supervisor`, user blocks (`UserSend`, `UserReceive`) execute with **zero access to mutable global contract state**—mutating *only* their own `AccountStore` (formally proven by `debit_changes_one_balance` and `credit_changes_one_balance` in `test/bend/ledger`). 2. **Built-In SegWit-Style Witness Separation (`306-Byte` Hash Preimage):** * `AccountBlock.ComputeHash()` (`internal/nom/account_block.go:124-166`) and `Momentum.ComputeHash()` (`internal/nom/momentum.go:132`) **already exclude `PublicKey` and `Signature`**, allowing Zenon Phase 1 to introduce multi-kilobyte post-quantum signatures and prunable STARK validity witnesses with **zero hash-chain breaks**. 3. **Zero-Re-Execution Momentum Commit & FIFO Contract Mailboxes:** * `MomentumVM` iterates `Momentum.Content` (`60-byte` `AccountHeader`s: `Address[20] || Height[8] || Hash[32]`) and merges pre-computed `Patch`es into `MomentumStore`, while embedded contracts process deterministic FIFO `Mailbox` queues (`internal/chain/mailbox.go`). 4. **Modern Multi-Core Go Engine Seams (`Go 1.26` Base → `Go 1.27+` for `crypto/mldsa` `[E1]`):** * `0x3639/go-zenon-v1` currently builds on `Go 1.26.0` (`crypto/mlkem` in stdlib) and bumps `go.mod` to **`Go 1.27+`** for Phase 1A (`crypto/mldsa` public stdlib package introduced in Go 1.27 `#77626` `[E1]`, closing `M12`), paired with **CockroachDB `pebble/v2`**, lock-free MVCC `*pebble.Snapshot` readers, zero-allocation `FlatOverlay` arenas, `HotStateCache`, and a spork-gated **`ConsensusSwitcher`** (`internal/consensus/engine/switcher.go`). ### 2.2 Eight Phase 0 Limitations Resolved by Zenon Phase 1 | Phase 0 Limitation | Location in `go-zenon` / `go-zenon-v1` | Consequence Today | Zenon Phase 1 Resolution | |---|---|---|---| | **1. Sequential 10s Single-Leader Slots** | `internal/consensus/engine/legacy_dpos.go` | `BlockTime = 10s`; 1 Pillar works while ~99% of validator bandwidth sits idle. | **Uncertified PQ Meta-DAG (`Mahi-Mahi` `C-AS` default + `ZP-Q11`-gated `Steelhead`)** where all active Pillars propose concurrently every round (`1.0s` final Momentums). | | **2. Predictable PRNG Leader Schedule** | `election_algorithm.go:58` | Slot producers are 100% predictable minutes ahead, enabling targeted BGP/DDoS stalls. | Retrospective **PQ `HashRand` / Shamir `AVSS` Common Coin** reveals wave leaders *after* causal edges lock. | | **3. Single-Signer Momentums (No QC)** | `internal/nom/momentum.go` | Single `Ed25519` signature per Momentum; no `2f + 1` stake Quorum Certificate. | `Momentum v4` carries a `2f + 1` stake **`FN-DSA-512` `MomentumQC`** (`0` reorgs). | | **4. 30-Momentum Reorg Window** | `LegacyMaxReorgDepth = 30` | 5-minute rollback window; `> 30` slot partitions cause permanent chain splits `[R14]`. | Deterministic BFT finality (`FinalityRollbackWindow = 0` post-QC). | | **5. No Global State Merkle Root** | `Momentum.ChangesHash` (diff only) | Light clients and bridges cannot prove current account or contract values without full replay. | **`Momentum v3` (`StateRootSpork`)** commits a 32-byte `SHA3-256` `smt-v1` Sparse Merkle Root (`1.2 KB` proofs). | | **6. No General Programmability** | 12 fixed Go embedded contracts | Adding WASM, EVM, or Bitcoin SPV logic requires hard-coding Go consensus rules. | **Proof-First `Zeno` (`SettlementContract #13`)** verifies off-chain `d_wasm`, `d_zvm`, and `d_btc` execution via pure-hash STARKs. | | **7. Quantum-Broken Elliptic Curves** | `Ed25519`, `secp256k1`, `X25519` | Shor's algorithm breaks user keys, Pillar producers, TSS bridges, and PTLC `[k]G` points (`0` quantum bits). | **NIST FIPS 203/204/205/206** (`ML-KEM-768`, `ML-DSA-44`, `SLH-DSA-128s`, `FN-DSA-512`) + **Day-1 `Ed25519-PoKoS`**. | | **8. Unpriced Witness Bytes in Plasma** | `internal/pow/plasma.go:269` | `PublicKey` and `Signature` cost `0` plasma—safe at `96 B`, DoS vector under multi-KB PQ/STARK witnesses. | Stateless **`WitnessPlasma` (`17` plasma/excess byte)** + post-finality witness pruning. | ================================================================================ CHAPTER 03 / 31: Community Roadmap, Frontier Vol. I–III, ZDC-MM-ER-01 & Zeno Synthesis FILE: docs/research/community-and-commons-synthesis.md | URL: https://0x3639.com/zenon-phase-1/docs/research/community-and-commons-synthesis ================================================================================ # Synthesis of `roadmap.zenon.foo`, `Frontier` (`TminusZ`), `Zeno-L2`, and Post-Quantum Research > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** **Zenon Phase 1** synthesizes and reconciles six streams of Zenon engineering: (1) [`roadmap.zenon.foo`](https://roadmap.zenon.foo/) `[R14]`, (2) `TminusZ`'s **Frontier** consensus & dissemination series (`RFC-00–05`, Vol. I–III, `ZDC-FRONTIER-MM4-HR-001`, `ZDC-MM-ER-01` `[R26–R30]`), (3) `DigitalSloth`'s [`Zeno-L2`](https://github.com/Zeno-L2) Proof-First domain architecture `[R36, R37]`, (4) NIST Post-Quantum Cryptography & `Ed25519-PoKoS` `[R43–R48]`, (5) Hostile Reviews Rounds 2 & 3 (`ZDC-ZP1-HR-001` `[R56]`, `ZDC-QS-DEEZ-HR-001` `[R57]`), and (6) the **Round-4 Independent Cryptographic & `go-zenon-v1` Source Audit (`R4-01..R4-09`)**. --- ## 1. Key Takeaways from `roadmap.zenon.foo` (`v4` Reconciled) | Earlier Assumption (2020–2023) | Modernized Direction (`roadmap.zenon.foo`) | Reconciled `ZNN-SPEC-PHASE1-v4` Design | |---|---|---| | **Certified Narwhal & Tusk** | **Uncertified DAG (`Mysticeti` / `Mahi-Mahi`)** | **`Mahi-Mahi` (`Profile C-AS` `stride = 5` default) + `Steelhead` (`Profile B`, `ZP-Q11` gated)** over `M = 4,096` voting shares + pure-`SHA3` `HashRand-PQ` (`M_coin = 256`, `R4-05`). | | **RandomX Client PoW** | **`Equi-X` Asymmetric Puzzle** | **Two-Stage `Equi-X` (`HashX` + `16B` index tree + `uint128` effort target `[E5]`)** (`< 25 µs` verify, `+272` witness plasma `H14`). | | **Pillar-Run Extension Chains** | **Proof-Checked Domains (`Project Zeno`)** | Pillars never execute guest WASM/EVM bytecode (`INV-02`); `SettlementContract (#13)` verifies **`2^-128` QROM pure-`SHA3` `WHIR-SHA3-v1` STARKs (`<= 128 KiB`)** in `<= 3.5 ms` (`R4-04`). | | **Merge-Mining & GG20 ECDSA** | **BTC Checkpoints + BitVM2 → Covenants** | `d_btc` `SHA-256d` SPV STARK + height-bounded `99B` BTC checkpoints (`M11, R4-09`) + `SHA-256` `HTLC` swaps + pre-CRQC `BitVM2` (`[E3]`) → contingent `BIP-360` + `OP_CAT` covenants (`H11`). | --- ## 2. `TminusZ/zenon-developer-commons` (`Frontier` Corpus & Hostile Reviews) 1. **Constitutional Invariants & Sovereign Raspberry Pi 5 Baseline (`RFC-00–05` `[R26]`):** * Enforces eight invariants: `INV-01` Safety, `INV-02` Sovereignty, `INV-03` Recoverability, `INV-04` Resource Boundedness, `INV-05` Economic Accessibility, `INV-06` Interoperability, `INV-07` Evolution, `INV-08` Falsifiability. * Freezes the **Sovereign Pillar Hardware Floor (`RFC-00`)**: **Raspberry Pi 5** (`4× Cortex-A76`, `8 GB RAM` / `<= 6.5 GB` RSS, `1 TB NVMe` / `<= 450 GB` rolling retention `B08, R4-07`, `100 Mbps` RX / `25 Mbps` TX / `<= 15 Mbps` framed control plane, `<= 12 W` power). 2. **Direct `1-Hop` Validator Mesh + `stride = 5` `HashRand-PQ` Coin (`M01, H16, R4-05`):** * Direct `1-hop` validator unicast (`0` GossipSub forwarding) + `13B` `IZ/parents/v2` bitmaps + `34 B/entry` delta `MAP_REPLY` + `1 Hz` (`stride = 5` non-overlapping wave) `HashRand-PQ` reveals keep `5 Hz` `Mahi-Mahi` control wire at **`5.32–6.37 Mbps` framed TX** (`N = 100`, plus `0.86–1.29 Mbps` `AVID` coin replenishment `R4-05`). 3. **Dissemination (`Vol. III` `[R28]`) & 3-Horizon Adapter (`ZDC-MM-ER-01` `[R29]`):** * Normal L1 batches use `NATIVE_FULL` possession (`0` `CustodyCert` overhead `H08`), while `DA_BATCHED` `Zeno` blobs (`>= 1 MiB`) and `ManifestV1` cold archives (`>= 4 MiB`) use bonded `M_slots = 100` `SHA3-256` `2D AVID` custody (`M08`). --- ## 3. `Zeno-L2` (`Proof-First Architecture`) + Post-Quantum Reconciliation 1. **Domain-Separated `smt-v1` State Tree (`Momentum v3`, `R4-07`):** Full-depth-256 binary `SHA3-256` Sparse Merkle Tree (`[0x00]` leaf / `[0x01]` internal domain prefixes + `32B` sibling bitmap `<= 1.2 KB` proofs), backed by the complete `SunsetAnchorCheckpoint -> EpochTerminalQC -> MomentumPQQC -> smt-v1` light-client chain (`H13, R4-07, R4-09`). 2. **Direct `ZK_VALIDITY` (`L1_NATIVE` + `DA_BATCHED`, `H03`):** Supports censorship-immune L1 forced inputs alongside high-throughput Sentinel-DA-batched rollup streams, with realistic Tier 1–3 proving profiles and `T_2 = 300 s` `S3` bounty escape (`H12`). 3. **True `2^-128` QROM Pure-`SHA3` `WHIR-SHA3-v1` L1 Verifier (`PQ-03, H02, H07, M10, R4-04`):** Replaces `BN254` Groth16 wrapping and forbids `Poseidon2` inside L1 receipts—verifying `57–86 KiB` (`<= 128 KiB` cap) pure-`SHA3-256` STARKs (`<= 8,000` Keccak perms) inside a zero-alloc `256 KiB` arena in `<= 3.5 ms` on Cortex-A76 (`~1.2 ms` typical). ================================================================================ CHAPTER 04 / 31: Quantum Threat Model (Grover/BHT/MAXDEPTH/QROM Bounds) and Peer L1 Survey FILE: docs/research/quantum-threat-and-industry-survey.md | URL: https://0x3639.com/zenon-phase-1/docs/research/quantum-threat-and-industry-survey ================================================================================ # Quantum Threat Model (Per-Relation Security Bounds, Bootstrap & Peer L1 Survey) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Cryptographically Relevant Quantum Computers (CRQCs) running **Shor's algorithm** (`O((log N)^3)`) break every elliptic-curve and bilinear-pairing primitive in polynomial time: `Ed25519` account/Momentum signatures, `secp256k1` `BridgeContract`/`SwapContract` & `[k]G` PTLCs, `X25519` Noise handshakes, **`BLS12-381` threshold coins**, and **`BN254` Groth16 SNARKs**. Reconciling `ZDC-ZP1-HR-001`, `ZDC-QS-DEEZ-HR-001`, and the **Round-4 Independent Cryptographic Audit (`R4-01..R4-09`)**, **Zenon Phase 1 `v4`** specifies **exact per-relation classical, ideal unbounded Grover, Zalka quadratic-per-processor `MAXDEPTH = 2^64` bounds (`R4-06`), `CMS19` QROM `2^-128` (`2^-256` classical RBR) Fiat-Shamir bounds (`R4-04`), pure-`SHA3-256` `HashRand-PQ` coin bounds (`R4-05`), and height-bounded post-CRQC bootstrap rules (`R4-09`)**. --- ## 1. Per-Relation Cryptographic Surface & Security-Level Audit (`H05, B05, B06, R4-04..R4-06`) Preimage search, collision search, `152-bit` truncated address hashes, `PoKoS` seed commitments, Shamir secret shares, and multi-round Fiat-Shamir QROM reductions obey **distinct** query and circuit-depth laws: | Subsystem | Phase 0 / Naive Primitive | Phase 1 (`v4`) Target Primitive | Classical Bits | Ideal Unbounded Quantum Queries | Depth-Limited (`NIST MAXDEPTH = 2^64`, Zalka `[E6]`) & QROM Notes | |---|---|---|:---:|:---:|---| | **Block, `smt-v1` (`0x00/0x01`) & `2D AVID` Preimage** | `FIPS-202 SHA3-256` | `FIPS-202 SHA3-256` *(domain-separated `R4-07`)* | `256` | `2^128` (Grover) | At circuit depth `2^d`, `K = 2^(64-d)` iters/run requires `M = 2^(128+2d)` parallel runs (`W = 2^(192+d)` oracle calls). | | **Merkle / Transcript Collision** | `FIPS-202 SHA3-256` | `FIPS-202 SHA3-256` *(pure-hash)* | `128` (Birthday) | `~2^85.3` (`BHT`) / `~2^102` (`CNS`) | Matches NIST Category 1–2 hash-collision standard (`M10`). | | **Unregistered `20B` Address (`UNEXPOSED`)** | `0x00 \|\| SHA3-256(pk)[0..19]` | `0x02 \|\| SHA3-256("zenon-pq-addr:v1" \|\| alg \|\| pk)[0..19]` | `152` preimage | **`2^76` single / `2^((152-u)/2)` multi-target** | **Zalka (`R4-06`):** With `D_circ ≈ 2^12` (`K = 2^52` iters/run covering `K^2 = 2^104` states), requires **`M = 2^152 / K^2 = 2^48` parallel runs** and **`W = M*K = 2^100` oracle calls (`> 2^112` gates)**! Cold vaults lock full `256-bit` binding pre-spend via `AuthRegistry.PrecommitKey` (`B05`). | | **Registered / Precommitted Account** | `32B` `Ed25519` (`0` PQ) | `AccountStore[0x09]` / `AuthRegistry` `32B` `SHA3-256(pk)` + `boundDigest32` (`R4-01`) | `256` | **`2^128` (Grover) + NIST Cat. `1–2`** | Full public key & `algID` bound in every signature (`R4-01`); `0x81` forbidden on unregistered `0x00` Path C! | | **`Ed25519-PoKoS` (`EXPOSED` `0x00` History)** | None | `WHIR-SHA3-v1` binding **full `32B` `pubKey_A`** (`B06, R4-02`) | `~252` | **`~2^126` (Grover over `RFC 8032` seeds)** | `O(1)` authenticated exposure resolver (`AuthRegistry[0x03]` + `[0x0a]` + `GenesisReceive`-aware `ByHeight(1..2)`) eliminates `152-bit` bypass (`R4-02`)! | | **`Ed25519-PoKoS` (`UNEXPOSED` `0x00` History)** | None | `WHIR-SHA3-v1` binding `19B` `targetAddress` | `152` | **`2^76` ideal / `W ≈ 2^98` calls (`MAXDEPTH=2^64`)** | Information-theoretically capped at `152` bits since only `addr20` is on-chain; `UNKNOWN` (missing history) fails closed (`R4-02`). | | **`WHIR-SHA3-v1` Fiat-Shamir STARK (`0x10`)** | `BN254` Groth16 (`0` PQ) | Pure-`SHA3-256` `WHIR` (`>= 256b` classical RBR: `224b` query + `32b` grind, `256b` ext. field `R4-04`) | `256` RBR | **`~2^128` QROM (`CMS19` state-restoration)** | Accounts explicitly for Grover's square-root halving of both IOP query soundness and transcript grinding (`32b` grind -> `16b` quantum `R4-04`)! | | **Async Common Coin (`HashRand-PQ`)** | `BLS12-381` (`0` PQ) | **Pure-`SHA3-256` `HashRand-PQ` (`M_coin = 256`, `GF(2^256)` salt-free `32B` shares `R4-05`)** | `256` unconditional | **`2^128` (Grover leaf hiding) + `0` lattice** | Unconditional Shamir secrecy before `r_4` + `2^-512` QROM masked polynomial degree check; `0.86–1.29 Mbps` `AVID` deal (`R4-05`). | | **HTLC Preimage (`HtlcContract` / Channels)** | `SHA-256` (`32B`) | `SHA-256` / `SHA3-256` (**mandatory `256-bit` CSPRNG secret**) | `256` | `2^128` (Grover) | Wallets MUST forbid low-entropy user-chosen secrets (`M10`). | | **P2P Transport & Peer Auth** | `Noise_XX_25519` / `RLPx` | `X25519MLKEM768` (`crypto/tls`) + `/znn/tls-pq/1.0.0` `ML-DSA-44` host ID | `~192` KEM / `~128` Auth | Cat. `3` KEM + Cat. `2` Sig | Disables classical `libp2p-noise` at `Spork #14`; consensus NEVER trusts `peer.ID` (`M08`). | --- ## 2. Five Quantum Attack Vectors & Exact Scope Boundaries (`H06, B11, B12, R4-01..R4-09`) 1. **Long-Exposure Shor Theft on Revealed Keys (`EXPOSED` vs. `UNEXPOSED` — `H06, R4-02`):** * `0x00` accounts with authenticated exposed-key history (`AccountBlock` reveal, `Momentum` producer header, or `PTLC` `Ed25519` unlock) **MUST** rotate via `AuthRegistry.RotateKey` prior to CRQC arrival (or rely on `Spork #14` disabling `0x00` prior to CRQC, after which `pubKey_A`-bound `RescueWithPoKoS` provides `~2^126` Grover security `B06`). 2. **Post-CRQC Long-Range Genesis History Forgery (`B11` + `R4-09` Fix):** * Because Phase 0 (`2021`) through Phase 1A Momentums were signed by classical `Ed25519` Pillar keys, a future CRQC could invert 2021 Pillar keys, forge an alternate pre-PQ chain from Genesis (`Height = 1`) with attacker-controlled `FN-DSA-512` committees, and even broadcast a fresh post-CRQC Bitcoin `OP_RETURN`. * **Normative `v4` Fix (`R4-09`):** At `Spork #14` (`LegacyCryptoSunsetSpork`, activated pre-CRQC), Zenon seals **`SunsetAnchorCheckpoint = (Height_sunset, MomentumHash_sunset, StateRoot_sunset, CommitteeHash_sunset, BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight, BitcoinBlockHash)`** into release `common/params.go` (social/release weak-subjectivity anchor for pruned `go-zenon-v1` nodes) **and** anchors the `99-byte` `ZNN_CKPT_P1` preimage on Bitcoin at **`BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight`**. Requiring the Bitcoin anchor block to precede `MaxPreCRQCBitcoinHeight` prevents post-CRQC Bitcoin `OP_RETURN` spoofing (`Gate ZP-Q25`). 3. **Embedded-Contract Classical Backdoors & `targetMA` Bypass (`B12` + `R4-03` Fix):** * Phase 1E (`Spork #14`) halts `BridgeContract.Redeem`, `SwapContract.RetrieveAssets`, `Pillar.RegisterLegacy`, and `PtlcContract` `{0, 1, 2}` unlocks **strictly at `InclusionMomentumHeight` (`H_inc`)** on both `UserSend` (`ApplySend`) and `ContractReceive` (`GenerateEmbeddedReceive`, overriding `go-zenon-v1`'s `targetMA` `sporkHeight` rewind `R4-03`!). 4. **Proof-System QROM Soundness Collapse (`PQ-03` + `R4-04` Fix):** * Closed via pure-`SHA3-256` `WHIR-SHA3-v1` parameterized at **`>= 256-bit` classical round-by-round soundness** (`224-bit` query + `32-bit` grinding + `256-bit` extension field -> **`~2^-128` QROM soundness** under `CMS19`, `0` `BN254` pairings, `0` `Poseidon2`). 5. **Separable Hybrid Stripping & Peer MITM (`R4-01, M08`):** * Every `v2`/`v3` signature signs `boundDigest32` committing to `[algID] || SHA3-256(resolvedPubKeyWire)` (blocking `0x81 <-> 0x00` stripping/splicing `R4-01`), while `/znn/tls-pq/1.0.0` closes active peer MITM (`M08`). --- ## 3. Peer L1 Survey (2025–2026) > **Plain-English Visual Guide:** For a human-friendly breakdown of why Zenon selected each NIST standard and how it stacks up against Algorand, QRL/Zond, Sui, Aptos, Solana, Ethereum, and Bitcoin, see **[Quantum Algos & L1 Comparison (Visual)](https://0x3639.com/zenon-phase-1/docs/post-quantum/quantum-algorithms-and-industry-comparison)**. ![How Zenon's Quantum Upgrade Compares to Other Blockchains](https://0x3639.com/zenon-phase-1/img/phase1/03-pq-blockchain-comparison.svg) | Ecosystem | Live Primitives vs. Announced / Contingent Roadmaps | Normative Lesson for `Zenon Phase 1 (v4)` | |---|---|---| | **Bitcoin (`BIP-360 P2MR`, `OP_CAT`)** | *Contingent unactivated BIPs `[E4]`*; `BitVM2` `[E3]` uses `P2TR` + `BN254` today. | Classify `FROST` & `BitVM2` as **pre-CRQC transitional vaults**; keep `BIP-360`/`OP_CAT` covenants contingent (`H11`). | | **Solana (2026–2027 PQ Roadmap & Anza `PoKoS`)** | `Transaction v1` (`4,096 B`) + `ed25519-pokos` Plonky3 STARK prototype (`~400 KB` uncompressed). | Apply outer `WHIR-SHA3-v1` rate-decay recursion (`57–86 KiB` at true `2^-128` QROM `R4-04`) and gate mainnet on physical `ZP-Q20` runs (`B07, M11`). | | **Algorand, Sui & Aptos** | Integer-NTT `Falcon` verify and decoupled `Address` / `AuthenticationKey` registries. | `AuthRegistryContract (#14)` decouples 20B `types.Address` from active PQ keys under `H_inc + 1` semantics (`B05, R4-03`). | ================================================================================ CHAPTER 05 / 31: NIST Post-Quantum Signatures (Go 1.27+) & Pure-SHA3 WHIR-SHA3-v1 STARKs FILE: docs/research/pq-signatures-and-pure-hash-starks.md | URL: https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks ================================================================================ # NIST Post-Quantum Signatures (`Go 1.27+`) & Pinned Pure-`SHA3-256` `WHIR-SHA3-v1` STARKs (`v4`) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciling `ZDC-ZP1-HR-001`, `ZDC-QS-DEEZ-HR-001`, and the **Round-4 Independent Cryptographic Audit (`R4-01, R4-04, R4-09`)**, **Zenon Phase 1 `v4`** locks `Go 1.27+`-verified APIs, key-bound non-separable signature transcripts (`boundDigest32`), `32-byte` `fn-dsa v0.3` seed rules, and **true `2^-128` QROM (`2^-256` classical RBR) `WHIR-SHA3-v1` STARK parameters**: > - **`0x01` `ML-DSA-44` (FIPS 204):** Primary wallet default via **`Go 1.27+`** `crypto/mldsa` (`mldsa.NewPublicKey(mldsa.MLDSA44(), rawPub)`, `GOFIPS140 != v1.0.0` KAT self-test `B01`). > - **`0x02` `FN-DSA-512` (Pinned `draft-FIPS-206` / `fn-dsa v0.3` `32B` Seed `R4-09`):** `666 B` signature verified via pure-integer NTT (`mod 12289`); `0.59 ms` ideal / `0.9–1.4 ms` realistic 4-core Pi 5 QC verify; pure-Go `CGO_ENABLED=0` NTRU keygen + signing + verify in `go-zenon-v1`. > - **`0x03` `SLH-DSA-SHAKE-128s` (FIPS 205) & `0x04` Dual-Tree `XMSS-SHAKE_22_256` (SP 800-208):** Pure-Keccak governance/cold-vault tier and `2 Hz` (`2,884 B` sig) zero-lattice emergency validator profile. > - **`0x10` `WHIR-SHA3-v1` (True `2^-128` QROM Pure-`SHA3-256` STARK `R4-04`):** `57–86 KiB` multiproof size (`<= 128 KiB = 131,072 B` single-proof hard cap) using WHIR domain-shift rate decay (`[16, 15, 14]`), `32-bit` PoW grinding + `224-bit` classical query security (`256-bit` classical RBR -> `128-bit` QROM under `CMS19`), `256-bit` extension field, and `<= 8,000` Keccak permutations (`<= 3.5 ms` on Cortex-A76 without `FEAT_SHA3`). --- ## 1. Byte-Exact Post-Quantum Signature Suite & Caching Savings (`B01, M04, N01, R4-01, R4-09`) | Scheme (`algID`) | Standard & Pinned Revision | Keygen Seed | Public Key (`PK`) | Signature (`Sig`) | 1st-Reveal Witness (`PK+Sig`) | Cached Witness (`Sig`) | Witness Savings (`N01`) | Full-Block Savings (`306B` Base, `N01`) | |---|---|:---:|---:|---:|---:|---:|---:|---:| | `Ed25519` (`0x00`) | RFC 8032 *(Sunset in `1E`)* | `32 B` | `32 B` | `64 B` | `98 B` *(v2)* | `65 B` | `33.7%` | `8.2%` | | **`ML-DSA-44` (`0x01`)** | **Final FIPS 204** (`Go 1.27+` `crypto/mldsa`) | **`32 B`** | **`1,312 B`** | **`2,420 B`** | **`3,734 B`** | **`2,421 B`** | **`35.16%`** (`-1,313 B`) | **`32.50%`** (`4,040 -> 2,727 B`) | | **`FN-DSA-512` (`0x02`)** | **Draft FIPS 206** (`fn-dsa v0.3` `32B` seed `R4-09`) | **`32 B`** | **`897 B`** | **`666 B`** | **`1,565 B`** | **`667 B`** | **`57.38%`** (`-898 B`) | **`48.00%`** (`1,871 -> 973 B`) | | **`SLH-DSA-128s` (`0x03`)** | **Final FIPS 205** (`SHAKE256`) | **`48 B`** | **`32 B`** | **`7,856 B`** | **`7,890 B`** | **`7,857 B`** | `0.42%` (`-33 B`) | `0.40%` (`8,196 -> 8,163 B`) | | **`XMSS-SHAKE_22` (`0x04`)** | **Final SP 800-208** *(Validator only)* | `32 B` | `64 B` | `2,884 B` | *(In manifest)* | `2,885 B` | — | — | | `Hybrid Ed+MLDSA44` (`0x81`) | RFC 8032 `AND` FIPS 204 *(Sunset in `1E`; `0x02` or `AuthRegistry` only `R4-01`!)* | `64 B` | `1,344 B` | `2,484 B` | `3,830 B` *(0x02 only)* | `2,485 B` | `35.12%` (`-1,345 B`) | `32.52%` (`4,136 -> 2,791 B`) | *(Note `N01` & `R4-01`: "1st-Reveal Witness" occurs on `Height == 1` for a fresh un-precommitted `0x02` account. Unregistered `0x00` accounts on Path C may ONLY use `0x00`—never `0x81`, preventing third-party `mldsaPub` splicing—and accounts registered via `AuthRegistry` omit `PublicKeyWire` even on their first `v2` block!)* ### Normative Toolchain, Non-Separable Transcript & Draft-Standard Rules (`B01, M04, R4-01, R4-09`) 1. **`Go 1.27+` `crypto/mldsa` & `GOFIPS140` Startup KAT (`B01` Verified):** * `go.mod` pins `go 1.27.0+` (`golang/go#77626` `[E1]`). Because `crypto/mldsa` returns an error under legacy `GOFIPS140=v1.0.0`, `znnd` executes `AssertMLDSAReady()` (`621b16f8...` low-level KAT + `b7444ca3...` bound-transcript KAT) at startup and refuses to boot if disabled. 2. **Non-Separable Key- & Algorithm-Bound Signing Preimage (`boundDigest32`, `R4-01` Fix):** * Because `AccountBlock.ComputeHash()` (`306 B`) and `Momentum.ComputeHash()` (`208 B`) exclude witness bytes, signing raw `Hash[:]` would leave `algID` and partner hybrid keys unbound (enabling `0x81 <-> 0x00` stripping and key-splicing ransomware). Every `AccountBlock v2` and PQ `Momentum v3` signature signs: ```text boundDigest32 = FIPS202_SHA3_256(domainCtx || [0x00] || [algID] || FIPS202_SHA3_256(resolvedPubKeyWire)[32] || msg[32]) ``` 3. **Provisional `FN-DSA-512` (`0x02`) & NIST FIPS 206 Fixed-Point Evolution (`M04, R4-09`):** * `0x02` pins `fn-dsa v0.3` (`32-byte` keygen seed `[E2]`), implemented completely in pure Go (`CGO_ENABLED=0` NTRU tower keygen, emulated-binary64 Gaussian signing, and `0`-FPU integer-NTT verification) to guarantee deterministic cross-client Go/Rust HD wallet derivation (`Gate G9`). * Because NIST's 2025–2026 FIPS 206 draft roadmap shifted toward `32.32`/`64.64` fixed-point keygen/signing (`ePrint 2026/1531`, `2026/1915`), final FIPS 206 will allocate a fresh `algID = 0x05` (`m/44'/73404'/1'/5'/'`) without breaking existing `0x02` accounts. --- ## 2. True `2^-128` QROM Parameterization & Cortex-A76 Timing of `WHIR-SHA3-v1` (`B07, M10, R4-04`) Why did `ZNN-SPEC-PHASE1-v4` upgrade `WHIR-SHA3-v1` from `16-bit` grinding + `112-bit` query security (`[18, 14, 10]`) to **`32-bit` grinding + `224-bit` classical query security (`[16, 15, 14]` domain-shift rate decay + `256-bit` extension field)**? * **Closing the `CMS19` QROM Square-Root Gap (`R4-04`):** Under the Fiat-Shamir / BCS transform in the **Quantum Random Oracle Model** (Chiesa, Manohar, Spooner, *FOCS 2019*), a quantum prover attacks per-round transcript grinding and Merkle query indices jointly via Grover / state restoration: `112 + 16 = 128` *classical* bits yields only `sqrt(2^128) = 2^64` quantum query resistance (`16-bit` grinding gives `8` quantum bits!). Achieving **`<= 2^-128` QROM soundness** (`~2^128` quantum `SHA3-256` queries) requires **`>= 256` bits of classical round-by-round soundness** (`224-bit` classical query security + `32-bit` classical grinding = `112 + 16 = 128` quantum bits) plus a **`>= 256-bit` extension field** (`Goldilocks^4` or `KoalaBear^8`) so OOD/sumcheck errors also stay `<= 2^-256` classical (`<= 2^-128` QROM). * **True WHIR Domain-Shift Rate Decay (`Arnon et al., EUROCRYPT 2025` `[R49]`, `R4-04`):** On the outer $2^{16}$-row recursion wrapper with initial blowup $16\times$ ($\rho_0 = 2^{-4}$, $2^4$-bundled coset tree depth `16`), shrinking evaluation domains by $2^1$ per $2^4$-folding round yields depths **`[16, 15, 14]`** and decaying rates **$\rho_0 = 2^{-4}, \rho_1 = 2^{-7}, \rho_2 = 2^{-10}$**: * **Conjectured Capacity (`[56, 32, 23] = 111` queries + `32-bit` grind = `256b` classical / `128b` QROM):** `~1,110` deduplicated `SHA3-256` multiproof hashes (`34.7 KiB`) + `18.0 KiB` `256-bit` extension evaluations + `4.0 KiB` headers = **`~56.7 KiB`**. * **Unconditional Proven Johnson Bound (`[112, 64, 45] = 221` queries + `32-bit` grind = `256b` classical / `128b` QROM):** `~1,989` multiproof hashes (`62.2 KiB`) + `20.0 KiB` evaluations + `4.0 KiB` headers = **`~86.2 KiB`** (comfortably inside the **`90 KiB` planning figure** and **`128 KiB` = `131,072 B` hard cap**!). * **Honest Cortex-A76 (`ARMv8.2` Without `FEAT_SHA3`) Verifier Budget (`R4-04`):** Raspberry Pi 5's Cortex-A76 (`2.4 GHz`) lacks ARMv8.4 `FEAT_SHA3` hardware instructions (`~380 ns` per scalar 64-bit `Keccak-f[1600]` in pure Go). Because WHIR's `111–221` queries require only **`~2,200–3,500` Keccak permutations** (`~0.85–1.35 ms` typical), tightening **`MaxSHA3KeccakPermutations = 8,000`** bounds worst-case single-core Pi 5 verification to **`<= 3.5 ms`** (`< 0.5 ms` on Apple Silicon / ARMv8.4+ with `FEAT_SHA3`), subject to physical **`Gate ZP-Q20`** qualification (`B07, M11`). ================================================================================ CHAPTER 06 / 31: DAG-BFT Evaluation: Direct 1-Hop Mesh, Mahi-Mahi (stride=5 Default) & Steelhead (ZP-Q11) FILE: docs/research/dag-bft-comparison.md | URL: https://0x3639.com/zenon-phase-1/docs/research/dag-bft-comparison ================================================================================ # Comparative Evaluation: Narwhal/Tusk, Mysticeti, Starfish, Bluestreak, Mahi-Mahi & Steelhead (`v4`) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Zenon Phase 1 enforces three simultaneous consensus requirements: **(1) Mandatory Asynchronous Liveness (`Whitepaper §IV-B`)**, **(2) Sovereign Raspberry Pi 5 Validation (`<= 25 Mbps` physical TX, `<= 15 Mbps` total control wire)**, and **(3) 100% Post-Quantum Security (`0` `BLS12-381` signatures or coins)**. Reconciling `ZDC-ZP1-HR-001` (`M01, B01–B04`) and Round-4 Finding **`R4-05`** (which caught the characteristic `2` vs `mod 8,380,417` mismatch and `361.8–1,981 Mbps` `RBC` blowup in `v2/v3`'s Module-SIS `RLC` coin), `v4` pairs **`Mahi-Mahi` (`Profile C-AS` non-overlapping `stride = 5` waves = `1.0 Hz` coin)** + **`ZP-Q11`-gated `Steelhead` (`Profile B`)** over a **direct 1-hop validator mesh (`3.83–7.65 Mbps` base TX)** with **100% Pure-`SHA3-256` `HashRand-PQ` (`M_coin = 256`, `GF(2^256)` salt-free `32B` shares, `0.69–1.34 Mbps` `AVID-FP` dealing, `1.49–2.54 Mbps` `1.0 Hz` reveal — `0` lattice assumptions even in `XMSS` emergency mode!)**. --- ## 1. Exact Control-Plane RX & TX Accounting on a Direct 1-Hop Validator Mesh (`M01` Closed) ![DAG Ancestry Topologies: Raw Dense vs. Compact-Dense vs. Bluestreak Sparse](https://0x3639.com/zenon-phase-1/img/dag/dense-vs-compact-vs-sparse.svg) Addressing `ZDC-ZP1-HR-001 (M01)`: in a naive 6-peer GossipSub mesh where every Pillar re-forwards all `990` received vertices/s (`990 * 840 B * 6 * 8`), egress hits **`39.92 Mbps`**, overflowing a Pi 5's `25 Mbps` uplink! **Normative `v4` Topology (`N <= 100` Pillars) — Direct 1-Hop Point-to-Point Validator Mesh:** * Just like `Mysticeti` and `Starfish` validator meshes, each active Pillar sends **only its own authored vertex** directly (`1-hop` over persistent `/znn/tls-pq/1.0.0` `X25519MLKEM768` streams) to the `N - 1` active Pillars (**zero multi-hop GossipSub vertex re-forwarding!**). * Using exact `840-byte` non-coin vertices (`96B` header + `13B` bitmap + `64B` roots + `667B` `FN-DSA-512` sig) and `1.15x` transport framing (`1` Mbps = `10^6` bits/s): | Topology & Round Pace (`FN-DSA-512` + `13B` Bitmap) | Vertex Size | Raw RX (`N-1` peers) | Framed RX (`1.15x`) | Framed 1-Hop Base TX | With `1 Hz` (`stride = 5`) `HashRand-PQ` Coin (`R4-05`) | Fits Pi 5 (`100 RX / 25 TX / 15 Control`)? | |---|---:|---:|---:|---:|---:|:---:| | `N = 30`, `10 Hz` (`1-hop` direct mesh) | `831 B` | `1.928 Mbps` | `2.217 Mbps` | `2.217 Mbps` | **`3.71 Mbps`** (`2 Hz` coin) | **PASSES (`11.3 Mbps` headroom)** | | **`N = 100`, `5 Hz` Default WAN (`stride = 5`, `1 Hz` coin)** | **`840 B`** | `3.326 Mbps` | `3.825 Mbps` | **`3.825 Mbps`** | **`5.32 – 6.37 Mbps`** (`+1.49..2.54` coin) | **PASSES (`8.6+ Mbps` headroom)** | | **`N = 100`, `10 Hz` High-Tempo (`stride = 5`, `2 Hz` coin)** | **`840 B`** | `6.653 Mbps` | `7.651 Mbps` | **`7.651 Mbps`** | **`10.63 – 12.72 Mbps`** (`+2.98..5.07` coin) | **PASSES (`<= 15 Mbps` control cap)** | | *Rejected:* `N = 100, 10 Hz` 6-Peer GossipSub Relay | `840 B` | `39.92 Mbps` | `45.90 Mbps` | `47.55 Mbps` | `> 50 Mbps` | **FAILS (`M01` countermodel — forbidden!)** | | **Emergency `XMSS-SHAKE_22` (`0x04`) at `2 Hz` (`0.4 Hz` coin)** | **`3,058 B`** | `4.844 Mbps` | `5.570 Mbps` | **`5.570 Mbps`** | **`6.17 – 6.59 Mbps`** (`100%` zero-lattice!) | **PASSES (`2 Hz` zero-lattice mode)** | *(For `N = 200–400+` future committees, validators either use `Q1` Sentinel fanout trees or **`Bluestreak` Sparse DAG (`Profile P3`)** once qualified with a weighted PQ async coin under `ZP-Q14`.)* --- ## 2. Protocol Evaluation & Pure-`SHA3-256` `HashRand-PQ` Common Coin (`B01–B04`, `H10`, `R4-05`) 1. **Certified DAGs (`Narwhal + Tusk` `[R2]`):** Rejected for per-vertex `MomentumPQQC` overhead (`44.6 KiB` on every vertex = `357 Mbps`); retained only at the `1 Hz` public `Momentum v4` certification boundary (`0.65 Mbps` framed `H09`). 2. **Partial-Synchrony Uncertified DAGs (`Mysticeti-C`, `Starfish-Speed`, `Bluestreak`):** Retained as testbed controls and `N > 400` research tracks (`ZDC-MM-ER-01 §9.1`), ineligible standalone without an asynchronous coin. 3. **Source-Native `Mahi-Mahi` (`Profile C-AS` `stride = 5`) + `Steelhead` (`Profile B` `[R31]`) with Pure-`SHA3` `HashRand-PQ` (`R4-05` Fixed):** * **Why `v2/v3`'s Module-SIS `RLC` Coin Was Replaced (`R4-05`):** Mixing `GF(2^256)` (`char 2` XOR) with the FIPS 204 ring `R_q` (`mod 8,380,417`) violated additive homomorphism, `1,280 B` (`< 2` `R_q` elements) could not hold positional Module-SIS openings, and full-matrix `RBC` of `100 × 32 MiB` consumed `361.8 Mbps` (`1x`) to `1,981 Mbps` (`3x` `RBC` echo). * **`v4` Pure-`SHA3-256` `HashRand-PQ` (`Das, Xiang, Kokoris-Kogias, Ren CCS '24` `[R54]` + `AVID-FP` `[E7]`):** * Voting uses **`M_shares = 4,096`** (`Q_vote = 2,731`, `F_Q = 1,365`), while the coin quantizes stake (with `5%` single-seat cap `c_i <= 13`) into congruence-exact **`M_coin = 256 = 3 * 85 + 1`** (`F_coin = 85`, `Q_coin = 171`, `T_coin = 86`, `2 * 171 - 256 == 86 == T_coin`). * Dealers send each Pillar **only its own encrypted `GF(2^256)` (`32 B`) shares** (`1-hop` PtP) and disperse a compact column-major `260 × 100 × 32 B` (`812.5 KiB`) `LeafHashManifest` + `4` degree-`<= 85` blinding polynomials (`2^-512` QROM degree soundness!) via coin-free `SHA3-256` `AVID-FP` over `256 s` (**`0.69–1.34 Mbps` total background TX / `0.73–1.23 Mbps` RX**, **`2.03 MiB` raw dealer RAM**!). * Because a single `GF(2^256)` Shamir evaluation already carries **`256` bits of conditional min-entropy** given `<= 85` Byzantine shares, `SHA3-256(domain || d || w || j || shares)` achieves **`128-bit` Grover hiding with `0` salt bytes**, and pre-staged `LeafHashManifest`s require **`0` Merkle branch bytes** at online reveal (`1,638–2,785 B` avg = `1.49–2.54 Mbps` TX at `1.0 Hz`; `8,320–14,144 B` max `5%`-seat = `7.58–12.89 Mbps` TX!). * **Explicit Refinement Proof Obligation (`H10`):** Mainnet activation of `Profile B` (`Steelhead`) remains gated on mechanized TLA+/Lean refinement (`G3–G5`, `ZP-Q11–Q13`, `ZP-Q28`). ================================================================================ CHAPTER 07 / 31: First-Principles Capacity & The 5 Concentric Scaling Regimes (v4 Reconciled) FILE: docs/research/throughput-and-scaling-math.md | URL: https://0x3639.com/zenon-phase-1/docs/research/throughput-and-scaling-math ================================================================================ # First-Principles Capacity: From Sovereign PQ Pi 5 Core to Unbounded Edge TPS > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Monolithic L1 replication cannot scale to millions of post-quantum transactions per second without evicting residential validators. **Zenon Phase 1 (`v4`)** achieves both **Raspberry Pi 5 L1 sovereignty (`<= 25 Mbps` TX, `<= 100 Mbps` RX, `<= 450 GB` rolling NVMe)** and **unbounded global throughput** via **5 concentric physical scaling regimes**: > - **Regime 0a (Sovereign Feeless PQ L1 Admission):** **`132` `FN-DSA-512` / `67` `ML-DSA-44` blocks/s** at `1.0x` Dynamic Plasma equilibrium (**`264` `FN-DSA-512` / `134` `ML-DSA-44` blocks/s burst**) under `MaxBasePlasmaInMomentum = 8,400,000` (`H01`), plus `256 KiB/s` (`2` × `~86 KiB` `2^-128`-QROM STARKs/s) in the dedicated `ProofWitness` lane (`H02, R4-04`). *(Enterprise `16–32c` single-node verifier throughput reaches `100k–250k` PQ blocks/s in isolated benchmarks, explicitly separated from global Pi 5 consensus admission.)* > - **Regime 1 (Unsharded `DA_BATCHED` `Zeno` Rollup):** **`~10,400,000 TPS`** state-diff wire ceiling (`12 B/tx` on `1 Gbps` Sentinel DA mirror; `< 1%` Pi 5 Pillar load via `~86 KiB` `WHIR-SHA3-v1` STARKs `H03, R4-04`). > - **Regime 2 (Sharded Sentinel `2D AVID` + DAS):** **`400,000,000+ TPS`** data-plane ceiling scaling `O(S)` across `SHA3-256` erasure-coded Sentinel cohorts. > - **Regime 3 (Recursive Pure-Hash STARK Anchor):** **`200,000` verified ops/s** under the conservative L1 `256 KiB/s` proof lane (`2` proofs/s × `100k` ops/proof), **`13.56M` ops/s** at Pi 5 `100 Mbps` proof RX, and **`114M–260M` ops/s** 4-core Pi 5 Cortex-A76 CPU verifier ideal (`1.5–3.5 ms`/proof without `FEAT_SHA3`, `H04, R4-04`). > - **Regime 4 (Unbounded P2P Edge `d_channels`):** **Strictly Unbounded (`O(Active Channel Pairs)`)**—peer-to-peer `FN-DSA-512` Commit Channels (`20–100` sequential RTT updates/s or `1,280–6,400` pipelined updates/s per pair `M06`) and `SHA-256`/`SHA3-256` `HTLC`s (`B07, R4-08`) consume **`0` Pillar bytes and `0` Sentinel bytes per off-chain hop**. --- ## 1. Summary of the 5 Concentric Physical Scaling Regimes (`v4` Reconciled) | Scaling Regime | Active Physical / Consensus Bound | Post-Quantum First-Principles Equation | Qualified Capacity Ceiling | |---|---|---|---| | **0a. Sovereign PQ L1 Consensus** *(Pi 5 `RFC-00`: `4c, 8GB, 100/25 Mbps, 1TB NVMe`)* | `Momentum v4` (`1.0 s`) Two-Lane Dynamic Plasma (`4.2M` `1.0x` target / `8.4M` burst + `256 KiB/s` `ProofWitness`) | `FN-DSA-512` cached (`31,757` plasma, `~973 B`) or `ML-DSA-44` cached (`62,625` plasma, `~2,727 B`) | **`67 – 132` PQ L1 txs/s (`1.0x`)** / **`134 – 264` burst** + **`2` STARK batches/s** (`H01, H02`) | | **0b. Enterprise Single-Node Verifier** *(`16–32c` / `1–10 Gbps` benchmark)* | Multi-core `FN-DSA-512` / `ML-DSA-44` verify CPU + `256`-striped `AccountPool` IOPS | `32` cores × `~8,000–28,000` PQ verifies/s/core *(non-consensus engine ceiling only)* | **`100,000 – 250,000` PQ blocks/s** *(engine ceiling, NOT L1 admission `H01`)* | | **1. Unsharded `DA_BATCHED` `Zeno` Rollup** *(Off-chain sequencer + `1 Gbps` Sentinel DA)* | Single-Sentinel `1 Gbps` (`125 MB/s`) state-diff stream (`H03`) | `(125 MB/s) / (12 B/tx compressed state-diff)`; anchored by `57–86 KiB` `WHIR-SHA3-v1` STARK | **`~10,400,000 TPS`** *(data-plane ceiling; prover-gated)* | | **2. Sharded Sentinel `2D AVID` + DAS** *(`SHA3-256` Reed-Solomon across `S` cohorts)* | Aggregate Sentinel shard bandwidth (`S × B_shard`) | `(100 shard cohorts × 50 MB/s) / (12 B/tx)` *(scales linearly `O(S)` with Sentinels)* | **`400,000,000+ TPS`** *(sharded DA ceiling; prover-gated)* | | **3. Recursive Pure-Hash STARK Anchor** *(Validium / Sovereign DA)* | Three explicit sub-bounds (`H04, R4-04`): L1 `256 KiB/s` proof lane vs Pi 5 `100 Mbps` RX vs 4-core `1.5–3.5 ms` Cortex-A76 CPU | `2` proofs/s (L1 lane), `135.6` proofs/s (`100 Mbps`), or `1,140–2,660` proofs/s (4c CPU) × `100k` ops/proof | **`200k` ops/s (L1 lane)** / **`13.56M` (Pi 5 NIC)** / **`114M–260M` (Pi 5 4c CPU)** | | **4. Edge `d_channels` & `HTLC` Mesh** *(Bilateral & multi-hop routed P2P links)* | **`0` bytes of L1 consensus or Sentinel DA per off-chain hop** | `O(Active Pairs) × (20–100 seq RTT OR 1,280–6,400 pipelined W=64 updates/s/pair)` (`M06`) | **Strictly Unbounded Edge TPS** *(dispute safety requires `Delta_party < T_dispute / 2` `B06`)* | --- ## 2. Reconciling Sovereign Pi 5 Storage, Witness Sidecars & RAM Endurance (`B08, R4-02, R4-07`) Under `Momentum v4` (`1.0 s` cadence = `86,400` Momentums/day = `31,536,000` Momentums/year), naively retaining every `44.8 KiB` `MomentumPQQC` (`1.41 TB/yr`) and every historical `AccountBlock` witness would overflow a `1 TB` Raspberry Pi 5 NVMe within 12 months. **`ZNN-SPEC-PHASE1-v4` bounds Sovereign Pi 5 storage at `<= 450 GB` steady-state** without breaking `Momentum.ChangesHash` replay: 1. **`14`-Day Intermediate `MomentumPQQC` Compaction (`16.4 MB/yr` Permanent Header Chain):** Sovereign Pillars retain per-second `44.8 KiB` `MomentumPQQC` certificates for the rolling `14`-day (`1,209,600`-Momentum) sync window (`~54.2 GB` ring buffer), then prune intermediate QCs while keeping **every `Momentum v4` header (`~360 B` = `11.3 GB/yr`)**, every daily **`EpochTerminalQC` (`365 × 44.8 KiB = 16.4 MB/yr`)**, and optional epoch `WHIR-SHA3-v1` header-chain transition STARKs (`H13`). 2. **Witness-Separated `[0x11]` Persistence (`14d` Witness Compaction + `30d` Native Block Retention, `R4-07` Fix):** In Phase 0 `go-zenon-v1`, `[0x03]||addr||[0x02]||be_u64(h)` inside `Momentum.ChangesHash` stored full `SerializeProto` bytes including witnesses—so pruning witnesses at day `14` would break `Momentum.ChangesHash` verification for days `15..30`! For `AccountBlock v2` (`Spork #10`+), `[0x02]` stores the **witness-stripped body** plus fixed `32-byte` `WitnessCommitment`, while raw witness bytes live in Pebble namespace **`[0x11] || blockHash[32]`** (outside `MomentumChanges`). Sovereign Pillars compact `[0x11]` witnesses after `14` days, retain native `AccountBlock` bodies for `30` days (`<= 250 GB`), **and permanently retain `Height in {1, 2}` blocks of unrotated `0x00` accounts (`<= 200 MB`)** so `O(1)` `PoKoS` exposure checks never become `UNKNOWN` (`R4-02`). 3. **`32-Byte` `pubKeyHash` RAM Pinning (`0` Multi-GB Key Bloat):** The lock-free 256-shard `HotStateCache` pins **only the `32-byte` `SHA3-256(PublicKeyWire)` digest** in RAM (`320 MB` for `10M` active accounts), reading full `PublicKeyWire` bytes on demand from Pebble's bounded block cache (`AccountStore[0x09]`). 4. **Refundable Anti-Dust New-Account Reserve (`MinNewAccountReserve`):** Creating a brand-new `AccountStore` leaf via first `UserReceive` requires a minimum initial balance (`1 ZNN` or `10 QSR`, 100% spendable/refundable upon account sweep), preventing zero-cost `Equi-X` Sybil state-explosion attacks against `smt-v1`. --- ## 3. Why `DA_BATCHED` Domains (`H03`) & Edge `d_channels` (`B06, M06, R4-08`) Scale Cleanly 1. **`L1_NATIVE` vs. `DA_BATCHED` `Zeno` Domains (`H03`):** * **`L1_NATIVE` inbox domains** consume individual L1 `AccountBlock`s (`UserSend` -> `SettlementContract #13`) and are explicitly bounded by Regime 0a (`67–264` L1 inputs/s). * **`DA_BATCHED` rollup domains** accept user PQ transactions directly over an off-chain P2P/sequencer network, publish compressed `12 B/tx` state diffs + batch commitments to **Sentinel `2D AVID` DA**, and submit **one `<= 128 KiB` `WHIR-SHA3-v1` `SubmitBatch` proof** on L1 (`H02`)—decoupling domain TPS from L1 `AccountBlock` count! 2. **Sequential vs. Pipelined Edge `d_channels` (`M06`) & Dispute Assumption (`B06, R4-08`):** * Over a `10–50 ms` WAN link, strict stop-and-wait full-duplex signing yields **`20–100` sequential updates/s per pair** (`1 / RTT`), while **pipelined sliding-window updates (`W = 64` in-flight monotonic states)** achieve **`1,280–6,400` micro-payments/s per pair** (`FN-DSA-512` verify takes `~36 µs`). * Across `K` independent account pairs, aggregate edge throughput is **`O(K)` unbounded** (`0` Pillar/Sentinel bytes per hop). Unilateral L1 dispute safety holds under **`Delta_party < T_dispute / 2`** (`T_dispute >= 86,400 s`), with immediate in-`CLOSING` `ClaimHTLC` preimage recording and decoupled `FinalizeBasePayouts` (`R4-08`). *(See [Regime 4 Unbounded Edge Channels](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels) for the complete `d_channels` state machine and `1,538 B` wire vector.)* ================================================================================ CHAPTER 08 / 31: How Zenon Picked Its Quantum Algorithms & How It Compares to Other Blockchains FILE: docs/post-quantum/quantum-algorithms-and-industry-comparison.md | URL: https://0x3639.com/zenon-phase-1/docs/post-quantum/quantum-algorithms-and-industry-comparison ================================================================================ # How Zenon Picked Its Quantum Algorithms & How It Compares to Other Blockchains > **[TIP: Plain-English TL;DR (Click Any Graphic to Expand & Zoom)]** > * **Why not just pick one quantum algorithm?** Because no single post-quantum signature wins on every trade-off. Zenon Phase 1 pairs **NIST-standardized lattice signatures** (`ML-DSA-44` for everyday wallets + compact `FN-DSA-512` for fast consensus and instant mobile verification) with **pure hash-based safety nets** (`SLH-DSA-128s` for cold vaults and `XMSS` for emergency validator backup). > * **Are they NIST recommended?** **Yes.** Every primitive in Zenon's stack is either a **finalized NIST standard** (`FIPS 204`, `FIPS 205`, `FIPS 203`, `SP 800-208`, `FIPS 202`) or an **active NIST-selected draft** (`Draft FIPS 206` for `FN-DSA-512`, explicitly guarded with provisional version IDs). > * **Built for iPhone proof verification:** Validators do not need to run on tiny hardware, but **everyday users need to verify balances, STARK receipts, and consensus Quorum Certificates directly on an iPhone** without trusting a centralized RPC server. Keeping signatures compact (`666 B` consensus sigs) and proofs tiny (`1.2 KB` state proofs, `< 1 ms` pure-SHA3 STARKs on Apple Silicon / `<= 3.5 ms` on Cortex-A76) makes direct phone verification effortless. > * **Keep your seed, address, and stakes:** Like Sui and Aptos, Zenon rotates keys **in place** (`AuthRegistry #14`) — holders keep their exact 24-word recovery phrase, existing address, and locked Stakes/Pillars/Sentinels. Even untouched wallets can rescue funds years later via pure-hash zero-knowledge proofs (`Ed25519-PoKoS`). --- ## 1. Why Zenon Uses a 4-Tool NIST Toolkit (Not Just One Algorithm) Today's blockchains rely on elliptic-curve signatures (`Ed25519`, `secp256k1`, `BLS12-381`) that are tiny (`64 B`) and fast, but completely broken by a future Cryptographically Relevant Quantum Computer (CRQC) running Shor's algorithm. Post-quantum signatures involve real engineering trade-offs between **signature size**, **verification speed**, **implementation simplicity**, and **mathematical diversity**. Rather than forcing every role onto one compromised algorithm, Zenon Phase 1 tags every key and signature with a 1-byte algorithm ID (`algID`) and assigns each NIST standard to the job it does best: ![How Zenon Picked Its Quantum-Safe Toolkit — NIST Standards Explained](https://0x3639.com/zenon-phase-1/img/phase1/02-zenon-pq-suite-for-humans.svg) ### Each Tool in Plain English 1. **`ML-DSA-44` (`0x01`, CRYSTALS-Dilithium) — The Everyday Workhorse** * **What it protects:** Default user wallets and P2P node identities. * **Why it won:** It is **NIST's primary general-purpose post-quantum signature standard (Final FIPS 204)**. It uses straightforward integer math (no floating-point edge cases), caches public keys on-chain (`AccountStore[0x09]`) to shrink repeat transactions by `35.16%`, and ships natively inside **Go 1.27+'s standard library (`crypto/mldsa`)** — zero third-party crypto dependencies. 2. **`FN-DSA-512` (`0x02`, Falcon) — The Compact Speedster** * **What it protects:** Phase 1B 1-second Meta-DAG consensus (`Momentum-Mahi`) and an opt-in compact wallet tier. * **Why it won:** Signatures are **`3.6×` smaller** than `ML-DSA-44` (`666 B` vs `2,420 B`) and verify in **`~35 µs`** using pure-integer NTT math (zero floating-point instructions during verification). That keeps validator mesh traffic under `4 Mbps` for 100 Pillars, halves Plasma costs for compact wallets, and lets an **iPhone verify consensus Quorum Certificates in under a millisecond**. * **Honest Draft Guardrail:** Because NIST FIPS 206 is still finalizing, `0x02` is explicitly marked **provisional** and pinned to `fn-dsa v0.3` test vectors. Algorithm IDs are immutable once live — if final FIPS 206 adjusts wire bytes, Zenon cleanly allocates a fresh ID (`0x05`) instead of breaking existing keys. 3. **`SLH-DSA-SHAKE-128s` (`0x03`, SPHINCS+) — The Hash-Only Safe** * **What it protects:** Long-term cold vaults, treasuries, and network governance (`SporkAddress`). * **Why it won:** Built **100% from Keccak (`SHAKE256`) hashing — zero lattice assumptions**. Even in the worst-case scenario where a future math breakthrough weakened lattice cryptography, cold vaults and governance remain completely untouched. The trade-off is larger signatures (`7,856 B`), which barely matters for rare, high-value vault spends. 4. **`XMSS-SHAKE_22_256` (`0x04`) + `ML-KEM-768` + Pure-`SHA3` STARKs — Belt + Suspenders** * **`XMSS` (NIST SP 800-208):** Gives validator consensus its own zero-lattice emergency fallback (`2 Hz` degraded pace with `fdatasync` WAL leaf protection) so the chain can keep finalizing even if lattices were ever compromised. * **`ML-KEM-768` (Final FIPS 203):** Runs inside Go's native `X25519MLKEM768` TLS 1.3 handshake on Day 1, blocking *Harvest-Now-Decrypt-Later* eavesdropping on node traffic immediately. * **Pure `SHA3-256` `WHIR-SHA3-v1` STARKs (`0x10`):** Powers dormant wallet seed rescue (`Ed25519-PoKoS`) and `Zeno` rollup settlement using only `FIPS 202` `SHA3-256` — zero elliptic-curve pairings (`BN254`) and zero newer algebraic hashes (`Poseidon2`). --- ## 2. Why This Matters for Mobile (iPhone) Proof Verification A Pillar validator can run on standard server hardware — decentralizing Zenon does **not** require forcing every validator onto a pocket board. What truly protects everyday sovereignty is **making sure an iPhone can verify the chain itself without trusting any centralized server or RPC provider**: * **Instant Balance & State Proofs (`1.2 KB`):** Every Momentum commits a canonical `SHA3-256` Sparse Merkle Tree (`smt-v1`) `StateRoot`. Your phone checks a `1.2 KB` proof directly against the header. * **Sub-Millisecond Consensus Checks (`FN-DSA-512`):** Compact `666 B` Quorum Certificate signatures mean a mobile wallet downloads only **`~16.4 MB/year`** of `EpochTerminalQC` checkpoints and verifies each certificate in `< 1 ms` with pure-integer arithmetic. * **Fast Rollup & Rescue Proofs (`< 1 ms` on iPhone / `<= 3.5 ms` on Pi 5):** Pure-`SHA3-256` `WHIR-SHA3-v1` STARK receipts (`57–86 KiB` at full `2^-128` QROM security, `<= 128 KiB` hard cap, `MaxSHA3KeccakPermutations = 8,000`) verify in sub-millisecond time on modern Apple Silicon with `FEAT_SHA3` (`<= 3.5 ms` worst-case on Cortex-A76) — zero elliptic curves, zero trusted setups. --- ## 3. NIST Standardization Status at a Glance | Zenon Role (`algID`) | Algorithm | NIST Standard | Status | Math Family | |---|---|---|---|---| | **Default Wallets & P2P ID** (`0x01`) | `ML-DSA-44` (Dilithium) | **FIPS 204** | **Final Standard** (Aug 2024) — Primary NIST recommendation | Lattice (Module-LWE / SIS) | | **Compact Tier & Consensus** (`0x02`) | `FN-DSA-512` (Falcon) | **Draft FIPS 206** | **NIST-selected / Draft** (pinned provisional; immutable `algID`) | Lattice (NTRU) | | **Cold Vaults & Governance** (`0x03`) | `SLH-DSA-SHAKE-128s` (SPHINCS+) | **FIPS 205** | **Final Standard** (Aug 2024) — Stateless hash backstop | Hash-based (Stateless) | | **Emergency Consensus** (`0x04`) | `XMSS-SHAKE_22_256` | **SP 800-208** | **Final Recommendation** (Oct 2020) | Hash-based (Stateful) | | **P2P TLS & `AVSS` Encryption** | `ML-KEM-768` (Kyber) | **FIPS 203** | **Final Standard** (Aug 2024) — Primary NIST KEM | Lattice (Module-LWE) | | **Hashing, `smt-v1` & STARKs** (`0x10`) | `SHA3-256` / `SHAKE256` | **FIPS 202** | **Final Standard** (2015) | Symmetric / Sponge | --- ## 4. How Zenon Compares to Other Blockchains Across the industry, major Layer-1 ecosystems are converging on the exact same core lessons — **NIST standards, accounts-first phasing, decoupled in-place key rotation, and hash-based fallbacks** — while making very different trade-offs around hardware, throughput, and dormant wallet recovery. ![How Zenon's Quantum Upgrade Compares to Other Blockchains](https://0x3639.com/zenon-phase-1/img/phase1/03-pq-blockchain-comparison.svg) ### Where Zenon Aligns with Peer L1s — and Where It Goes Further 1. **Accounts First, Consensus Second (Same Sequence as Solana & Sui):** * User funds face the immediate *long-exposure key* risk, so upgrading wallets and in-place key rotation (`Phase 1A`) ahead of the consensus overhaul (`Phase 1B`) protects holders first while keeping every upgrade independently testable. 2. **Dual-Family Resilience (Same Core Pattern as Sui):** * Pairing a fast **lattice default** (`ML-DSA`) with a **pure-hash vault option** (`SLH-DSA`) prevents a single mathematical breakthrough from compromising long-term savings — while avoiding the `7.9 KB` everyday transaction bloat of a hash-only design like Aptos `AIP-137`. 3. **In-Place Key Rotation Without Moving Funds (Same UX as Sui & Aptos):** * Through [`AuthRegistryContract (#14)`](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation), users, Pillars, and Sentinels attach a quantum-safe key directly to their existing `z1...` address without unstaking, revoking collateral, or migrating balances (unlike UTXO chains like Bitcoin where coins must be moved into new outputs). 4. **End-to-End Quantum Closure (`Spork #14`) & Compressed Dormant Rescue:** * Zenon adopts the same **`Ed25519-PoKoS`** seed-rescue insight pioneered by Solana/Anza (`~400 KB` uncompressed prototype), adding `WHIR-SHA3-v1` recursion (`57–86 KiB` analytical target at `2^-128` QROM security, `≤ 128 KiB` cap) and binding the full `32 B` `pubKey_A` for exposed accounts via an `O(1)` legacy exposure resolver. * Beyond wallets, `Spork #14` explicitly closes **every remaining curve surface**: P2P transport (`X25519MLKEM768` + `ML-DSA-44`), legacy embedded-contract ECDSA paths (`BridgeContract`, `SwapContract`, `PtlcContract`), and post-CRQC genesis history forgery via a Bitcoin-anchored **`SunsetAnchorCheckpoint`** bounded by `MaxPreCRQCBitcoinHeight`. --- ## Dive Deeper into the Technical Specifications * **Ready to build?** [`go-zenon-v1` Post-Quantum Validator Implementation Spec (`ZNN-IMP-PQ-V1`)](https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec) * **How wallets & Pillars rotate in place:** [0x02 PQ Addresses & `AuthRegistryContract (#14)`](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation) * **Exact byte sizes, Go 1.27 APIs & STARK math:** [NIST Post-Quantum Signatures & `WHIR-SHA3-v1` STARKs](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks) * **Threat model & security bounds:** [Quantum Threat Model & Peer L1 Survey](https://0x3639.com/zenon-phase-1/docs/research/quantum-threat-and-industry-survey) ================================================================================ CHAPTER 09 / 31: 0x02 PQ Addresses, AuthRegistryContract (#14), H_inc+1 Activation & Wallet KDF FILE: docs/post-quantum/addresses-and-key-derivation.md | URL: https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation ================================================================================ # `0x02` PQ Addresses (`z1q{2,f,g,t}`), `AuthRegistryContract` (`#14`), `179B` PoP & Wallet KDF > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Keep `types.Address` at **exact 20 bytes (`z1q...` 40-char Bech32)** so all embedded contracts, ABI words, `AccountHeader`s (`60 B`), `smt-v1` storage keys, and third-party exchange `^z1q` regexes remain 100% compatible! Introduce user class byte **`0x02`** (`PQUserAddrByte`, encoding deterministically as **`z1q2... / z1qf... / z1qg... / z1qt...`** — `N02` fix), enforce an explicit `{0x00, 0x02}` sender class allowlist (`M12` fix), add optional **`PrecommitKey`** for `256-bit` cold-vault binding (`B05` fix), upgrade **`AuthRegistryContract (#14)`** with explicit `expectedRotationNonce` + `ErrAuthNonceOverflow` + **`179-byte` `GenesisHash`-bound Proof-of-Possession (`B03, M06` fix)** evaluated at **`InclusionMomentumHeight` (`R4-03` fix)**, and derive PQ keys cleanly using **`Go 1.27+` `crypto/mldsa` and `32-byte` `fn-dsa v0.3` seeds (`B01, M05, R4-09` fix)**. --- ## 1. Preserving the 20-Byte `types.Address` Invariant, Bech32 Prefixes (`N02`) & Class Allowlist (`M12`) In `go-zenon-v1/internal/types/address.go:11-28`, `Address` is a `[20]byte` value type encoded in BIP-173 Bech32 with `HRP = "z"` (`40` characters total). ### Exact 8-to-5 Bit Bech32 Prefix Table (`N02` Verified) In Bech32 (`CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"`), the first 5-bit data symbol encodes the top 5 bits of `addr[0]`, and the second 5-bit symbol encodes `((addr[0] & 0x07) << 2) | (addr[1] >> 6)`: | `addr[0]` | Constant Name | Exact Bech32 Prefix Set | Sender Class Rule (`M12` Fix) | |:---:|---|---|---| | `0x00` | `UserAddrByte` | **`z1qp...`, `z1qq...`, `z1qr...`, `z1qz...`** | Valid user sender (legacy `0x00` sigs disabled at `Spork #14`; rotated `AuthRegistry` PQ accounts remain valid forever!) | | `0x01` | `ContractAddrByte` | **`z1q8...`, `z1q9...`, `z1qx...`, `z1qy...`** | Canonical Embedded Contract address (`#1..#12` Phase 0, `#13` `Settlement`, `#14` `AuthRegistry`, `#15` `Channel`) | | **`0x02`** | **`PQUserAddrByte`** | **`z1q2...`, `z1qf...`, `z1qg...`, `z1qt...`** | **Native Post-Quantum user address** (enabled at `Spork #10`; `algID` in `{0x01, 0x02, 0x03}`, plus `0x81` pre-sunset) | | `0x03..0xff` | *Unassigned* | *(Reserved for future eras)* | **Rejected fail-closed as `AccountBlock.Address` (`ErrABUnsupportedAddressClass`, `M12` fix)!** | > **[TIP: Why `0x02` (`z1q{2,f,g,t}...`) Is Superior to Changing the 3rd Character (`z1z...`)]** > 1. **100% Zero-Friction CEX & SDK Compatibility:** Both official SDKs (`znn_sdk_dart` `Address.isValid`) **and** third-party exchange/explorer `^z1q[a-z0-9]{37}$` regexes accept `0x02` withdrawals on Day 1! > 2. **No Misleading UX Dichotomy:** Rotated `0x00` Pillars, time-locked Stakes, and `PoKoS`-rescued wallets retain their `z1q{p,q,r,z}...` addresses after upgrading to `ML-DSA-44` / `FN-DSA-512`—so wallets indicate quantum safety via an explicit on-chain auth badge rather than address prefix heuristics, while engineers can still distinguish native `0x02` addresses immediately by character #4 (`{2, f, g, t}`). --- ## 2. Canonical `0x02` Derivation, Golden `Go 1.27` Vector (`N02`) & `152-Bit` vs. `256-Bit` Binding (`B05, R4-06`) ```text DomainTag = "zenon-pq-addr:v1" // 16 ASCII bytes Preimage = DomainTag || [algID] || pqPubKey // 17 + len(pqPubKey) bytes Digest = FIPS202_SHA3_256(Preimage) // 32 bytes Address[0] = 0x02 Address[1:] = Digest[0:19] // 19 bytes (152 bits) ``` ### Canonical Golden `Go 1.27+` `ML-DSA-44` (`0x01`) Test Vectors (`N02, R4-01` Verified) ```text 32-byte Seed (hex) : 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 Go 1.27 Call : sk, _ := mldsa.NewPrivateKey(mldsa.MLDSA44(), seed[:]) len(pk.Bytes()) : 1312 bytes SHA3-256(pk.Bytes()) : 941049da6dbfb141f770f075f7968f243cd4533e9719f121be0eb7c5f8ee7645 Derived 20B Address (hex) : 0208953cfda6d999d2a6c636a4a0b1cfb1c7fdea Canonical Bech32 Address : z1qgyf208a5mven54xccm2fg93e7cu0l022alugr Low-Level Sig KAT : sk.SignDeterministic([]byte("zenon-v3-kat"), &mldsa.Options{Context: "zenon-ab:v2"}) SHA3-256(lowLevelSig) : 621b16f8e3e2c7c064aec7ab540f1f64b1d1665feef964f07c6cded92d99f33b v4 Bound Transcript Digest : f79b6f58918590a542c285d49fec08cde4ca1abc4d47ccb77b78b078569e542f // over SHA3-256("zenon-v4-bound-ab-kat") SHA3-256(boundSig[2420]) : b7444ca31c5c802bd2cdc7f3fd5c76d1e2bce8655bfd44dd96a099e26c8608cf ``` ### Honest Security Profile of `152-Bit` First Binding & `PrecommitKey` Upgrade (`B05, R4-06` Fix) * **Before First Spend (`Height == 0`, Unregistered):** Only the `19-byte` (`152-bit`) digest is committed on-chain. * *Ideal Unbounded-Depth Quantum Model:* `~2^76` single-target Grover queries (`2^((152 - u)/2)` multi-target across `2^u` untouched funded addresses). * *NIST `MAXDEPTH = 2^64` Bounded-Depth Model (Zalka's Theorem `[E6]`, `R4-06` Corrected):* For oracle circuit depth `D_circ = 2^d` (`d ≈ 12` for `ML-DSA` keygen + `SHA3-256`), each processor runs `K = 2^(64 - d) = 2^52` Grover iterations covering `K^2 = 2^104` states, requiring **`M = 2^152 / K^2 = 2^48` parallel quantum processors** and **`W = M * K = 2^152 / K = 2^100` total oracle calls (`> 2^112` logical quantum gates)** (`M = 2^24` parallel runs and `W = 2^88` calls in the idealized `d = 0` limit). * **After First Spend (`Height >= 1`) OR `PrecommitKey` Registration (`Height == 0` Cold Vaults):** Full `32-byte` (`256-bit`) `SHA3-256([algId] || pqPubKey)` is locked in authenticated `smt-v1` state (**`2^128` ideal Grover**). High-value cold vaults wanting `256-bit` binding *before* ever emitting `Height = 1` call `AuthRegistry.PrecommitKey` (from any feeless sponsor/funder account pre-CRQC) to bind their full `pqPubKey` into `AuthRegistry (#14)` at funding time! --- ## 3. `AuthRegistryContract` (`#14`) `v4` ABI, `179-Byte` PoP & Dual-Ledger Races (`B03, B05, M06, R4-03` Fix) ### 3.1 `AuthRegistryContract (#14)` ABI ```json [ {"type":"function","name":"RotateKey","inputs":[ {"name":"algId","type":"uint8"}, {"name":"expectedRotationNonce","type":"uint64"}, {"name":"newPublicKey","type":"bytes"}, {"name":"newKeyPopSignature","type":"bytes"} ]}, {"type":"function","name":"RescueWithPoKoS","inputs":[ {"name":"targetAddress","type":"address"}, {"name":"algId","type":"uint8"}, {"name":"newPublicKey","type":"bytes"}, {"name":"newKeyPopSignature","type":"bytes"} ]}, {"type":"function","name":"PrecommitKey","inputs":[ {"name":"targetAddress","type":"address"}, {"name":"algId","type":"uint8"}, {"name":"newPublicKey","type":"bytes"}, {"name":"newKeyPopSignature","type":"bytes"} ]}, {"type":"function","name":"UpgradeHybridToPureMLDSA44","inputs":[ {"name":"expectedRotationNonce","type":"uint64"}, {"name":"newKeyPopSignature","type":"bytes"} ]} ] ``` * **`PrecommitKey` Guard (`B05`):** Requires `targetAddress[0] == 0x02`, `AccountStore(targetAddress).Height == 0`, `activePubKeyHash == 0`, `pendingEffectiveHeight == 0`, **`DerivePQAddress(algId, newPublicKey) == targetAddress`** (preventing unauthorized griefing/bricking of third-party addresses!), and a valid `179-byte` `newKeyPopSignature` (`opByte = 0x03`). * **Overflow Guard:** `RotateKey` and `UpgradeHybridToPureMLDSA44` require `authState.rotationNonce < math.MaxUint64` (`ErrAuthNonceOverflow`), never wrapping to `0`. ### 3.2 Exact `179-Byte` `GenesisHash`- & Generation-Bound PoP Preimage (`M06` Fix) To prevent cross-network replay (e.g., devnets sharing `ChainIdentifier = 1`), cross-role confusion, or competing-generation races (`B03`), `AuthRegistryContract` reconstructs the exact **`179-byte`** `popPreimage`: ```text popPreimage (exact 179 bytes): Bytes 0..17 : "zenon-auth-pop:v3" // 17 ASCII bytes Bytes 17..25 : be_u64(ChainIdentifier) // 8 bytes (1 on Alphanet) Bytes 25..57 : GenesisMomentumHash[32] // 32 bytes (prevents same-ChainId fork replay!) Byte 57 : opByte // 1 byte (0x01=Rotate, 0x02=PoKoS, 0x03=Precommit, 0x04=HybridStrip) Bytes 58..78 : targetAddress[20] // 20 bytes Bytes 78..98 : senderBlock.Address[20] // 20 bytes (binds sponsor/relayer!) Bytes 98..106 : be_u64(senderBlock.Height) // 8 bytes (prevents intra-account replay) Bytes 106..114 : be_u64(expectedRotationNonce) // 8 bytes (MUST equal authState.rotationNonce!) Bytes 114..146 : prevActivePubKeyHash[32] // 32 bytes ([32]byte{0} on first registration) Byte 146 : algId // 1 byte in {0x01, 0x02, 0x03, 0x81*} Bytes 147..179 : SHA3_256(newPublicKey)[32] // 32 bytes ------------------------------------------------------------------------- Exact Sum: 17 + 8 + 32 + 1 + 20 + 20 + 8 + 8 + 32 + 1 + 32 = 179 bytes! popDigest = FIPS202_SHA3_256(popPreimage) // 32 bytes ``` ### 3.3 Dual-Ledger `Send -> Receive` Generation Semantics & `H_inc + 1` Promotion (`B03, R4-03` Fix) 1. **Preserving User-Stripe Isolation + Clean `rollbackEmbedded` on Competing Sends (`B03, R4-03`):** * User `UserSend` blocks remain **100% isolated to the sender's own `AccountStore`** (`ApplySend` validates stateless ABI packing only, preserving parallel `Stage 3a` user stripes!). * Suppose an old key emits two `RotateKey` `UserSend` blocks `S_1` (`expectedRotationNonce = 0`) and `S_2` (`expectedRotationNonce = 0`) before `AuthRegistry` executes `ContractReceive(S_1)`. * `ContractReceive(S_1)` executes against **`ctx.InclusionMomentumStore()` at `H_confirm = ctx.InclusionHeight()`** (NOT `receiveBlock.MomentumAcknowledged` `R4-03`!), sets `pendingEffectiveHeight = H_confirm + 1`, and **immediately increments `authState.rotationNonce` from `0` to `1`**. * When `ContractReceive(S_2)` executes, `S_2.expectedRotationNonce (0) != authState.rotationNonce (1)`—returning `ErrAuthStaleGeneration`, which `GenerateEmbeddedReceive` (`vm.go:568-578`) cleanly rolls back (`Data = be_u64(2)`) after advancing the FIFO sequencer cursor without stalling `AuthRegistry`'s mailbox! 2. **Phase 1A (`10s` `v3`) vs. Phase 1B (`1s` `v4`) In-Flight Window (`B03, B09` Honesty):** * In Phase 1A (`LegacyDposV1`), `ContractReceive(S_1)` is produced asynchronously in the next slot (`~10–20 s` total window); in Phase 1B (`Momentum v4` Algorithm 1 Step 3b), `ContractReceive(S_1)` executes deterministically in the **same** `Momentum` `H_confirm` (`1.0 s` promotion at `H_confirm + 1`). Rotation is strictly a **pre-CRQC proactive migration mechanism**, never a post-compromise undo button. --- ## 4. Wallet Key Derivation (`Go 1.27+`), Seed Classes & Independent Seed Option (`B01, M05, R4-09` Fix) ```text Master Node: HMAC-SHA512(Key = "zenon-pq-slip0010:v1", Data = bip39Seed64) Derivation: m / 44' / 73404' / 1' / ' / ' ``` * **Computational PRF Isolation & Wallet Cohort Coverage (`M05` Fix):** 1. `HMAC-SHA512` provides **computational PRF domain separation** between classical `SLIP-0010` and PQ subtrees (not information-theoretic secrecy if `bip39Seed64` itself is physically stolen!). Wallets (`Syrius`, `znn-cli`) MUST offer **both** deterministic derivation from an existing `12/24`-word `BIP-39` mnemonic (with or without 25th-word passphrase, including `go-zenon` Argon2id-encrypted `KeyFile`s `wallet/keystore.go:29`) **and** rotating to a **freshly generated independent `256-bit` entropy seed** (mandatory whenever root mnemonic exposure is suspected). 2. Hardware wallets or CLI users holding standalone imported keys without `BIP-39` rotate directly to a fresh PQ seed via `RotateKey` (and any standard `32-byte` `RFC 8032` seed remains eligible for `RescueWithPoKoS`—see [Ed25519-PoKoS Rescue](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | `algId'` Segment | Target Scheme | Exact `Go 1.27+` / Reference Extraction from 32-Byte `leaf.Key[0:32]` (`B01, R4-09` Verified) | |:---:|---|---| | `1'` (`0x80000001`) | `ML-DSA-44` | **`mldsa.NewPrivateKey(mldsa.MLDSA44(), leaf.Key[0:32])`** (`Go 1.27+` stdlib `crypto/mldsa`) | | `2'` (`0x80000002`) | `FN-DSA-512` | **`SHA3_256("zenon-fndsa512-keygen:v1" \|\| leaf.Key[0:32])`** (`32 B` seed -> pinned `fn-dsa v0.3` keygen `R4-09`) | | `3'` (`0x80000003`) | `SLH-DSA-SHAKE-128s` | `SHAKE256("zenon-slhdsa128s-keygen:v1" \|\| leaf.Key[0:32], 48)` -> FIPS 205 `(SK.seed, SK.prf, PK.seed)` | ================================================================================ CHAPTER 10 / 31: AccountBlock v2, BoundSigningDigest, Equi-X, [0x11] Sidecar & Rolling Pruning FILE: docs/post-quantum/account-blocks-and-pk-caching.md | URL: https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching ================================================================================ # `AccountBlock v2`, Non-Separable `boundDigest32`, `H_inc` Sunset & `[0x11]` Witness Sidecars > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Activate `AccountBlock.Version = 2` under `PQAccountsSpork` (`Spork #10`) while keeping the **exact `306-byte` `AccountBlock.ComputeHash()` preimage** unchanged! Reconciling `ZDC-QS-DEEZ-HR-001` and the **Round-4 Independent Cryptographic & Source Audit (`R4-01, R4-03, R4-07`)**, `v4`: > 1. **Closes `0x81 <-> 0x00` Hybrid Stripping & Key-Splicing Ransomware (`R4-01` fix):** Binds `[algID] || SHA3-256(resolvedPubKeyWire)` inside every `v2` signature (`boundDigest32`) and forbids `0x81` on unregistered `0x00` Path-C first reveals! > 2. **Enforces `Spork #14` Strictly at `InclusionMomentumHeight` (`H_inc`) Across User AND Embedded Blocks (`B02, R4-03` fix):** Overrides `GenerateEmbeddedReceive`'s `targetMA` rewind for sunset/auth checks and upgrades embedded `ContractReceive`/`ContractSend` blocks to `Version = 2`. > 3. **Length-Framed `PreverifyAuthTuple` & Witness-Aware Gossip Dedup (`M01, C03` fix):** Uses `u32` length-prefixed `WitnessDigest` and `(block.Hash, WitnessDigest)` P2P deduplication so corrupted witnesses never poison valid transactions. > 4. **Witness-Separated `[0x11]` Storage for `14`-Day Compaction (`R4-07` fix):** Stores `v2` raw witness bytes in Pebble `[0x11] || blockHash[32]` outside `Momentum.ChangesHash`, allowing `14`-day witness pruning without breaking `30`-day native block sync! --- ## 1. Exact `306-Byte` `AccountBlock.ComputeHash()` Preimage, `Equi-X` & `boundDigest32` (`H14, R4-01`) *(Note `M12`: Setting `Version = 2` changes bytes `0..8` of the `306-byte` preimage for new `v2` blocks—preventing cross-version hash collisions—while historical `Version = 1` blocks keep their exact original hashes forever!)* ```text Bytes 0..8 : be_u64(Version) // 1 (legacy) or 2 (post-PQAccountsSpork) Bytes 8..16 : be_u64(ChainIdentifier) // 1 on Alphanet Bytes 16..24 : be_u64(BlockType) // 1..5 Bytes 24..56 : PreviousHash[32] Bytes 56..64 : be_u64(Height) Bytes 64..104 : MomentumAcknowledged[40] // Hash[32] || be_u64(Height) Bytes 104..124 : Address[20] // Must be 0x00, 0x01 (embedded), or 0x02 (M12 allowlist!) Bytes 124..144 : ToAddress[20] Bytes 144..176 : Amount[32] Bytes 176..186 : TokenStandard[10] Bytes 186..218 : FromBlockHash[32] Bytes 218..250 : SHA3_256(DescendantHashes)[32] Bytes 250..282 : SHA3_256(Data)[32] Bytes 282..290 : be_u64(FusedPlasma) Bytes 290..298 : be_u64(Difficulty) Bytes 298..306 : Nonce[8] // STRICTLY EquiXSalt[8] when Version >= 2 & Difficulty > 0! ``` * **Non-Separable Key- & Algorithm-Bound Signing Digest (`boundDigest32`, `R4-01` Fix):** Because `AccountBlock.ComputeHash()` excludes `PublicKey` and `Signature`, signing raw `block.Hash[:]` would leave `algID` and hybrid partner keys unbound—allowing a P2P attacker to strip `0x81 -> 0x00` or splice an attacker `ML-DSA-44` key onto an uncached `0x00` reveal (`0x00 -> 0x81` ransomware). Every `Version == 2` block signs: ```text boundDigest32 = FIPS202_SHA3_256( "zenon-ab:v2" || [0x00] || [algID] || FIPS202_SHA3_256(resolvedPubKeyWire)[32] || block.Hash[32] ) ``` * **Two-Stage `Equi-X` (`[E5]`) Verification (`Difficulty > 0` on `Version == 2`):** 1. `C = SHA3-256("zenon-equix:v2" || be_u64(ChainId) || Address[20] || PreviousHash[32] || Nonce[8])`. 2. `EquiXVerify(C, EquiXSolution[16]) == true` AND `uint128(be_u64(SHA3-256("zenon-equix-effort:v2" || C || EquiXSolution[16])[0:8])) * uint128(max(1, Difficulty >> 16)) <= 2^64 - 1`. --- ## 2. Era-Separated `InclusionMomentumHeight` (`H_inc`) Policy vs. `MomentumAcknowledged` (`B02, R4-03` Fix) In `go-zenon-v1/internal/vm/verifier/momentum.go:415` and `internal/vm/supervisor/vm.go:684`, Phase 0 evaluates spork masks at `blk.MomentumAcknowledged.Height`. Evaluating `LegacyCryptoSunsetSpork` (`Spork #14`) at `H_ack` would leave a `1-hour` (`W_ack`) post-sunset `Ed25519` / `secp256k1` bypass on both user blocks (`DEEZ-B02`) and embedded `ContractReceive` blocks (`R4-03`)! **Normative `v4` Dual-Height Evaluation Law (`B02 + R4-03` Closed):** 1. **Authentication & Sunset Policy (`Evaluated Strictly at InclusionMomentumHeight = H_inc`):** * Whether `Version == 2` is permitted (`H_inc >= H_spork10`), which `ActiveKey` governs `block.Address` (`postPromoStore` at `H_inc`), whether classical/hybrid user suites `{Version == 1, algID == 0x00, algID == 0x81}` are forbidden (`H_inc >= H_sunset`), **and** whether classical embedded-contract methods (`Bridge`, `Swap`, `Pillar.RegisterLegacy`, `PTLC {0..2}`) are disabled inside `ApplySend` and `GenerateEmbeddedReceive` are **ALWAYS evaluated at `H_inc`**—**NEVER at `block.MomentumAcknowledged.Height`**! * Post-`Spork #10`, embedded `ContractReceive` (`AutoReceiver`) and `ContractSend` descendants/refunds (`vm.go:758, 813`) emit `Version = 2` so `Spork #14`'s `Version == 2` rule never blocks embedded execution (`R4-03`). 2. **Data-Payload Plasma & Recency (`MomentumAcknowledged` Preserved Where Safe):** * `IsCanonical(block.MomentumAcknowledged)`, `VirtualAge(H_inc, H_ack) <= W_ack`, `Sequencer` `frontConfHeight <= H_ack`, and Phase 0 embedded cross-account snapshot reads retain Zenon's source-native rules unchanged. --- ## 3. Zero-Copy Wire Admission (`M02`), `PreverifyAuthTuple` (`M01, C03`) & 3-Path `producer()` (`R4-01`) ### 3.1 Zero-Copy Frame Bounds & Stage-1 Witness Caps (`M02` Verified) Both `go-zenon-v1` (`proto.ConsumeBytes`, `rlp.readKind` within `MaxMsgSize = 10 MiB` P2P / `MaxHTTPBodySize = 5 MiB` RPC) and `zenon-rs` (`zenon_common::protowire`) validate length prefixes against remaining frame bytes **before any buffer allocation** (preserving `MaxDescendantDepth = 10,000` on `ContractReceive` and multi-tx `TxMsg` lists!). Immediately after zero-copy slice decode, Stage 1 enforces exact per-`algID` witness ceilings: * `len(PublicKeyWire) in {0, 33, 898, 1313, 1345}` (matched exact to `PublicKeyWire[0]` when non-empty). * `len(SignatureWire) in {0, 65, 667, 2421, 2485, 7857}` (`0` only for `0x01` embedded senders; matched exact to `SignatureWire[0]`). * `len(ProofWitness) == 0` unless `ToAddress in {SettlementContract, AuthRegistryContract}` AND `len(ProofWitness) <= 131,072` (`128 KiB`). * `len(EquiXSolution) in {0, 16}` (`16` iff `Difficulty > 0`). * Peers delivering malformed witness lengths or failing Stage-2 crypto checks accrue `InvalidWitnessPenalty` points in `internal/protocol/budget.go` before touching VM locks. ### 3.2 Length-Framed `PreverifyAuthTuple` & Witness-Aware Gossip Dedup (`M01, C03` Fix) Updating `go-zenon-v1/internal/vm/verifier/account_block.go:45`, a cached Stage-2 `PreverifiedBlock` verdict is valid at `Momentum H_inc` **if and only if** every field of the 8-tuple below matches the post-promotion state at `H_inc`: ```text WitnessCommitment := SHA3_256(LP(PublicKeyWire) || LP(SignatureWire) || LP(ProofWitness) || LP(EquiXSolution))[32] // where LP(x) = be_u32(len(x)) || x (unambiguous length framing) PreverifyAuthTuple := ( GenesisMomentumHash[32], ChainIdentifier, block.Hash[32], ResolvedAlgID, // 0x01, 0x02, 0x03 (or 0x00, 0x81 pre-sunset) ResolvedPubKeyHash[32], // SHA3-256(ActivePublicKeyWire) post-Step-0 promotion at H_inc AuthRotationNonce, // authState.rotationNonce post-Step-0 promotion at H_inc IsLegacySunsetActive(H_inc), // H_inc >= H_sunset WitnessCommitment[32] ) ``` P2P `TxMsg` gossip deduplication keys on `(block.Hash, WitnessCommitment)` rather than `block.Hash` alone so an attacker relaying a corrupted-witness copy of `block.Hash` is penalized without suppressing the legitimate block (`C03`). ### 3.3 Updated `accountBlockVerifier.producer()` Resolution (`account_block.go:1192`, `B03, R4-01` Fix) 1. **Path A (`AuthRegistry` `activeRecord` Present — rotated `0x00`, `PoKoS`-rescued `0x00`, `PrecommitKey` `0x02`, rotated `0x02`):** * Require `Version == 2` and `len(block.PublicKey) == 0` (`ErrABPublicKeyMustBeCached`), resolve `ActiveKey = [activeAlgId] || authState.activePublicKey`, verify `boundDigest32` signature, and skip `PubKeyToAddress`. 2. **Path B (`AccountStore[0x09]` Populated — repeat blocks on unrotated `0x02` or `v2`-cached `0x00`):** * Require `Version == 2`, `len(block.PublicKey) == 0`, resolve `ActiveKey = AccountStore[0x09]`, and verify `boundDigest32` signature. 3. **Path C (`First Reveal` — uncached & unregistered in `AuthRegistry`):** * Require `len(block.PublicKey) > 0`; * If `block.Address[0] == 0x02`: allow `algID in {0x01, 0x02, 0x03}` (plus `0x81` pre-sunset), assert `DerivePQAddress(algID, rawPub) == block.Address`; * If `block.Address[0] == 0x00` (pre-sunset only!): **require `algID == 0x00` (`0x81` FORBIDDEN on `0x00` Path C `R4-01`!)** and assert `PubKeyToAddress(rawPub) == block.Address`; * Persist `block.PublicKey` to `AccountStore[0x09]` (and for `0x00` Path-C reveals when `SporkBitPQAccounts` is active and `[0x0a]` is empty, persist `AccountStore[0x0a] = edPub32`). --- ## 4. `[0x11]` Witness Sidecar Separation & `14`-Day Compaction (`N01, B08, R4-07` Fix) * **Key-Omission Byte Savings (`N01`):** Caching `PublicKeyWire` saves `1,313 B` on `ML-DSA-44` (**`35.16%` of witness**, **`32.50%` of full `4,040 B` block**) and `898 B` on `FN-DSA-512` (**`57.38%` of witness**, **`48.00%` of full `1,871 B` block**). * **`ChangesHash`-Safe Witness Compaction (`R4-07` Fix):** In Phase 0, `[0x03]||addr||[0x02]||be_u64(h)` inside `Momentum.ChangesHash` stored full `SerializeProto` bytes including witnesses. For `Version == 2` blocks, `[0x02]` stores the **witness-stripped canonical body + `32B` `WitnessCommitment`**, while raw witness bytes `(PublicKey, Signature, ProofWitness, EquiXSolution)` are stored in Pebble namespace **`[0x11] || blockHash[32]`** (outside `MomentumChanges`). Compacting `[0x11]` witnesses older than `14` days (`EpochTerminalQC`-finalized) keeps `Momentum.ChangesHash` 100% verifiable across the entire `30`-day rolling native block window (`<= 450 GB` NVMe)! ================================================================================ CHAPTER 11 / 31: Two-Lane Dynamic Plasma, Witness & Equi-X Pricing, and uint64 SporkMask FILE: docs/post-quantum/dynamic-plasma-and-dos.md | URL: https://0x3639.com/zenon-phase-1/docs/post-quantum/dynamic-plasma-and-dos ================================================================================ # Two-Lane Dynamic Plasma, Witness Pricing, Exact `0x1f → uint64` `SporkMask` & Monotonicity > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciling `ZDC-ZP1-HR-001` (`H01, H02, H14, M02`) and `ZDC-QS-DEEZ-HR-001` (`M02, M07`), **Zenon Phase 1 `v4`** (1) aligns `pow.SporkMask` bit indices byte-for-byte with `go-zenon-v1/internal/pow/plasma.go:45-55`'s existing 5-bit `0x1f` mask when widening `uint8 → uint64` (`M07` fix), (2) scopes the formal `witness_plasma_monotonicity` law accurately to fixed `(algID, hasProofWitness)` over `TotalWitnessBytes >= 96` (`M07` fix), and (3) enforces Two-Lane `Momentum v4` (`1.0 s`) admission (`8.4M` BasePlasma + `256 KiB/s` `ProofWitness` with `PoKoS` anti-starvation). --- ## 1. Exact `0x1f → uint64` `SporkMask` Bit Alignment (`go-zenon-v1/internal/pow/plasma.go:48`, `M07` Fix) Direct inspection of `go-zenon-v1/internal/pow/plasma.go:45-78` and `internal/common/params.go:256-265` shows that `params.ImplementedSporks` lists 8 Phase 0 sporks, while `pow.SporkMask` currently assigns **bits `0..4` (`sporkMaskAll = 0x1f`)** to the 5 plasma-affecting Phase 0 sporks (`Libp2p`, `EmbeddedRefund`, and `EpochRewardTerms` do not occupy bits in `0x1f`). To preserve **100% backward-compatible bit positions** with `go-zenon-v1`'s existing `NormalizeSporkMask` and golden test vectors (`M07` closed), widening `type SporkMask uint8` to **`type SporkMask uint64`** preserves bits `0..4` verbatim: ```text // Existing 5-bit Phase 0 pow.SporkMask (plasma.go:48-54, mask 0x1f — UNCHANGED!): Bit 0 (1 << 0) : SporkBitAccelerator (Phase 0 active) Bit 1 (1 << 1) : SporkBitBridgeAndLiquidity (Phase 0 active; implies Bit 0) Bit 2 (1 << 2) : SporkBitHtlc (Phase 0 active; implies Bits 1, 0) Bit 3 (1 << 3) : SporkBitDynamicPlasma (Activated in Phase 1.0!) Bit 4 (1 << 4) : SporkBitPtlc (Phase 0 / 1.0) // Non-pow Phase 0 Runtime Spork Flags (tracked in ChainSporkSet): Bit 5 (1 << 5) : SporkBitLibp2p (Activated in Phase 1.0!) Bit 6 (1 << 6) : SporkBitEmbeddedRefund (Phase 0 active) Bit 7 (1 << 7) : SporkBitEpochRewardTerms (Phase 0 / 1.0) // New Phase 1A-1E Spork Bits (Bits 8..13): Bit 8 (1 << 8) : SporkBitStateRoot (#9 — Momentum v3 domain-separated smt-v1 StateRoot) Bit 9 (1 << 9) : SporkBitPQAccounts (#10 — AccountBlock v2, 0x02 Addr, AuthRegistry #14, WitnessPlasma, PoKoS) Bit 10 (1 << 10): SporkBitMomentumMahiPQ (#11 — 1.0s Momentum v4, Mahi-Mahi M=4,096, HashRand-PQ M_coin=256; implies 8, 9) Bit 11 (1 << 11): SporkBitProofFirstZeno (#12 — SettlementContract #13 ZK_VALIDITY, 2^-128 QROM WHIR-SHA3-v1; implies 8, 9) Bit 12 (1 << 12): SporkBitBitcoinAndEdge (#13 — d_btc SPV, SigLocks 3..4, ChannelContract #15; implies 11) Bit 13 (1 << 13): SporkBitLegacyCryptoSunset (#14 — Enforced at H_inc! Disables v1, 0x00, 0x81, Bridge/Swap/PTLC ECC) ``` --- ## 2. Stateless Post-Quantum, `Equi-X` & STARK `WitnessPlasma` Formula (`H14, M02, M07`) When `SporkBitPQAccounts` is active and `block.Version >= 2` (for non-embedded senders `!types.IsEmbeddedAddress(block.Address)` after passing Stage-1 hard length validation `M02`): ```text CanonicalBasePlasma(block) = LegacyBasePlasma(block) + WitnessPlasma(block) TotalWitnessBytes = len(block.PublicKey) + len(block.Signature) + len(block.ProofWitness) + len(block.EquiXSolution) // +16 B when Difficulty > 0 (H14) ExcessWitnessBytes = max(0, TotalWitnessBytes - 96) ABWitnessBytePlasma = 17 // Policy byte weight (1:4 SegWit-style ratio vs ABByteDataPlasma = 68; M02) VerifyComputePlasma(algID, hasProofWitness): SigVerifyPlasma: 0x00 (Ed25519, pre-sunset) -> 0 0x01 (ML-DSA-44) -> 2,100 (+1.0 QSR fusion unit) 0x02 (FN-DSA-512) -> 1,050 (+0.5 QSR fusion unit) 0x03 (SLH-DSA-SHAKE-128s) -> 42,000 (+20.0 QSR fusion units) 0x81 (Hybrid Ed+MLDSA44) -> 3,150 (+1.5 QSR fusion units, pre-sunset) StarkVerifyPlasma (iff len(block.ProofWitness) > 0): 0x10 (WHIR-SHA3-v1 STARK) -> 52,500 (+25.0 QSR fusion units) WitnessPlasma(block) = ExcessWitnessBytes * 17 + SigVerifyPlasma(algID) + StarkVerifyPlasma ``` ### Exact Formal Monotonicity Domain (`M07` Fix) Because `ExcessWitnessBytes = max(0, W - 96)` has a baseline plateau on `W in [0, 96]` and different `algID`s carry distinct `SigVerifyPlasma` compute surcharges, Lean law `witness_plasma_monotonicity` (`Suite 15`) is stated over its exact mathematical domain: 1. **Per-Suite Strict Byte Monotonicity:** For any fixed `(algID, hasProofWitness)` and valid witness lengths `W_2 > W_1 >= 96`, `WitnessPlasma(W_2) - WitnessPlasma(W_1) == 17 * (W_2 - W_1) > 0`. 2. **Global Worst-Case Resource Bound:** Independent of `algID`, every block in a `Momentum` satisfies `TotalWitnessBytes <= 1,345 + 7,857 + 131,072 + 16 = 140,290 B` and aggregate per-Momentum `BasePlasma <= 8,400,000` + `ProofWitness <= 262,144 B`. ### Resulting Feeless `QSR` Fusion & Client PoW Schedule (`1.0x` Base Price, `FusedPlasma` Mode) | Transaction Workload (`AccountBlock v2`, `EquiXSolution = 0 B`) | `TotalWitnessBytes` | Total `CanonicalBase` Plasma | Equivalent Fused `QSR` (`2,100` plasma / QSR) | Client `Equi-X` Target (`+272` plasma) | |---|---:|---:|---:|---:| | **`FN-DSA-512` Repeat / Registered Tx** | **`667 B`** | **`31,757`** | **`~15.2 QSR`** | `~50 ms` | | `FN-DSA-512` Unregistered First Reveal (`0x02`, `H = 1`) | `1,565 B` | `47,023` | `~22.4 QSR` | `~75 ms` | | **`ML-DSA-44` Repeat / Registered Tx** | **`2,421 B`** | **`62,625`** | **`~29.9 QSR`** | `~100 ms` | | `ML-DSA-44` Unregistered First Reveal (`0x02`, `H = 1`) | `3,734 B` | `84,946` | `~40.5 QSR` | `~135 ms` | | **`SLH-DSA-SHAKE-128s` Cold Vault Tx** | **`7,857 B`** | **`194,937`** | **`~92.9 QSR`** | `~310 ms` | | **`SubmitBatch` / `PoKoS` (`90 KiB = 92,160 B` STARK + `ML-DSA-44`)** | **`94,581 B`** | **`1,711,245`** | **`~814.9 QSR`** *(`< 0.82 QSR/tx` @ 1k txs)* | `~2.4 s` | | **`SubmitBatch` / `PoKoS` Max (`128 KiB = 131,072 B` STARK + `ML-DSA-44`)** | **`133,493 B`** | **`2,372,749`** | **`~1,129.9 QSR`** *(`< 8,400,000` cap `H02`!)* | `~3.3 s` | --- ## 3. Two-Lane `Momentum v4` (`1.0 s`) Admission Schedule (`H01, H02`) 1. **Phase 1A (`10.0 s` `Momentum v3`):** `DefaultMaxBasePlasmaInMomentum = 16,800,000`, `MaxProofWitnessBytesPerMomentum = 524,288` (`512 KiB / 10s`), `MaxSingleProofWitnessBytes = 131,072` (`128 KiB`). 2. **Phase 1B+ (`1.0 s` `Momentum v4` Two-Lane Schedule):** * **Lane 1 (Aggregate Base Plasma):** `MaxBasePlasmaInMomentum = 8,400,000`, `FusedPlasmaTarget = 2,100,000`, `PowPlasmaTarget = 2,100,000` (**`132` `FN-DSA-512` / `67` `ML-DSA-44` blocks/s at `1.0x`**, **`264` / `134` blocks/s burst**). * **Lane 2 (Prunable `ProofWitness` Byte Budget):** `MaxProofWitnessBytesPerMomentum = 262,144` (`256 KiB/s`), `MaxSingleProofWitnessBytes = 131,072` (`128 KiB`), **`1` slot/s reserved for `AuthRegistry.RescueWithPoKoS`** whenever `PoKoS` mempool queue is non-empty. * **Damping Step:** `PriceChangeDenominator = 200` (`~200 s` exponential price response). ================================================================================ CHAPTER 12 / 31: Day-1 Ed25519-PoKoS Zero-Knowledge Seed Rescue, O(1) Exposure Resolver & Classical Sunset FILE: docs/post-quantum/ed25519-pokos-seed-rescue.md | URL: https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue ================================================================================ # Day-1 `pubKey_A`-Bound `Ed25519-PoKoS` Rescue & Complete Classical Sunset (`v4`) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciling `ZDC-ZP1-HR-001`, `ZDC-QS-DEEZ-HR-001`, and the **Round-4 Independent Cryptographic & Source Audit (`R4-02, R4-03, R4-04, R4-06, R4-09`)**, **Zenon Phase 1 `v4`** makes zero-knowledge seed rescue and classical sunset mathematically airtight without any stop-the-world state migration: > 1. **`O(1)` `GenesisReceive`- & Producer-Aware Exposure Resolver (`B06, R4-02, R4-03` fix):** Replaces naive `Height >= 1` checks (which failed on unsigned `Height == 1` `GenesisReceive` blocks and `Height == 0` Pillar `producingAddress` seals) **without** any O(All Accounts) activation stall—resolving `EXPOSED` vs. `UNEXPOSED` vs. `UNKNOWN` in **`O(1)`** via `AuthRegistry[0x03]` (bounded `<= 250` Pillar/PTLC `Ed25519` reveals) + `AccountStore[0x0a]` + `ByHeight(1)/ByHeight(2)` against `ctx.InclusionMomentumStore()`! > 2. **True `2^-128` QROM `WHIR-SHA3-v1` + Full `32-Byte` `pubKey_A` Binding (`B06, R4-04` fix):** Binds all `32 B` of `pubKey_A` on `EXPOSED` accounts (**`~2^126` Grover**), enforces `256-bit` classical RBR (`32b` grind + `224b` query -> **`128b` QROM**), and documents `UNEXPOSED` accounts with exact Zalka `MAXDEPTH = 2^64` bounds (`M ≈ 2^44` parallel runs, `W ≈ 2^98` calls `R4-06`). > 3. **Complete Dual-Ledger `H_inc` Embedded Sunset (`B02, B12, R4-03, R4-09` fix):** Phase 1E (`Spork #14`) enforces sunset at **`H_inc`** inside both `ApplySend` and `GenerateEmbeddedReceive` (overriding `targetMA` rewind `R4-03`!), upgrades embedded blocks to `Version = 2`, deletes orphan `ptlcReclaimLock` storage on post-sunset `Reclaim`, and binds `MaxPreCRQCBitcoinHeight` in `SunsetAnchorCheckpoint`. --- ## 1. Why `RFC 8032` `SHA-512` Key Expansion Blocks Shor — And How `O(1)` Exposure Resolution Works (`B06, R4-02` Fix) Every standard Zenon wallet (`syrius`, `znn_cli_dart`, `go-zenon/wallet/keystore.go`, `go-zenon-v1/internal/crypto/ed25519.go`) derives its `Ed25519` public key from a `32-byte` `RFC 8032` private seed `seed32` (whether `seed32` came from `SLIP-0010` over a `12/24`-word `BIP-39` mnemonic, a `KeyFile`, or a raw `32-byte` key import `M05`): ```text Step 1 (RFC 8032): h512 = SHA512(seed32) scalar_s = Clamp25519(h512[0:32]) pubKey_A = CompressEdwards([scalar_s] * B) // 32 bytes (~252-bit group order) Step 2 (Zenon): addr20 = 0x00 || FIPS202_SHA3_256(pubKey_A)[0:19] // 19-byte (152-bit) truncation ``` ### Closing Both the `152-Bit` Truncation Bypass (`B06`) and the `GenesisReceive` / Producer Gap (`R4-02` Fix) * **Shor's Limit:** Given `pubKey_A`, Shor's algorithm recovers `scalar_s` (`[scalar_s] * B`), **never `seed32`** behind `SHA-512`. * **Why `pubKey_A` Must Be Pinned When Exposed (`B06`):** Checking only `targetAddress` (`152` bits) would let an unbounded CRQC Grover-search random `seed32'` values colliding on `19` bytes in `~2^76` ideal queries even when `pubKey_A` (`32 B`) was already public on-chain. * **Why `go-zenon-v1` Enables `O(1)` Exact Resolution Without Full-State Backfill (`R4-02` Proof):** Direct source audit of `go-zenon-v1/internal/vm/verifier/account_block.go:783-799` & `genesis/builder.go:188` proves that on any `0x00` account chain, **ONLY `BlockTypeGenesisReceive (1)` at `Height == 1` is unsigned (`len(PublicKey) == 0`)**; every other block (`UserSend`, `UserReceive`) at `Height >= 1` is signed! Thus, an account's first `AccountBlock` key reveal prior to `Spork #10` **can ONLY reside at `ByHeight(1)` or `ByHeight(2)`**—never `Height >= 3`! The only non-`AccountBlock` `Ed25519` reveals on-chain are `Momentum` producer headers (`legacy_dpos.go:281`, `<= 150` historical Pillar addresses) and `PtlcContract` `PointTypeEd25519 = 0` signature unlocks (`ptlc.go:30`), which are indexed in tiny **`AuthRegistry[0x03 || addr]` (`< 15 KiB` total!)** without touching `AccountStore`! * **Normative 3-State Resolver (`ResolveLegacyEd25519Exposure` on `ctx.InclusionMomentumStore()`, `R4-02, R4-03`):** 1. Check `AuthRegistry[0x03 || targetAddress]` (external `Momentum` producer / `PTLC` `Ed25519` reveal) and `AccountStore(targetAddress)[0x0a]` (`legacyEd25519PK`): if either is present (verifying `PubKeyToAddress(pk32) == targetAddress`; conflicting keys fail closed), return **`EXPOSED(hasExposedPK = 1, pk32)`** (**`~2^126` Grover**). 2. Else inspect `hh = AccountStore(targetAddress).Identifier()`: * `hh.Height == 0`: return **`UNEXPOSED(hasExposedPK = 0, [32]byte{0})`** (`152-bit` address bound). * `hh.Height == 1`: load `blk1 := acct.ByHeight(1)`. If `blk1 == nil` (pruned/missing), return **`UNKNOWN` -> reject (`ErrAuthUnknownExposure`)**! If `blk1.BlockType == BlockTypeGenesisReceive`, return **`UNEXPOSED(0, [32]byte{0})`**; else extract `pk32` from `blk1.PublicKey` -> **`EXPOSED(1, pk32)`**. * `hh.Height >= 2`: load `blk1 := acct.ByHeight(1)`; if `blk1 != nil && blk1.BlockType != BlockTypeGenesisReceive`, extract `blk1.PublicKey`; else load `blk2 := acct.ByHeight(2)` and extract `blk2.PublicKey` (if `blk1` or `blk2` is `nil`/pruned, return **`UNKNOWN` -> reject fail-closed**!). *(Pruner Law `R4-02`: Sovereign `30`-day block pruning NEVER deletes `Height in {1, 2}` of unrotated `0x00` accounts—bounded permanently at `<= 200 MB`!)* --- ## 2. Exact Security Boundary by Account Cohort (`H06, B06, R4-02, R4-06` Reconciled) | Legacy `0x00` Cohort | On-Chain Secret Bound | Pre-Sunset (`Spork #10..#13`) Status | Post-Sunset (`Spork #14`, Enforced at `H_inc` `B02, R4-03`) Status | |---|---|---|---| | **Untouched `0x00` (`UNEXPOSED`: `H == 0` or unsigned `GenesisReceive` only)** | `152-bit` `addr20` (`pubKey_A` never revealed on-chain) | Migrate Day 1 via sponsor-submitted `RescueWithPoKoS` (`0` `Ed25519` key exposure `B08, B09`). | Permanent `RescueWithPoKoS` (`2^76` ideal Grover; Zalka `MAXDEPTH = 2^64` @ `d=10`: `M = 2^44` parallel runs, `W = 2^98` calls `R4-06`). | | **Active `0x00` (Rotated Pre-CRQC)** | `256-bit` `AuthRegistry` PQ key + `boundDigest32` (`R4-01`) | **PQ-Authorized** from `H_confirm + 1` (`activeRecord` rejects `0x00` & prevents `PoKoS` override `B08`). | **PQ-Authorized** (`2^128` Grover + NIST Cat. `1–2` signature security). | | **Dormant `0x00` (`EXPOSED` History, Unrotated)** | `32-byte` `pubKey_A` (`[0x0a]`, `[0x03]`, or `ByHeight(1..2)`) | **Vulnerable if CRQC arrives BEFORE `Spork #14`!** Active holders MUST rotate via `RotateKey` pre-CRQC (`B09`). | **Protected at `~2^126` Grover once `Spork #14` activates pre-CRQC!** `0x00` sigs are disabled at `H_inc`, and `R_PoKoS` requires `seed32` matching all `32 B` of `pubKey_A` (`B06, R4-02`)! | *(Note `M05`: `PoKoS` rescues any standard `32-byte` `RFC 8032` pre-`SHA-512` seed across 12/24-word BIP-39, passphrased BIP-39, `KeyFile`, or raw seed imports; non-RFC-8032 MPC/`FROST` or raw clamped-scalar keys lacking a `32B` pre-`SHA-512` seed must rotate pre-sunset via `RotateKey`.)* --- ## 3. Exact `R_PoKoS` Pure-`SHA3` STARK Relation (`circuitId = 0x01`, `B06, B08, R4-04`) ### Public Inputs (`x` — Reconstructed Against `ctx.InclusionMomentumStore()` by `AuthRegistry #14`) * `genesisHash[32]` & `chainIdentifier` (`uint64`) * `targetAddress[20]`: `0x00` address (`authState.activePubKeyHash == 0 && pendingEffectiveHeight == 0`) * `hasExposedPK` (`uint8` in `{0, 1}`; `UNKNOWN` aborts before proof check!) & `expectedPubKeyA[32]` (`pk32` when `hasExposedPK == 1`, else `[32]byte{0}`) * `popDigest[32]`: Exact `SHA3-256` of the `179-byte` `zenon-auth-pop:v3` preimage (`opByte = 0x02`, binding sponsor `senderBlock.Address`, `senderBlock.Height`, `algId`, and `SHA3-256(newPublicKey)` `B08, M06`) *(Sponsor & Zero-Balance Flow `B08`: Any funded/PoW `0x02` sponsor account submits `RescueWithPoKoS`. At `H_confirm + 1`, `targetAddress` claims pending `UserReceive`s feelessly using client `Equi-X` PoW with `0` initial ZNN/QSR balance!)* ### Private Witness (`w`) & Verified Constraints (`WHIR-SHA3-v1`, True `2^-128` QROM `R4-04`) * Private witness: `seed32[32]` (`RFC 8032` `32-byte` `Ed25519` seed). * Constraints: 1. `h512 = SHA512(seed32)`; `s = Clamp25519(h512[0:32])`; `pubKey_A = CompressEdwards([s]B)`. 2. Assert `0x00 || FIPS202_SHA3_256(pubKey_A)[0:19] == targetAddress`. 3. **If `hasExposedPK == 1`: Assert `pubKey_A == expectedPubKeyA` (`32-byte` exact equality `B06`!).** 4. Absorb all public inputs into the `SHA3-256`/`SHAKE256` Fiat-Shamir sponge with **`32-bit` grinding + `224-bit` classical query security + `256-bit` extension field (`<= 2^-128` QROM soundness `R4-04`)**. * *Projected Engineering Targets (Gated on `Gate ZP-Q20` Physical Qualification `B07, M11, R4-04`):* `~57–86 KiB` `WHIR-SHA3-v1` receipt (`<= 128 KiB` hard cap), `~0.9–1.5 s` laptop prove target, `<= 3.5 ms` (`~1.2 ms` typical) Cortex-A76 verify target (`<= 8,000` Keccak perms). --- ## 4. Complete Phase 1E Classical & Contract Sunset (`Spork #14`, `B02, B11, B12, M09, R4-03, R4-09`) **`SporkBitLegacyCryptoSunset` (`Spork #14`) enforces a complete, zero-stranded-funds sunset strictly at `InclusionMomentumHeight` (`H_inc >= H_sunset`) across BOTH `ApplySend` and `GenerateEmbeddedReceive` (`R4-03` fix):** 1. **Governance Precondition:** `ActivateSpork(#14)` reverts unless `SporkAddress`, `BridgeAdministrator`, and `>= 85%` of active Pillar stake (`M09`) already hold active PQ (`{0x01, 0x02, 0x03}`) authentication records! 2. **User, Hybrid & Embedded Block Version Sunset (`M09, R4-03`):** Rejects `AccountBlock.Version == 1`, `algID == 0x00` (`Ed25519`), and `algID == 0x81` (`AlgHybridEdMLDSA44`) at `H_inc >= H_sunset` (while embedded `ContractReceive` and `ContractSend` descendants emit `Version = 2` from `Spork #10` onward `R4-03`, and `AuthRegistry.UpgradeHybridToPureMLDSA44` remains callable under the `ML-DSA-44` half of an existing `0x81` record). 3. **`BridgeContract` Classical ECDSA Halt (`B12, R4-03`):** Permanently disables `BridgeContract.Redeem`, `WrapToken`, `UpdateWrapRequest`, `UnwrapToken`, and `ChangeTssECDSAPubKey` at **`H_inc >= H_sunset`** (in both `ApplySend` and `ReceiveBlock` via `ctx.InclusionHeight()`). 4. **`SwapContract` & `PillarContract` Legacy `secp256k1` Sunset (`B12, R4-03`):** Disables `SwapContract.RetrieveAssets` and `PillarContract.RegisterLegacy` at `H_inc >= H_sunset`. 5. **Two-Step Zero-Stranded-Funds `PtlcContract` `{0, 1, 2}` Drain (`B12, R4-03`):** * **Step A (`Spork #13`):** Caps `expirationTime <= MaxClassicalPtlcExpiry` (or forbids `{0, 1, 2}` creation once `SigLock` types `3 & 4` activate). * **Step B (`Spork #14` at `H_inc`):** Disables `Unlock`, `ProxyUnlock`, and `ReclaimWithSignature` for `pointType in {0, 1, 2}`, while **permitting post-expiry `Reclaim(id)` back to `ptlcInfo.TimeLocked`** (calling both `DeletePtlcInfo` and `DeletePtlcReclaimLock` so zero funds are stranded and zero `[0x02]` keys leak `R4-03`!). 6. **Height-Bounded `SunsetAnchorCheckpoint` (`B11, R4-09`):** Seals `(H_sunset, MomentumHash_sunset, StateRoot_sunset, CommitteeHash_sunset, BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight)` in `params.go` and Bitcoin (`SHA-256d`). 7. **Permanent `RescueWithPoKoS`:** Remains open forever for all `RFC 8032` `32-byte` seed holders. ================================================================================ CHAPTER 13 / 31: go-zenon-v1 Post-Quantum Validator Implementation Spec (ZNN-IMP-PQ-V1 · v4) FILE: docs/post-quantum/go-zenon-v1-pq-implementation-spec.md | URL: https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec ================================================================================ # `0x3639/go-zenon-v1` Post-Quantum Validator Implementation Spec (`ZNN-IMP-PQ-V1` · `v4`) > **[INFO: Review Draft & Direct LLM Agent Input (`ZNN-SPEC-PHASE1-v4` Aligned)]** > - **Status:** `v4 VERIFIED REVIEW DRAFT` (source-audited against `0x3639/go-zenon-v1@1c6e3d8..ff9496a`, `zenon-rs`, and live `go1.27.1`, incorporating Round-4 findings `R4-01..R4-09`). > - **Target Codebase:** [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1) (`CGO_ENABLED=0`, `Go 1.27+`). > - **Standalone LLM File:** [`/raw/post-quantum/go-zenon-v1-pq-implementation-spec.md`](pathname:///raw/post-quantum/go-zenon-v1-pq-implementation-spec.md) (feed directly to an AI coding agent alongside the `go-zenon-v1` repository). > - **Normative References:** [0x02 Addresses & AuthRegistry (#14)](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation) · [AccountBlock v2 & H_inc Rules](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching) · [Two-Lane Plasma & SporkMask](https://0x3639.com/zenon-phase-1/docs/post-quantum/dynamic-plasma-and-dos) · [Day-1 PoKoS & Complete Sunset](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue) · [Go 1.27+ Blueprint](https://0x3639.com/zenon-phase-1/docs/roadmap/go-zenon-v1-master-blueprint). ## 1. Purpose, Scope & Hard Invariants This specification is a **byte-exact, file-anchored engineering blueprint** for upgrading the [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1) full node and Pillar validator to full Post-Quantum capability **prior to** the Phase 1B Meta-DAG consensus swap. ### 1.1 In-Scope Deliverables (This Upgrade Series) 1. **Toolchain & PQ Cryptographic Core (`L0`):** Upgrade `go.mod` to `go 1.27.0`+, wire `crypto/mldsa` (`ML-DSA-44`, FIPS 204) with mandatory startup `AssertMLDSAReady()` KAT (`GOFIPS140 != v1.0.0`), non-separable key/alg-bound signing transcript **`boundDigest32` (`R4-01`)**, full pure-Go (`CGO_ENABLED=0`) `FN-DSA-512` keygen + signing + `0`-FPU integer-NTT verification (`fn-dsa v0.3` `32B` seed `R4-09`), pure-Keccak `SLH-DSA-SHAKE-128s` (FIPS 205), transitional `AlgHybridEdMLDSA44` (`0x81`), PQ `SLIP-0010` KDF, and true **`2^-128` QROM (`2^-256` classical RBR)** pure-`SHA3-256` `WHIR-SHA3-v1` zero-alloc verifier (`<= 8,000` Keccak perms `R4-04`). 2. **Phase 1A State & Account Layer (`Spork #9: StateRootSpork` + `Spork #10: PQAccountsSpork`):** - Domain-separated (`[0x00]` leaf / `[0x01]` internal) `smt-v1` depth-256 `SHA3-256` Sparse Merkle Tree committing `Momentum.StateRoot` on **`Momentum v3`** (`R4-07`). - **`AccountBlock v2`** preserving the exact `306-byte` `ComputeHash()` preimage while adding `ProofWitness` (tag `24`), `EquiXSolution` (tag `25`), witness-separated `[0x11]` persistence (`R4-07`), length-framed `(Hash, WitnessCommitment)` gossip dedup (`C03`), and `InvalidWitnessPenalty` peer scoring. - `20-byte` `0x02` PQ user addresses (`z1q{2,f,g,t}...`) + fail-closed `{0x00, 0x02}` sender class allowlist; `0x81` forbidden on unregistered `0x00` Path-C reveals (`R4-01`). - **`AuthRegistryContract` (`Embedded #14`, `z1qxemdeddedxauthxxxxxxxxxxxxxxxxx2a36sk`)**: `RotateKey`, `RescueWithPoKoS`, `PrecommitKey`, `UpgradeHybridToPureMLDSA44`, exact `179-byte` `GenesisHash`-bound PoP, `expectedRotationNonce` (`ErrAuthNonceOverflow`), **`ctx.InclusionHeight() + 1` promotion (`R4-03`)**, and **`O(1)` `GenesisReceive`- & producer-aware `pubKey_A`-bound `Ed25519-PoKoS` (`AuthRegistry[0x03]` + `AccountStore[0x0a]` + `ByHeight(1..2)` `R4-02`)**. - `AccountStore[0x09]` public-key caching + `32 B` `pubKeyHash` RAM pinning in `HotStateCache`. - `uint64 SporkMask` widening (preserving Phase 0 `0x1f` bits `0..4` verbatim), stateless `WitnessPlasma`, two-stage `Equi-X` verification, and `1`-slot/Momentum `PoKoS` anti-starvation in `ContentSelector`. - **`LegacyDposV1` PQ Pillar production & seal verification** supporting both in-place rotated `0x00` Pillars and native `0x02` producer addresses on `Momentum v3`. 3. **PQ P2P Transport (`v1.1` / `Phase 1A`):** `X25519MLKEM768` TLS 1.3 + `/znn/tls-pq/1.0.0` `ML-DSA-44` host identity in `internal/p2p/libp2p`, disabling classical `noise.ID` at `Spork #14`. 4. **Stake-Coordinated Hard-Fork Governance & Complete Classical Sunset (`Spork #14: LegacyCryptoSunsetSpork`):** - On-chain **`>= 85%` active-stake `MaxProtocolVersion` readiness across `2` consecutive epochs** + `HardForkEnforcementDelay = 8,640` (`24h`) for `Sporks #9..#14`. - Era-separated **`InclusionMomentumHeight` (`H_inc`)** enforcement across **both** user blocks and `GenerateEmbeddedReceive` (`DEEZ-B02, R4-03`), plus `Version = 2` upgrade on embedded `ContractReceive`/`ContractSend` blocks (`R4-03`). - Complete embedded-contract sunset (`BridgeContract` ECDSA, `SwapContract`, `Pillar.RegisterLegacy`, zero-stranded-funds `PtlcContract` `{0,1,2}` drain with `DeletePtlcReclaimLock`) + **`SunsetAnchorCheckpoint`** (`MaxPreCRQCBitcoinHeight`, `DEEZ-B11, B12, R4-09`). ### 1.2 Explicitly Out of Scope (Deferred to Subsequent Specs) * Phase 1B `Mahi-Mahi` / `Steelhead` Meta-DAG consensus, `M=4,096` voting shares, `HashRand-PQ` (`M_coin = 256`) coin, `Momentum v4` (`1.0 s`), `MomentumPQQC`, and `H_fork` `10x` height rescaling. * Phase 1C `SettlementContract (#13)` `Zeno` domains (`d_wasm`, `d_zvm`, `d_accounts`) — only the reserved `SettlementContract` address constant is pinned here. * Phase 1D `d_btc` SPV bridge and `ChannelContract (#15)` (`z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2`). ### 1.3 Non-Negotiable Engineering Invariants for the Implementing LLM 1. **Zero CGo in Production (`CGO_ENABLED=0`):** Every cryptographic keygen/signer/verifier, `Equi-X` solver/verifier, `WHIR-SHA3-v1` verifier, and trie implementation MUST compile and pass tests with `CGO_ENABLED=0` across `linux/amd64`, `linux/arm64` (Raspberry Pi 5), and `darwin/arm64` (using `CGO_ENABLED=1` solely when running `go test -race` `C05`). 2. **100% Phase 0 Alphanet Replay Parity:** For every Momentum `H` where `Spork #9` and `Spork #10` are inactive, `AccountBlock.ComputeHash()`, `AccountBlock.ChangesHash`, `Momentum.ComputeHash()`, `Momentum.ChangesHash`, Protobuf, RLP, JSON, and all 74 existing `vmerr` verdicts MUST remain **bit-for-bit identical** to `go-zenon-v1@1c6e3d8`. Never write `[0x09]`, `[0x0a]`, or `[0x11]` witness sidecars when `SporkBitPQAccounts` is inactive! 3. **Acyclic `L0–L9` Layering:** Preserve `go-zenon-v1`'s strict package DAG (`common/crypto` → `types/trie/storage` → `codec/nom/wallet/p2p` → `pow` → `chain` → `consensus` → `vm` → `protocol` → `pillar/rpc` → `node/cmd`). No upward imports or import cycles. 4. **Fail-Closed Parsing & Zero Panics:** Every wire decoder, signature verifier, ABI unpacker, and STARK verifier MUST validate lengths against frame bounds before allocating and return typed sentinel errors—never panic on hostile bytes. 5. **No Speculative `TODO` Stubs on Consensus Paths:** Every consensus check must be completely implemented and tested. --- ## 2. Ordered PR Implementation Graph (`PR-PQ-01` → `PR-PQ-08`) Implement and verify strictly in topological order so both `CGO_ENABLED=1 go test -race ./...` and `CGO_ENABLED=0 go test ./...` stay green after every single PR: ```mermaid flowchart TD P1["PR-PQ-01 · L0 Go 1.27+ & PQ Crypto
crypto/mldsa KAT, boundDigest32, full fn-dsa v0.3, SLH-DSA, 2^-128 QROM WHIR"] P2["PR-PQ-02 · L0-L1 Params, uint64 Sporks, 0x02 Addr & 0x00/0x01 smt-v1
params.go, spork.go, address.go (#14 AuthRegistry), trie/smtcore"] P3["PR-PQ-03 · L2 Wire Codecs, [0x11] Witness Sidecar & Dedup
AccountBlock v2 (tags 24..25), Momentum v3 (tag 14), WitnessCommitment"] P4["PR-PQ-04 · L3-L4 WitnessPlasma, Equi-X & AccountStore [0x09/0x0a]
uint64 SporkMask, equix.go, spork_index.go, HotStateCache 32B hash"] P5["PR-PQ-05 · L5-L6 AuthRegistry #14, H_inc VM/Verifiers & PQ DPoS Seals
O(1) exposure resolver, postPromoStore, InclusionHeight, Version=2 descendants"] P6["PR-PQ-06 · L6-L8 >=85% Spork Gate, Pillar Worker & Phase 1E Sunset
spork.go, pillar/worker+selector, Bridge/Swap/PTLC sunset, SunsetAnchor"] P7["PR-PQ-07 · L2/L8/L9 PQ P2P (/znn/tls-pq/1.0.0), Wallet, RPC & znnd
libp2p X25519MLKEM768+MLDSA44, PQKeyPair, embedded.auth.*, AssertMLDSAReady"] P8["PR-PQ-08 · Full Conformance, Fuzzing & Gate Qualification
G1, G7, G9, ZP-Q16..Q20, ZP-Q23..Q30 + Alphanet replay"] P1 --> P2 --> P3 --> P4 --> P5 --> P6 --> P7 --> P8 ``` --- ## 3. Critical `go-zenon-v1` Codebase Landmines (`10` Verified Traps — Read Before Editing!) Direct source audit of `go-zenon-v1` uncovered **10 concrete landmines** (`#1..#7` from `v3` + `#8..#10` uncovered in Round 4 `R4-02, R4-03, R4-07`) that will break compilation, sync, or consensus if missed: | # | Exact File & Line in `go-zenon-v1` | Existing Behavior | Required `v4` PQ Fix | |:---:|---|---|---| | **1** | `internal/vm/verifier/momentum.go:384,388` (`wrapIfBodyTampered`) | Hardcodes `len(blk.PublicKey) > 32 \|\| len(blk.Signature) > 64` to classify body tampering. | Replace with `ExceedsMaxWitnessBounds(blk)` (`v1`: `32/64`; `v2`: exact per-`algID` lengths + `ProofWitness <= 131,072` + `EquiXSolution <= 16`). | | **2** | `internal/consensus/engine/legacy_dpos.go:281-305` (`VerifyMomentumProducer`) | Hardcodes `len(m.PublicKey) == 32` and derives `producerAddr := types.PubKeyToAddress(m.PublicKey)`. | Resolve `expectedProducer` from `ElectionData` for `(tick, m.TimestampUnix)`, then match `m.PublicKey` against `AuthRegistry(expectedProducer)` (Path A), `DerivePQAddress` (`0x02`), or `PubKeyToAddress` (`0x00` pre-sunset). | | **3** | `internal/vm/verifier/momentum.go:468` & `account_block.go` | Evaluates spork masks exclusively at `blk.MomentumAcknowledged.Height` (`H_ack`). | Split heights (`DEEZ-B02`): evaluate `Version == 2` permission, `AuthRegistry` active key, and `SporkBitLegacyCryptoSunset` (`#14`) strictly at **`InclusionMomentumHeight` (`H_inc`)**, never `H_ack`! | | **4** | `internal/chain/account_store.go:67-84` & `genesis/builder.go:188` | Writes outside `[0x00..0x02]` enter `AccountBlock.ChangesHash`; Genesis `Height = 1` `GenesisReceive` has `len(PublicKey) == 0`! | Write `[0x09]`/`[0x0a]` **ONLY when `SporkBitPQAccounts` is active at `H_inc`**. Resolve legacy exposure in `O(1)` via `AuthRegistry[0x03]` + `[0x0a]` + `GenesisReceive`-aware `ByHeight(1..2)` (`R4-02`). For `v2` blocks, store stripped body + `WitnessCommitment` in `[0x02]` and raw witness in `[0x11]` (`R4-07`)! | | **5** | `internal/vm/supervisor/registry.go:19,225` (`ContractRegistry`) | Stores fixed `[32]map[types.Address]*compiledContract` indexed by 5-bit `uint8`. | Replace with a `uint64`-keyed cache compiling each normalized `uint64` mask on demand while fast-pathing `normMask <= 0x1f` into `[32]`. | | **6** | `internal/common/params.go:51,260,612` & tests | Tests index `cfg.ImplementedSporks[0..7]` directly and assert `len(EmbeddedContractsList()) == 12`. | **Preserve exact indices `0..7`!** Append `#9, #10, #14` at `[8..10]` (`[11]SporkDef`) and add `types.EmbeddedContractsForSporkMask(mask uint64)`. | | **7** | `internal/pillar/worker.go:197` (`NewPillarWorker`) | Hardcodes `len(cfg.ProducerKey.Public) != 32 \|\| len(cfg.ProducerKey.Private) != 64`. | Accept unified `wallet.Signer` / `*wallet.PQKeyPair` (`AlgID in {0x00, 0x01, 0x02, 0x03}`) signing `boundDigest32` on `Momentum v3`. | | **8** | `internal/vm/supervisor/momentum_vm.go:167,191` (`ApplyMomentum`, **`R4-03`**) | Executes `m.Content` blocks against `evalStore := parentStore` (ignoring `momOverlay`!). | After Step-0 `AuthRegistry` promotion on `momOverlay`, construct read-only `postPromoStore` over `momOverlay` as `evalStore` so blocks in `m.Content` see keys promoted at `m.Height`! Record `0x00` Momentum producer keys in `AuthRegistry[0x03]` *after* `m.Content` so producer `AccountBlock.ChangesHash`es never diverge (`R4-02`)! | | **9** | `internal/vm/supervisor/vm.go:671-687` (`GenerateEmbeddedReceive`, **`R4-03`**) | Rewinds `ctx.momentumStore`, `ctx.frontierMomentum`, and `ctx.sporkHeight` to `targetMA` (`H_ack`)! | Pass `inclusionHeight` (`m.Height`) and `inclusionStore` (`momStore`) into `GenerateEmbeddedReceive`! Phase 0 contracts keep `targetMA` snapshot reads, while **`Spork #14` sunset checks and `AuthRegistry` methods MUST read `ctx.InclusionHeight()` and `ctx.InclusionMomentumStore()`**! | | **10** | `internal/vm/supervisor/vm.go:758,813` & `pillar/updater.go` (**`R4-03`**) | Hardcodes `dblock.Version = cfg.AccountBlockVersion` (`1`) on `ContractSend` descendants, refunds, and `ContractReceive`s! | When `SporkBitPQAccounts` (`#10`) is active at `H_inc`, emit **`Version = 2`** on all generated `ContractReceive` and `ContractSend` blocks so `Spork #14` (`Require Version == 2`) never bricks embedded contracts! | --- ## 4. Detailed Package-by-Package Implementation Spec ### `PR-PQ-01` — Layer 0: `Go 1.27+` Toolchain & `internal/crypto` PQ Primitives #### 4.1.1 Toolchain, `boundDigest32` & Startup Self-Test (`go.mod`, `internal/crypto/pq_wire.go`) * Bump `go.mod`: `go 1.27.0` (verified on `go1.27.1`). Maintain `CGO_ENABLED=0`. * Create `internal/crypto/pq_wire.go` with exact algorithm IDs, wire sizes, and non-separable key-bound digest construction (`R4-01`): ```go title="internal/crypto/pq_wire.go" package crypto import ( "bytes" "crypto/mldsa" "crypto/sha3" "encoding/hex" ) const ( AlgEd25519 uint8 = 0x00 // Legacy RFC 8032 (disabled at H_inc >= H_sunset) AlgMLDSA44 uint8 = 0x01 // FIPS 204 (Go 1.27+ stdlib crypto/mldsa) AlgFNDSA512 uint8 = 0x02 // Draft FIPS 206 (pinned fn-dsa v0.3 32B seed, 0-FPU verify) AlgSLHDSA128s uint8 = 0x03 // FIPS 205 (SLH-DSA-SHAKE-128s pure Keccak) AlgXMSSShake22 uint8 = 0x04 // SP 800-208 (reserved for Phase 1B validator emergency) AlgProofWHIRSha3V1 uint8 = 0x10 // Pure-SHA3-256 WHIR-SHA3-v1 STARK (true 2^-128 QROM) AlgHybridEdMLDSA44 uint8 = 0x81 // Transitional Ed25519 AND ML-DSA-44 (0x02 or AuthRegistry only; disabled at H_sunset) Ed25519PubKeySize = 32 Ed25519SigSize = 64 MLDSA44PubKeySize = mldsa.MLDSA44PublicKeySize // 1312 MLDSA44SigSize = mldsa.MLDSA44SignatureSize // 2420 FNDSA512PubKeySize = 897 FNDSA512SigSize = 666 SLHDSA128sPubKeySize = 32 SLHDSA128sSigSize = 7856 HybridPubKeySize = Ed25519PubKeySize + MLDSA44PubKeySize // 1344 HybridSigSize = Ed25519SigSize + MLDSA44SigSize // 2484 WireEd25519PubSize = 1 + Ed25519PubKeySize // 33 WireEd25519SigSize = 1 + Ed25519SigSize // 65 WireMLDSA44PubSize = 1 + MLDSA44PubKeySize // 1313 WireMLDSA44SigSize = 1 + MLDSA44SigSize // 2421 WireFNDSA512PubSize = 1 + FNDSA512PubKeySize // 898 WireFNDSA512SigSize = 1 + FNDSA512SigSize // 667 WireSLHDSA128sPubSize = 1 + SLHDSA128sPubKeySize // 33 WireSLHDSA128sSigSize = 1 + SLHDSA128sSigSize // 7857 WireHybridPubSize = 1 + HybridPubKeySize // 1345 WireHybridSigSize = 1 + HybridSigSize // 2485 MaxSingleProofWitnessBytes = 131_072 // 128 KiB hard cap per AccountBlock EquiXSolutionSize = 16 // 8 x uint16 little-endian indices DomainAccountBlockV2 = "zenon-ab:v2" DomainMomentumV3 = "zenon-mom:v3" DomainAuthPopV3 = "zenon-auth-pop:v3" DomainPQAddressV1 = "zenon-pq-addr:v1" DomainPQSLIP0010V1 = "zenon-pq-slip0010:v1" DomainTLSExporterV1 = "zenon-tls-pq-auth:v1" ) // BoundSigningDigest computes SHA3-256(domainCtx || [0x00] || [algID] || SHA3-256(pubWire)[32] || msg[32]), // binding both algID and the complete public key (including both halves of 0x81) to prevent // hybrid stripping (0x81->0x00) and third-party key-splicing ransomware (0x00->0x81) (R4-01). func BoundSigningDigest(domainCtx string, pubWire []byte, msg []byte) [32]byte { pubHash := sha3.Sum256(pubWire) h := sha3.New256() _, _ = h.Write([]byte(domainCtx)) _, _ = h.Write([]byte{0x00, pubWire[0]}) _, _ = h.Write(pubHash[:]) _, _ = h.Write(msg) var out [32]byte _, _ = h.Read(out[:]) return out } ``` * **Unified Signing & Verification Rules (`R4-01`):** * For every `v2` `AccountBlock`, PQ `v3` `Momentum`, and `AuthPopV3` signature, compute `digest := BoundSigningDigest(domainCtx, pubWire, msg)`: * `0x01` (`ML-DSA-44`): `mldsa.Verify(pk, digest[:], rawSig, &mldsa.Options{Context: domainCtx}) == nil`. * `0x00` (`Ed25519` inside `v2`): `VerifyEd25519(edPub, digest[:], edSig)` (legacy `v1` `AccountBlock` / `v1..v2` `Momentum` continue signing raw `Hash[:]` unchanged!). * `0x02` (`FN-DSA-512`, `internal/crypto/fndsa512_v03.go`): full pure-Go `CGO_ENABLED=0` implementation of pinned `fn-dsa v0.3` (`32-byte` seed NTRU keygen + deterministic/emulated-binary64 signing + `0`-FPU integer-NTT `mod 12289` verification `R4-09`) over `digest[:]` with context `domainCtx`. * `0x03` (`SLH-DSA-SHAKE-128s`, `internal/crypto/slhdsa.go`): pure-Go FIPS 205 `SLH-DSA-SHAKE-128s` (`crypto/sha3.NewSHAKE256()`) over `digest[:]` with context `domainCtx`. * `0x81` (`AlgHybridEdMLDSA44`): returns `true` **iff BOTH** `VerifyEd25519(edPub, digest[:], edSig)` **AND** `VerifyMLDSA44(mldsaPub, digest[:], mldsaSig, domainCtx)` succeed (where `digest` commits to `[0x81] || edPub || mldsaPub`!). * **`AssertMLDSAReady()`** (`cmd/znnd/main.go`, `cmd/libznn`): verifies both the low-level `SignMLDSA44Deterministic` KAT (`621b16f8e3e2c7c064aec7ab540f1f64b1d1665feef964f07c6cded92d99f33b`) and the `BoundSigningDigest` KAT (`b7444ca31c5c802bd2cdc7f3fd5c76d1e2bce8655bfd44dd96a099e26c8608cf` over `SHA3-256("zenon-v4-bound-ab-kat")`), panicking fail-closed if `GOFIPS140=v1.0.0` disables `crypto/mldsa`. * **PQ `SLIP-0010` Derivation (`internal/crypto/slip0010.go`, `R4-09`):** * Master HMAC key `"zenon-pq-slip0010:v1"`, hardened path `m / 44' / 73404' / 1' / ' / '`: * `0x01`: `mldsa.NewPrivateKey(mldsa.MLDSA44(), leaf.Key[:])` (`32 B`) * `0x02`: `SHA3_256("zenon-fndsa512-keygen:v1" || leaf.Key[:])` (`32 B` seed -> `fn-dsa v0.3` keygen `R4-09`) * `0x03`: `SHAKE256("zenon-slhdsa128s-keygen:v1" || leaf.Key[:], 48)` -> FIPS 205 `(SK.seed[16], SK.prf[16], PK.seed[16])` * **True `2^-128` QROM `WHIR-SHA3-v1` Verifier (`internal/crypto/zkverify/whir_sha3_v1.go`, `R4-04`):** * Enforce hard pre-check bounds: `len(proofWire) <= 131_072`, `proofWire[0] == 0x10`, `foldingRounds <= 6`, `totalMerkleQueries <= 320`, **`keccakPerms <= 8,000`** (`<= 3.5 ms` on Cortex-A76 without `FEAT_SHA3`), **`32-bit` Fiat-Shamir PoW grinding** + `>= 224-bit` classical query security + `256-bit` extension field (`<= 2^-128` QROM soundness), `100%` `FIPS-202 SHA3-256`/`SHAKE256`, `0` heap allocations inside `arena *[262144]byte`. * `R_PoKoS` (`circuitId = 0x01`) public-input digest: ```text publicInputsDigest = SHA3_256( "zenon-pokos-pi:v3" || genesisHash[32] || be_u64(chainIdentifier) || targetAddress[20] || hasExposedPK[1] || // 0x00 (authenticated UNEXPOSED) or 0x01 (authenticated EXPOSED) expectedPubKeyA[32] || // [32]byte{0} iff hasExposedPK==0; exact 32B Ed25519 PK iff 1 popDigest[32] // SHA3-256 of exact 179B zenon-auth-pop:v3 preimage ) ``` --- ### `PR-PQ-02` — Layers 0–1: Params, `SporkId`s, `0x02` Addresses, Embedded `#14` & Domain-Separated `smt-v1` #### 4.2.1 `internal/types/spork.go` & `internal/common/params.go` * **Canonical Spork IDs:** `StateRootSpork = SporkId{31: 0x09}` (`Bit 8`), `PQAccountsSpork = SporkId{31: 0x0a}` (`Bit 9`, implies `Bit 8`), `LegacyCryptoSunsetSpork = SporkId{31: 0x0e}` (`Bit 13`, implies `Bits 9, 8`). * Keep `ImplementedSporks[0..7]` in exact existing order, extending to `[11]SporkDef`. * Add to `ProtocolParamsConfig`: `AccountBlockVersionV2 (2)`, `MomentumVersionV3 (3)`, `HardForkEnforcementDelay (8_640)`, `HardForkReadinessStakeBps (8_500)`, `HardForkReadinessEpochs (2)`, `Phase1AMaxBasePlasmaInMomentum (16_800_000)`, `Phase1AMaxProofWitnessBytes (524_288)`, and `SunsetAnchorCheckpoint` (`Height`, `MomentumHash`, `StateRoot`, `CommitteeHash`, `BitcoinAnchorHeight`, `MaxPreCRQCBitcoinHeight` `R4-09`). #### 4.2.2 `internal/types/address.go` * Add `PQUserAddrByte = 0x02`, `DerivePQAddress`, `IsPQUserAddress`, `IsAllowedUserSenderClass` (`{0x00, 0x02}`), `SettlementContract` (`z1qxemdeddedxsettlementxxxxxxxxxxxh5rx6j`), `AuthRegistryContract` (`z1qxemdeddedxauthxxxxxxxxxxxxxxxxx2a36sk`), and `EmbeddedContractsForSporkMask(mask uint64)`. #### 4.2.3 Domain-Separated `smt-v1` Sparse Merkle Tree (`internal/trie/smtcore/`, `R4-07` Fix) * Implement depth-256 binary `SHA3-256` Sparse Merkle Tree with **explicit RFC-6962-style leaf/internal domain separation (`R4-07`)**: * `EmptyHash = [32]byte{0}` at all 256 levels. * `LeafPath(logicalKey) = SHA3-256(logicalKey)` (32 bytes, MSB-first bit walk). * **`LeafHash(path[32], value) = SHA3-256([0x00] || path[32] || value)`** (prevents `32B`-value leaves from colliding with `64B` internal nodes!). * **`InternalHash(left[32], right[32]) = EmptyHash` if `left == 0 && right == 0`, else `SHA3-256([0x01] || left[32] || right[32])`**. * **Compact Proof Wire (`SMTProof`, `<= 1.2 KB`):** `[32B nonEmptyBitmap] || [k * 32B nonEmptySiblings]` walking all 256 levels deterministically. * **Committed Keys:** All live keys in `MomentumChanges` excluding `[0x00, 0x01, 0x02]`, persisted under Pebble namespace `[0x10] || nodeHash[32]` outside `MomentumChanges`. --- ### `PR-PQ-03` — Layer 2: `AccountBlock v2`, `[0x11]` Witness Sidecar, `Momentum v3` & Gossip Dedup #### 4.3.1 `internal/nom/account_block.go` & `[0x11]` Witness Sidecar (`R4-07` Fix) * Add `ProofWitness []byte` (Proto tag `24`; RLP elem `23`) and `EquiXSolution []byte` (Proto tag `25`; RLP elem `24`). Keep `306-byte` `ComputeHash()` unchanged! * **Witness-Separated `[0x02]` vs `[0x11]` Storage (`R4-07` Fix):** * For `Version == 1`: `buildStoredAccountPatch` (`account_pool.go:1009`) keeps `b.SerializeProto()` in `[0x02] || be_u64(height)` unchanged (`100%` Phase 0 `Momentum.ChangesHash` parity!). * For `Version == 2`: `[0x02] || be_u64(height)` stores `b.SerializeStrippedBodyProto()` (omitting `PublicKey`, `Signature`, `ProofWitness`, `EquiXSolution` and appending tag `26` `WitnessCommitment[32]`), while raw witness bytes are persisted in Pebble namespace **`[0x11] || b.Hash[32]`** (outside `MomentumChanges`) so `14`-day witness compaction never alters `Momentum.ChangesHash`! #### 4.3.2 `internal/nom/momentum.go` * Add `StateRoot types.Hash` (`Proto` tag `14`, `RLP` optional elem `14`); `Version >= 3` `ComputeHash()` hashes `208 B` (`StateRoot` at `176..208`); update `snapshotHashPreimage` in `verifier/momentum.go:56-85`. #### 4.3.3 Zero-Copy Frame Caps, Witness Validation & `(Hash, WitnessCommitment)` Dedup (`M02, C03`) * Keep `go-zenon-v1`'s zero-copy slice-bounded decoders (`MaxMsgSize = 10 MiB` P2P, `MaxHTTPBodySize = 5 MiB` RPC, `MaxDescendantDepth = 10,000`), enforce `ValidateAccountBlockWitnessCaps` immediately post-decode (`PublicKey` in `{0,33,898,1313,1345}`, `Signature` in `{0,65,667,2421,2485,7857}`, `ProofWitness <= 131,072` only to `AuthRegistry`/`Settlement`, `EquiXSolution` in `{0,16}`), charge `InvalidWitnessPenalty = 512` in `budget.go`, and key `TxMsg` broadcast/seen caches by `(block.Hash, WitnessCommitment)`. --- ### `PR-PQ-04` — Layers 3–4: `uint64 SporkMask`, `WitnessPlasma`, `Equi-X` & `AccountStore[0x09]/[0x0a]` * Widen `type SporkMask uint64` preserving Phase 0 `0x1f` bits `0..4` verbatim; register `AuthRegistryContract` (`0xeb35f142`, `0x60c3b470`, `0x3a1c6df1`, `0xe2043a81`) and `Pillar` (`0xc807dc32`, `0x0cf340ef`) at `EmbeddedSimplePlasma (52,500)`; implement `WitnessPlasma` and two-stage `Equi-X` (`internal/pow/equix.go`). * Add `KeyAccountCachedPublicKey = 0x09` and `KeyAccountLegacyEd25519PK = 0x0a` in `account_store.go`; pin only `32B` `SHA3-256(pubWire)` in `HotStateCache`; widen `SporkIndex` with downward closure (`LegacyCryptoSunset => PQAccounts => StateRoot`). --- ### `PR-PQ-05` — Layers 5–6: `AuthRegistry (#14)`, `O(1)` Exposure Resolver & `H_inc` Supervisor Fixes (`R4-01..R4-03`) #### 4.5.1 New Error Sentinels (`internal/vm/vmerr/errors.go`) Preserve all 74 existing verdicts verbatim and append `ErrABUnsupportedAddressClass`, `ErrABLegacyCryptoDisabled`, `ErrABPublicKeyMustBeCached`, `ErrABWitnessBoundsInvalid`, `ErrABProofWitnessInvalid`, `ErrMStateRootMismatch`, `ErrMProofWitnessTooBig`, `ErrAuthStaleGeneration`, `ErrAuthNonceOverflow`, `ErrAuthPendingRotationExists`, `ErrAuthInvalidPop`, `ErrAuthTargetAlreadyPQ`, `ErrAuthAddressDerivationMismatch`, `ErrAuthUnknownExposure`, `ErrAuthInvalidPoKoS`, `ErrSporkReadinessNotMet`. #### 4.5.2 `AuthRegistryContract (#14)` & `O(1)` Legacy Exposure Resolver (`R4-02, R4-03` Fix) * **Storage Layout inside `[0x04]`:** * `PrefixAuthRecord = 0x01`: `[0x01] || targetAddr[20]` → ABI `authRecord` * `PrefixPendingIndex = 0x02`: `[0x02] || be_u64(pendingEffectiveHeight) || targetAddr[20]` → `be_u64(1)` * **`PrefixExternalEd25519Reveal = 0x03` (`R4-02`):** `[0x03] || addr[20]` → `pk32[32]`, populated ONLY for non-`AccountBlock` `Ed25519` signature reveals (`Momentum` `0x00` producer keys & `PtlcContract` `PointTypeEd25519` unlocks — `< 250` entries total = `< 15 KiB`!). At `H_spork10` Step 0, seed `[0x03]` from the `<= 150` historical Pillar producer/PTLC reveals (`< 1 ms`), and after `m.Content` in each `Momentum`, record any unrotated `0x00` `m.PublicKey` into `[0x03]` (never mutating `AccountStore(producer)`, avoiding `AccountBlock.ChangesHash` conflicts!). * **Execution Context (`R4-03`):** All 4 `AuthRegistry` methods execute against **`ctx.InclusionMomentumStore()`** (`momStore`, seeing live intra-Momentum writes!) and compute **`pendingEffectiveHeight = ctx.InclusionHeight() + 1`** (NEVER `targetMA.Height + 1`!). Enforce `rec.RotationNonce < math.MaxUint64` (`ErrAuthNonceOverflow`). * **`ResolveLegacyEd25519Exposure(ms, targetAddress)` inside `RescueWithPoKoS` (`O(1)`, `R4-02`):** 1. Check `AuthRegistry[0x03 || targetAddress]` and `AccountStore(targetAddress)[0x0a]`: if found (asserting `PubKeyToAddress(pk32) == targetAddress`; mismatch fails closed), return `(hasExposedPK = 1, pk32)`. 2. Else inspect `hh = acct.Identifier()`: * `hh.Height == 0`: return `(0, [32]byte{0})`. * `hh.Height == 1`: load `blk1 := acct.ByHeight(1)`. If `blk1 == nil`, return `ErrAuthUnknownExposure`! If `blk1.BlockType == BlockTypeGenesisReceive`, return `(0, [32]byte{0})`; else return `(1, blk1.PublicKey[0:32])`. * `hh.Height >= 2`: load `blk1 := acct.ByHeight(1)`; if `blk1 != nil && blk1.BlockType != BlockTypeGenesisReceive`, return `(1, blk1.PublicKey[0:32])`; else load `blk2 := acct.ByHeight(2)` (returning `ErrAuthUnknownExposure` if `nil`, else `(1, blk2.PublicKey[0:32])`). #### 4.5.3 `MomentumVM`, `GenerateEmbeddedReceive` & Verifiers (`R4-01, R4-03` Fix) * **`momentum_vm.go` (`Landmine #8`):** Run Step-0 `AuthRegistry` promotion on `momOverlay`, then construct `postPromoStore` over `momOverlay` as `evalStore` for `m.Content`! After `m.Content` succeeds and before `MomentumChanges()`, if `SporkBitPQAccounts` is active and `len(m.PublicKey) == 32` (`0x00` unrotated producer), stage `AuthRegistry[0x03 || expectedProducer] = m.PublicKey` if absent. * **`vm.go` (`Landmines #9 & #10`):** Pass `inclusionHeight` (`m.Height`) and `inclusionStore` (`momStore`) into `GenerateEmbeddedReceive`; emit `AccountBlock.Version = 2` on all generated `ContractReceive` (`AutoReceiver`) and `ContractSend` descendants/refunds whenever `SporkBitPQAccounts` is active at `H_inc`! * **`account_block.go` (`R4-01`):** On Path C (`First Reveal`), **forbid `algID == 0x81` when `Address[0] == 0x00`** (`Address[0] == 0x00` Path C permits ONLY `algID == 0x00` pre-sunset; `0x81` requires `0x02` address derivation or `AuthRegistry` PoP!). Verify all `v2` signatures over `BoundSigningDigest`. --- ### `PR-PQ-06` — Layers 6–8: `>= 85%` Spork Gate, Pillar Worker & Phase 1E Sunset (`R4-03, R4-09`) * Enforce `>= 85%` active-stake 2-epoch `MaxProtocolVersion` readiness + `HardForkEnforcementDelay = 8,640` (`24h`) in `Spork.ActivateSpork`. * Enforce Phase 1E sunset (`Bridge`, `Swap`, `Pillar.RegisterLegacy`, `PTLC {0..2}`) at **`H_inc >= H_sunset`** inside BOTH `ApplySend` and `ReceiveBlock` (`ctx.InclusionHeight()` `R4-03`). In post-expiry `Ptlc.Reclaim(id)`, call **both `DeletePtlcInfo` and `DeletePtlcReclaimLock`** (`R4-03`). * Enforce `SunsetAnchorCheckpoint` (`Height`, `MomentumHash`, `StateRoot`, `MaxPreCRQCBitcoinHeight` `R4-09`) in `downloader.go` and `reorg.go`. --- ### `PR-PQ-07` — Layers 2, 8 & 9: `/znn/tls-pq/1.0.0`, PQ Wallet, RPC & `znnd` Startup KAT * Register `/znn/tls-pq/1.0.0` (`X25519MLKEM768` + `ML-DSA-44` exporter binding), disable `noise.ID` at `Spork #14`, add `PQKeyPair` (`SignAccountBlockV2` / `SignMomentumV3` using `BoundSigningDigest`), expose `embedded.auth.*` + `ledger.getStateProof` RPCs, and call `crypto.AssertMLDSAReady()` at `znnd` startup. --- ### `PR-PQ-08` — Mandatory Verification Matrix & Qualification Gates (`C05` + `R4-01..R4-09`) Every PR MUST pass **both** `CGO_ENABLED=1 go test -race ./...` and `CGO_ENABLED=0 go test ./...` (`C05`) plus: | Gate | Exact Test Suite in `go-zenon-v1` | Pass Criterion | |:---:|---|---| | **`G1`** | `internal/crypto/pq_kat_test.go`, `pq_address_test.go`, `pq_codec_test.go` | Matches `Go 1.27` `ML-DSA-44` low-level (`621b16f8...`) & `BoundSigningDigest` (`b7444ca3...`) KATs, `z1qgyf208a5...`, `179 B` PoP, `[0x00]/[0x01]` `smt-v1`, `[0x11]` witness sidecars, and 100% Phase 0 replay parity. | | **`G7` / `ZP-Q16` / `ZP-Q27`** | `internal/vm/contracts/auth/auth_test.go`, `pq_verifier_test.go` | Rejects `0x81->0x00` stripping & `0x00->0x81` ransomware (`R4-01`), tests `postPromoStore` `evalStore` + `ctx.InclusionMomentumStore()` intra-Momentum reveals (`R4-03`), `GenesisReceive` `H=1` unexposed vs `H=2` exposed + Pillar `[0x03]` `PoKoS` (`R4-02`), and `ErrAuthNonceOverflow`. | | **`ZP-Q17` / `ZP-Q30`** | `internal/pow/pq_plasma_test.go`, `internal/storage/pruner_pq_test.go` | Phase 0 `0x1f` parity, per-suite `WitnessPlasma` monotonicity, `1` reserved `PoKoS` slot, and `100%` `Momentum.ChangesHash` replay across days `15..30` after `[0x11]` `14`-day witness compaction (`R4-07`). | | **`G9` / `ZP-Q19`** | `internal/crypto/pq_fuzz_test.go`, `equix_test.go`, `pq_tls_test.go` | Zero panics under `go test -fuzz` on `ML-DSA-44`, pure-Go `fn-dsa v0.3` (`0` FPU instructions in verify!), `SLH-DSA-128s`, `Equi-X`, and `/znn/tls-pq/1.0.0`. | | **`ZP-Q20` / `ZP-Q28`** | `internal/crypto/zkverify/whir_sha3_v1_test.go` | `0` heap allocs in `256 KiB` arena, `32-bit` grind + `224-bit` query (`2^-128` QROM), rejects `> 8,000` Keccak perms in `< 50 µs`, `<= 3.5 ms` on Pi 5 Cortex-A76 (`R4-04`). | | **`ZP-Q23`–`Q26`** | `internal/vm/verifier/sunset_test.go`, `sunset_anchor_test.go` | Rejects `H_ack < H_sunset` bypasses on BOTH user blocks AND `Bridge`/`Swap`/`PTLC` `ContractReceive`s at `H_inc >= H_sunset`, verifies `Version = 2` embedded `ContractSend`s (`R4-03`), cleans `ptlcReclaimLock` on `Reclaim`, and enforces `SunsetAnchorCheckpoint`. | --- ## 5. Copy-Paste LLM Coding Agent Execution Prompt ```text You are upgrading 0x3639/go-zenon-v1 to implement the v4-verified Post-Quantum validator upgrade defined in ZNN-IMP-PQ-V1: https://0x3639.com/zenon-phase-1/raw/post-quantum/go-zenon-v1-pq-implementation-spec.md Execution rules: 1. Work strictly in PR order: PR-PQ-01 -> PR-PQ-02 -> ... -> PR-PQ-08. 2. Hard invariants: - CGO_ENABLED=0 pure Go on Go 1.27+ in production; zero floating-point math in consensus/verify. - Preserve strictly acyclic L0-L9 package layering and 100% Phase 0 historical replay parity. - Address all 10 codebase landmines in Section 3 (including BoundSigningDigest R4-01, O(1) GenesisReceive/producer exposure resolver R4-02, postPromoStore + InclusionHeight/Store + Version=2 embedded descendants R4-03, [0x00]/[0x01] smt-v1 & [0x11] witness sidecars R4-07). 3. After each PR slice, run BOTH: CGO_ENABLED=1 go test -race ./... CGO_ENABLED=0 go test ./... and report exact files changed, tests added, and gate verification results before advancing. ``` ================================================================================ CHAPTER 14 / 31: System Model, Quantized M=4,096 Quorums, Pure-SHA3 HashRand-PQ Coin & PQ Consensus Crypto FILE: docs/consensus/system-model-and-pq-crypto.md | URL: https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto ================================================================================ # System Model, Quantized `M=4,096` Quorums, Pure-`SHA3-256` `HashRand-PQ` Coin & PQ Consensus Crypto > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciling `ZDC-ZP1-HR-001` (`B01–B04, H05, M04`) and the Round-4 Cryptographic Audit (`R4-05`), **Zenon Phase 1 `v4`** locks a mathematically sound, zero-lattice-coin post-quantum asynchronous system model: > 1. **Congruence-Exact Quantized Voting Shares (`M_shares = 4,096 = 3 * 1,365 + 1`, `B04` fix):** `F_Q = 1,365`, `Q_vote = 2,731`, restoring **`2 * Q_vote - M_shares = 1,366 > F_Q`** (`<= 32.54%` raw-stake safety margin at `k = 33`) with `0` zero-share active seats! > 2. **Pure-`SHA3-256` `HashRand-PQ` Asynchronous Common Coin (`R4-05` fix, replacing `v2/v3` `Module-SIS RLC`):** Eliminates the characteristic-mismatch (`char 2` vs `mod 8,380,417`), `1,280 B` norm-overflow, `1,981 Mbps` full-matrix `RBC`, and `0x04` lattice-dependency defects of `v2/v3` by pairing a congruence-exact **`M_coin = 256 = 3 * 85 + 1`** (`F_coin = 85`, `Q_coin = 171`, `T_coin = 86`, `c_i <= 13`) `GF(2^256)` Shamir coin with **column-major `SHA3-256` `AVID-FP` manifest dispersal** (`2.03 MiB` dealer matrix, `< 8 MB` RSS, **`0.69–1.34 Mbps`** background TX, **`1.49–2.54 Mbps`** salt-free `1.0 Hz` reveal, **zero lattice assumptions**!). > 3. **Dual-Tree `XMSS-SHAKE_22_256` (`0x04`) Emergency Fallback (`M04` + `R4-05` fix):** Disjoint `2^22`-leaf DAG and QC keys (`24.2 days` capacity each), `fdatasync` WAL index lock, optional `HQC-192` code-based KEM combiner for zero-lattice share secrecy, and `2 Hz` (`5.57 Mbps` base / `6.17–6.59 Mbps` w/ coin) degraded pace. --- ## 1. Epoch Committee, `M_shares = 4,096` Voting Quorums & `M_coin = 256` Coin Shares (`B04` + `R4-05` Fix) ### 1.1 Deterministic Epoch Committee (`P_E`) & Minimum Share Guard Time is partitioned into sequential epochs `E in {0, 1, 2, ...}` (`EpochDuration = 86,400` `1.0 s` `Momentum v4` blocks). At the certified `EpochTerminalDescriptor(E - 1)`, every node deterministically derives `CommitteeManifest(E)`: * **Minimum Active Eligibility (`0` Zero-Share Voting Seats):** Only registered Pillars with weight `w_i >= ceil(W_total / 4,096)` (`~0.0244%` of active stake, capped at `N <= 100` active seats by stake rank) enter `P_E = {P_0, ..., P_{N-1}}`, guaranteeing **`s_i >= 1`** for every member of `P_E`. * **Congruence-Exact Quantized Voting Vector (`M_shares = 4,096`):** Because `4,096 = 2^12` AND `4,096 = 3 * 1,365 + 1` (`4,096 mod 3 == 1`), deterministic Hamilton largest-remainder allocation produces integer voting shares `s_i >= 1` (`sum_{i=0}^{N-1} s_i = 4,096`) satisfying the exact BFT quorum intersection identity: ```text M_shares = 4,096 F_Q = (M_shares - 1) / 3 = 1,365 // Max quantized Byzantine voting shares (< 1/3) Q_vote = M_shares - F_Q = 2,731 // Supermajority consensus quorum (>= 2*F_Q + 1) Quorum Intersection Identity: 2 * Q_vote - M_shares = 2 * 2,731 - 4,096 = 1,366 == F_Q + 1 > F_Q! ``` * **Voting Raw-Stake Rounding Margin (`B04`):** Largest-remainder rounding across `k` Byzantine Pillars increases their quantized sum above raw stake by strictly less than `k` shares (`sum_{i in Byz} s_i < (W_byz / W_E) * 4,096 + k`). Consensus **safety** holds unconditionally whenever `sum_{i in Byz} s_i <= 1,365`, guaranteed for all raw Byzantine stake fractions **`W_byz / W_E <= (1,365 - k + 1) / 4,096`** (`<= 32.54%` raw stake at `k = 33`). * **Congruence-Exact Coin Share Vector (`M_coin = 256`, `R4-05` Fix):** For the pure-`SHA3-256` `HashRand-PQ` common coin (§3), `CommitteeManifest(E)` derives a compact quantized coin vector `c_0, ..., c_{N-1}` via capped Hamilton largest-remainder allocation on `M_coin = 256 = 3 * 85 + 1` with per-seat whale cap **`c_i <= 13` (`5.08%`)** (redistributing any excess above `13` pro-rata across uncapped active seats; dust seats with `< 0.2%` stake may have `c_i = 0` while keeping `s_i >= 1` voting weight): ```text M_coin = 256 F_coin = (M_coin - 1) / 3 = 85 // Max quantized Byzantine coin shares (< 1/3) Q_coin = M_coin - F_coin = 171 // Supermajority coin availability quorum T_coin = F_coin + 1 = 86 // Shamir reconstruction threshold (deg <= 85) Coin Intersection Identity: 2 * Q_coin - M_coin = 2 * 171 - 256 = 86 == F_coin + 1 == T_coin! ``` By the Hamilton Remainder Sum Lemma (`sum_{i in S} (c_i - 256 * w_i) <= k * (1 - k/N)`), `sum_{i in Byz} c_i <= 85` holds up to **`~30.1–33.2%` unground Byzantine stake** (and unconditionally up to `24.61%` at `N = 100`, `26.95%` at `N = 67`, `33.20%` at `N = 30` even under adversarial sub-token remainder grinding, while safety `Q_vote = 2,731 / 4,096` always holds up to `32.54%`). * **Subject-Binding Rule (`HR-02`):** Each Pillar `P_i`'s shares (`s_i`, `c_i`) MUST be counted **at most once** per `(subject, context)`, never unioning support across conflicting equivocations. ### 1.2 Mandatory Asynchronous Liveness * **Safety:** Holds **unconditionally under full asynchrony (`Delta` unbounded)**, independent of local wall clocks. * **Liveness:** * **Healthy Interval:** Commits in **`3 Delta`** (`~600 ms` at `5 Hz` default pace, `~350 ms` at `10 Hz`) on `Profile B` (once `ZP-Q11` passes) or **`1.0 s` (`5` rounds at `5 Hz`)** on `Profile C-AS`. * **Adversarial Asynchronous Regime (`Delta` unbounded, targeted DDoS / BGP delay):** Terminates with **probability `1` in `O(1)` expected non-overlapping 5-round waves** (`Mahi-Mahi` `Profile C-AS` shipping default with `stride = 5`, matching `1.0 s` `Momentum v4` cadence `1:1` — see [Uncertified Meta-DAG](https://0x3639.com/zenon-phase-1/docs/consensus/uncertified-meta-dag)). --- ## 2. Normative Post-Quantum Consensus Cryptographic Suite (`R4-05, M04, M12`) | Consensus Role | Standard & Pinned Implementation | Wire Footprint | Why Selected & `v4` Hardening | |---|---|---|---| | **DAG Vertex & `MomentumQC` Auth (`0x02`)** | **`FN-DSA-512`** (`draft-FIPS-206`, pure-Go `fn-dsa v0.3` KAT vectors `R4-09`) | `897 B` PK / **`666 B` Sig** | `3.6x` smaller than `ML-DSA-44`; integer NTT (`mod 12289`) verify in `~35 µs`; `3.825 Mbps` direct mesh at `5 Hz` (`M01`). | | **Zero-Lattice Emergency Consensus (`0x04`)** | **Dual-Key `XMSS-SHAKE_22_256`** (NIST SP 800-208, `h = 22` -> `4,194,304` leaves) | `64 B` Root × 2 / **`2,884 B` Sig** | Separate `xmss_dag_root` & `xmss_qc_root` (`24.2 days` each at `2 Hz` = `5.57 Mbps` base), `fdatasync` WAL index lock (`M04`); `0` lattice assumptions. | | **PQ Asynchronous Common Coin (`R4-05`)** | **Pure-`SHA3-256` `HashRand-PQ` (`GF(2^256)` Shamir + `AVID-FP`)** | **`1,638–2,785 B` avg** (`8.3–14.1 KiB` `5%`-cap) | `128-bit` Grover secret (`GF(2^256)`), `2.03 MiB` dealer matrix (`< 8 MB` RSS), `0.69–1.34 Mbps` `AVID-FP` dealing, **`0` lattice assumptions**! | | **Validator & Sentinel P2P Transport** | **Hybrid `X25519MLKEM768` + `ML-DSA-44` `peer.ID`** (`Go 1.27+` stdlib `crypto/tls` + `crypto/mldsa`) | `~1.1 KiB` per handshake | Closes `HNDL` and `secp256k1` MITM peer spoofing; optional `HQC-192` code-based KEM combiner for `0x04` emergency mode. | --- ## 3. Pure-`SHA3-256` `HashRand-PQ` Common Coin (`R4-05` Fix — Replacing `Module-SIS RLC`) Our Round-4 cryptographic audit (`R4-05`) demonstrated four fatal flaws in `v2/v3`'s `Module-SIS RLC` coin: (1) characteristic mismatch between `GF(2^256)` (`char 2`) Shamir interpolation and FIPS-204 `R_q` (`mod 8,380,417`) additive homomorphism, (2) `1,280 B` norm overflow (`1` packed `R_q` element alone is `736 B`), (3) `1,981 Mbps` full-matrix `RBC` echo amplification across `100` dealers, and (4) lattice dependence inside `0x04` `XMSS` "zero-lattice" emergency mode. **`ZNN-SPEC-PHASE1-v4` replaces `Module-SIS RLC` with pure-`SHA3-256` `HashRand-PQ` (adapted from Das-Xiang-Kokoris-Kogias-Ren CCS 2024):** ### 3.1 Secret Field, `4`-Row Degree Check & `2.03 MiB` Dealer Matrix (`R4-05`) * **Field & Threshold:** `GF(2^256)` (`X^256 + X^10 + X^5 + X^2 + 1`, `32 bytes` per evaluation -> **`128-bit` Grover secret strength**), polynomial degree `<= T_coin - 1 = 85` across `M_coin = 256` evaluation points. * **Sub-Epoch Bank Size & Blinding Rows:** Each bank covers `B_batch = 256` non-overlapping 5-round waves (`1,280` DAG rounds = `256.0 s` at `5 Hz`) plus **`4` independent random degree-`<= 85` blinding polynomials `b_0..b_3`** (`B_polys = 260` rows total). * **Peak Dealer Memory (`16x` Smaller Than `v3`):** `260 rows × 256 coin shares × 32 B = 2,129,920 B` (**`2.03 MiB`** raw matrix per dealer, computed in **`< 8 MB` peak RSS** on an `8 GB` Raspberry Pi 5!). ### 3.2 Column-Major `AVID-FP` Dispersal & `2^-512` QROM Degree Verification (`0` Circularity) Validators maintain a rolling 2-bank ring buffer (`Active Bank b`, `Pre-Staged Bank b+1`) on `/znn/dag/avss/v4`: 1. **Column-Major `LeafHashManifest(d, b)` (`812.5 KiB`):** Candidate dealer `P_d` (from the canonical stake-rank prefix `D_cand` summing to `>= Q_vote = 2,731` voting shares, `40..67` Pillars) computes for each row `r in 0..259` and Pillar `j in 0..N-1`: ```text BundleHash[r][j] = FIPS202_SHA3_256("ZNN/hr-bundle/v4" || be_u32(b) || be_u16(d) || be_u16(r) || be_u16(j) || shares_{d, r, Owned(j)}[32 * c_j]) ColHash[j] = FIPS202_SHA3_256("ZNN/hr-col/v4" || be_u32(b) || be_u16(d) || be_u16(j) || BundleHash[0..259][j]) ManifestRoot = SHA3MerkleRoot(ColHash[0 .. N-1]) ``` *(Notice: Because each `GF(2^256)` polynomial of degree `85 >= c_j` (`85 >= 13`) evaluates independently and uniformly on `Owned(j)` conditioned on up to `85 - c_j` adversarial shares when `P_d` is honest, even a `1`-share bundle `c_j = 1` already possesses **`256` bits of conditional Shannon entropy (`128` Grover bits)** — requiring **`0` random salt bytes**!)* 2. **Fiat-Shamir `GF(2^256)` Linear-Combination Degree Check (`10.75 KiB`, `2^-512` QROM):** Using `SHAKE256("ZNN/hr-deg/v4" || ManifestRoot)` to derive `4 × 256` scalars `alpha_{k, w} in GF(2^256)`, `P_d` publishes the `4` degree-`<= 85` polynomials `L_k(X) = b_k(X) + sum_{w=0}^{255} alpha_{k,w} * f_{d,w}(X)` (`4 × 86 × 32 B = 11,008 B`). Soundness error against a non-degree-`85` row is `(2^-256)^4 = 2^-1024` classical / **`2^-512` QROM** with zero leakage of `f_{d, 0..255}(0)`! 3. **`1`-Hop Share Delivery + `(100, 34)` Reed-Solomon `AVID-FP` Shard (`0.69–1.34 Mbps` Total TX):** * `P_d` encodes `(LeafHashManifest[832,000 B] || L_0..L_3[11,008 B])` (`843,008 B`) into `100` `GF(2^16)` Reed-Solomon shards (`24,795 B` each) committed under `SHA3-256` `CodedRoot`, and unicasts to each `P_j`: (a) `Enc(pk_j, shares_{d, 0..259, Owned(j)})` (`ML-KEM-768` + `AES-256-GCM`, plus optional `HQC-192` hybrid KEM under `0x04`), (b) `224 B` Merkle branch for `ColHash[j]` in `ManifestRoot`, and (c) `Shard_j` + `224 B` branch in `CodedRoot` (`~4.52 MiB` total TX once per `256 s` = `0.17 Mbps`). * `P_j` decrypts its shares, checks `ColHash[j]` against `ManifestRoot`, checks all `4` `L_k` degree equations on `Owned(j)`, checks `Shard_j` against `CodedRoot`, and returns a `666 B` `FN-DSA-512` receipt `DealerAck(b, d, ManifestRoot, CodedRoot)`. * Once `P_d` aggregates `DealerAck`s spanning **both `>= Q_vote = 2,731` voting shares and `>= Q_coin = 171` coin shares** into `DealerCert`, at least `171 - 85 = 86 == T_coin` honest coin shares hold verified evaluations and `>= 34` honest Pillars hold verified `Shard_j`s! 4. **Canonical Re-Encoding Agreement on `D_agreed(b)` (`AVID-FP` Uniqueness):** Validators pull `34` `Shard_j`s (`825 KiB`), interpolate `(LeafHashManifest, L_0..L_3)`, **re-encode all `100` Reed-Solomon shards deterministically**, and verify `CodedRoot(RS_Encode(M)) == Cert.CodedRoot && ManifestRoot(M) == Cert.ManifestRoot` (by minimum distance `67` and `SHA3-256` collision resistance, either *every* `34`-subset of valid shards passes and yields identical `M`, or *every* `34`-subset fails!). The lowest-index certified dealers summing to `>= F_Q + 1 = 1,366` voting shares (`K_d = 20..34` dealers -> **at least `1` honest dealer guaranteed!**) form `D_agreed(b)` (`0.69–1.34 Mbps` background TX / `0.73–1.23 Mbps` RX!). ### 3.3 Salt-Free, Branch-Free Online Reveal (`1.0 Hz`, `1.49–2.54 Mbps` Framed TX) On the coin-reveal round (`r_4`) of wave `w` (`1.0 Hz` at `5 Hz` `stride = 5`), Pillar `P_j` (`c_j >= 1`) broadcasts `(shares_{d, w, Owned(j)})_{d in D_agreed(b)}`: * **Verification (`O(K_d)` Single-Block `SHA3-256` Lookups, `0` Merkle Siblings on Wire):** Receiver hashes each `32 * c_j`-byte slice once and compares directly against pre-staged `LeafHashManifest(d, b)[w][j]` in RAM (`< 12 µs` per peer!). * **Exact Online Reveal Footprint (`R4-05` Closed):** * **Average Pillar (`c_j = 2.56` shares, `K_d = 20..34`):** **`1,638 – 2,785 B`** (**`1.49 – 2.54 Mbps`** framed TX across `99` peers at `1.0 Hz`!). * **`5%`-Capped Whale (`c_j = 13` shares, `K_d = 20..34`):** **`8,320 – 14,144 B`** (`7.58 – 12.89 Mbps` coin TX, well within `25 Mbps` Sovereign Pi 5 TX!). * **Unique `256-Bit` Coin Reconstruction:** Upon verifying `>= T_coin = 86` coin shares for every `d in D_agreed(b)`, any node interpolates each `f_{d, w}(0)`, sums **`S_w = XOR_{d in D_agreed(b)} f_{d, w}(0)`** in `GF(2^256)` (`0` subset grinding, `256` bits unconditional entropy from `>= 1` honest dealer!), and derives: ```text Coin_w = FIPS202_SHA3_256("ZNN/pq-coin/v4" || be_u64(ChainId) || be_u64(E) || be_u64(w) || S_w[32]) Leader(w) = ShareOwner(be_u128(Coin_w[0:16]) mod 4096) // 2^-116 modulo bias (< 2^-100) ``` --- ## 4. `Joint-Epoch Freeze` & Dual-Key `XMSS-SHAKE_22_256` (`0x04`) Emergency Mode (`M04` + `R4-05` Fix) 1. **`Joint-Epoch Freeze` (`C08`):** If epoch boundary transition is delayed during an extended partition, `P_E`, `s_i` (`4,096` voting shares), `c_i` (`256` coin shares), **and all `Pillar`/`Stake` unbonding exits remain frozen** until `EpochTerminalDescriptor(E)` commits (`HashRand-PQ` banks continue replenishing seamlessly across the extension via §3.2!). 2. **True Zero-Lattice Emergency `XMSS-SHAKE_22_256` (`0x04`, `M04` + `R4-05` Fix):** * Each validator registers **two independent `h = 22` (`4,194,304`-leaf) `XMSS-SHAKE_256` roots** in `CommitteeManifest`: `xmss_dag_root` (indexed strictly by `round mod 2^22`) and `xmss_qc_root` (indexed strictly by `height mod 2^22`). * Before emitting any `0x04` signature (`2,884 B` = `4B idx + 32B r + 2,144B WOTS+ + 704B auth22`), `xmss_wal.go` persists `high_water_idx` via **`fdatasync()`** so power loss can never reuse a one-time WOTS+ leaf. * Activating `0x04` steps DAG round cadence to **`2 Hz`** (`0.4 Hz` non-overlapping `stride = 5` coin reveal = **`5.57 Mbps` base + `0.60–1.02 Mbps` coin = `6.17–6.59 Mbps` framed TX**, `24.2 days` runtime per `2^22` tree) and enables the `HQC-192` code-based KEM combiner on `/znn/dag/avss/v4`—making **100% of consensus auth, coin soundness, and coin secrecy completely independent of lattices**! ================================================================================ CHAPTER 15 / 31: Direct Validator Mesh, Sentinel D1 Sidecar, 2D AVID Economics & 25 Mbps Shaper FILE: docs/consensus/sentinel-workers-and-routing.md | URL: https://0x3639.com/zenon-phase-1/docs/consensus/sentinel-workers-and-routing ================================================================================ # Layer 1: Direct `1-Hop` Validator Mesh, Sentinel `D1` Sidecar, `2D AVID` Economics & `25 Mbps` Shaper > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciles `ZDC-ZP1-HR-001` (`M01, H08, M08`) and Round-4 `HashRand-PQ` + `stride = 5` bandwidth accounting (`R4-05`): > 1. **Direct `1-Hop` Point-to-Point Validator Mesh (`M01` + `R4-05` fix):** Active Pillars (`N <= 100`) exchange compact DAG vertices (`840 B`), `1.0 Hz` `HashRand-PQ` coin shares (`1,638–2,785 B` avg), and `1.0 Hz` `MomentumPQQC` votes directly over `N - 1` authenticated `X25519MLKEM768` streams with **zero multi-hop GossipSub vertex forwarding**—locking Pillar DAG+Coin TX at **`5.32–6.37 Mbps` (`5 Hz` default)** (`6.88–7.93 Mbps` steady w/ QC + batch, `7.57–9.27 Mbps` during `AVID-FP` replenishment)! > 2. **Native vs. Coded Possession Mode (`H08` fix):** Normal L1 `WorkerBatchProto` blocks (`<= 7.9 Mbps` max burst) use **`NATIVE_FULL` possession** (`0` `44.6 KiB` `CustodyCert` overhead), while `CustodyCertProto` (`M_slots = 100`, `FN-DSA-512`) is reserved strictly for `>= 1 MiB` `DA_BATCHED` `Zeno` rollup blobs and `60 s` `ManifestV1` cold archival segments! > 3. **Sentinel Custody Economics & Objective Slashing (`M08` fix):** `5,000 ZNN + 50,000 QSR` bond, protocol epoch custody rewards + `znnPerMiBDaBlob` DA fees, and `50%` objective slashing on conflicting `2D AVID` root signatures. --- ## 1. Separating Transport (`T`), Native Possession (`A_L1`), and Coded DA / Retention (`R`) (`H08` Fix) | Plane | Scope in `ZNN-SPEC-PHASE1-v4` | Wire & Security Invariant (`H08` + `R4-05` Reconciled) | |---|---|---| | **`T` — Direct `1-Hop` Validator Mesh + `D1` Sentinel Ingress** | Validators (`N <= 100`) unicast DAG vertices directly (`1-hop`, `0` re-gossip `M01`); Sentinels (`~200 Mbps`) pre-verify & push `WorkerBatchProto`s (`10%` `D0` direct Pillar quota reserved). | **Zero Consensus Trust (`SSEL-02`):** Sentinels cannot vote, finalize, or censor; Pillar control + batch plane stays **`<= 9.3 Mbps` framed TX** (`5 Hz` DAG + `1 Hz` Coin + `1 Hz` QC + `AVID-FP`). | | **`A_L1` — `NATIVE_FULL` L1 Execution Possession** | Every Pillar holds and Stage-2 verifies **100% of raw L1 `WorkerBatchProto` bytes** (`<= 5.8 Mbps` user + `2.1 Mbps` `ProofWitness`) before strong-linking. | **`0` `CustodyCert` Amplification on Small L1 Batches (`H08`):** Pillars never attach a `44.6 KiB` `CustodyCertProto` to a `10–64 KiB` L1 batch! | | **`R` — Coded `2D AVID` DA & `ManifestV1` Archival** | Used **only** for (a) `DA_BATCHED` `Zeno` rollup blobs (`>= 1 MiB`) and (b) `60 s` `ManifestV1` cold archival history segments (`>= 4 MiB`), certified by `CustodyCertProto` (`~44.6 KiB` = `< 1.1–4.4%` overhead). | `SHA3-256` row/column Merkle roots + `GF(2^16)` Reed-Solomon across `M_slots = 100` equal slots (`rank >= 67`, `100%` Post-Quantum). | --- ## 2. Canonical `go-libp2p` Protocol Registry, PQ Peer Auth (`M08`) & Direct Mesh Math (`M01` + `R4-05`) Reconciling `ZDC-QS-DEEZ-HR-001 (M08)`, `ZNN-SPEC-PHASE1-v4` explicitly separates **transport confidentiality (`KEM`)** from **authenticated peer identity (`Host Sig`)** and **consensus message validity**: 1. **Confidentiality (`v1.1` Day 1):** All streams negotiate **`X25519MLKEM768`** via Go 1.27+ `crypto/tls` (`CurvePreferences: []tls.CurveID{tls.X25519MLKEM768}`), immediately closing Harvest-Now-Decrypt-Later (`HNDL`). 2. **Authenticated PQ Peer Identity (`/znn/tls-pq/1.0.0`, `M08` Fix):** Because upstream `go-libp2p` (`v0.52.0`) uses classical `Ed25519`/`Secp256k1` `libp2p-tls` X.509 extensions and `libp2p-noise` (`Noise_XX_25519`), Phase 1A registers custom `libp2p` key type `KeyType_MLDSA44` (`algID = 0x01`) inside a custom security transport **`/znn/tls-pq/1.0.0`** binding the TLS 1.3 exporter key to the peer's `ML-DSA-44` host key (`CommitteeManifest` binds each active Pillar's `ML-DSA-44` transport `peer.ID` directly!). At `Spork #14` (`LegacyCryptoSunsetSpork`), classical `libp2p-noise` and `Ed25519` TLS fallback are disabled completely (`0` downgrade path). 3. **Zero Consensus Trust in Transport Auth:** Even if a transport session were ever MITM'd, consensus safety and liveness **never** rely on `peer.ID`—every DAG vertex (`FN-DSA-512`), QC vote (`FN-DSA-512`), `WorkerBatchProto` (`ML-DSA-44`/`FN-DSA-512`), and `AccountBlock v2` carries its own independent domain-separated PQ signature! ```text /znn/dag/vertex/v2 // Direct 1-hop validator unicast ONLY (0 GossipSub forwarding! M01) /znn/dag/map/v2 // Equivocation-only unicast GET_MAP / MAP_REPLY (34B/entry, Class 0 H16) /znn/dag/qc/v2 // 1 Hz post-execution MomentumPQQC partial signature broadcast (0.65 Mbps H09) /znn/dag/avss/v4 // Background HashRand-PQ AVID-FP + 1-hop share replenishment (0.69-1.34 Mbps R4-05) /znn/dag/batch/v2 // Authenticated L1 WorkerBatchProto chunks (D1 Sentinel & D0 Pillar) /znn/archive/manifest/v2 // Content-addressed 2D AVID ManifestV1 cold segments & Zeno DA blobs ``` ### Sovereign Raspberry Pi 5 Validator Uplink Budget (`N = 100`, `1.15x` QUIC/Yamux Framing `M01` + `R4-05`) * **DAG Vertex Direct `1-Hop` Unicast (`99` peers × `840 B`):** * Default **`5 Hz` round pace** (`1.0 s` non-overlapping `stride = 5` `Profile C-AS` wave / `~600 ms` `Profile B`): `99 × 5 × 840 B × 8 × 1.15 = 3.825 Mbps` TX / `3.825 Mbps` RX. * High-tempo **`10 Hz` round pace** (`500 ms` `stride = 5` wave / `~350 ms` `Profile B`): `99 × 10 × 840 B × 8 × 1.15 = 7.651 Mbps` TX / `7.651 Mbps` RX. * **Pure-`SHA3-256` `HashRand-PQ` Online Coin Reveal (`stride = 5` -> `1` round in `5` = `1.0 Hz` at `5 Hz`, `R4-05`):** Average Pillar (`c_j = 2.56` shares, `K_d = 20..34` agreed dealers -> `1,638–2,785 B`) adds **`+1.49 – 2.54 Mbps`** at `5 Hz` (`+2.98 – 5.08 Mbps` at `10 Hz`). * **`1 Hz` `MomentumPQQC` Partial Vote Broadcast (`99` peers × `710 B`):** **`0.647 Mbps` TX / `0.647 Mbps` RX**. * **L1 `WorkerBatchProto` Origin Share (`1/100`th of `7.9 Mbps` max burst across `99` peers):** **`~0.91 Mbps` TX / `7.90 Mbps` RX**. * **Background `HashRand-PQ` `AVID-FP` + `1-Hop` Dealing (`256 s` bank window, `R4-05`):** **`0.69 – 1.34 Mbps` TX / `0.73 – 1.23 Mbps` RX**. * **Total Sovereign Pi 5 Validator TX (`N = 100`, `5 Hz` `Profile C-AS`):** **`6.88 – 7.93 Mbps` steady (`5.32–6.37` DAG+Coin + `0.65` QC + `0.91` batch) / `7.57 – 9.27 Mbps` during background `AVID-FP` replenishment**—leaving **`> 15.7 Mbps` (`> 62%`) headroom** below the `25 Mbps` residential uplink limit! ### `WorkerBatchProto` With Summary Binding (`PQ-10` + `R4-07`) ```protobuf syntax = "proto3"; package znn.dag.v2; message BlockSummaryProto { bytes address = 1; // 20B: AccountBlock.Address (0x00, 0x01, or 0x02) uint64 height = 2; // 8B: AccountBlock.Height bytes block_hash = 3; // 32B: AccountBlock.Hash (exact 306B SHA3-256 preimage) uint32 flags = 4; // bit 0: IsSend, bit 1: ToEmbedded, bit 2: HasProofWitness bytes from_block_hash = 5; // 32B iff IsReceive, else empty uint64 priority_ratio = 6; // Quantized DynamicPlasma priority (includes WitnessPlasma) } message WorkerBatchProto { uint32 version = 1; // 2 (Zenon Phase 1 PQ v4) uint64 chain_identifier = 2; uint64 epoch = 3; bytes assembler_address = 4; // 20B Sentinel or Pillar origin uint64 reservation_nonce = 5; // Bound to §4 Canonical Credit Ticket repeated bytes raw_blocks = 6;// Canonical AccountBlockProto v2 bytes (<= 1,048,576 B batch cap) bytes batch_digest = 7; // SHA3-256("ZNN/batch/v2" || chain_id || epoch || assembler || nonce || blocks_root || summaries_root) bytes pq_signature_wire = 8; // [algID] || RawSig (0x01 ML-DSA-44 = 2,421B or 0x02 FN-DSA-512 = 667B) } ``` --- ## 3. Verifiable Coded Custody & Sentinel Operator Economics (`C09, C10, M08` Fix) 1. **Equal-Slot `2D AVID` Custody (`M_slots = 100`):** * Large `DA_BATCHED` `Zeno` blobs (`>= 1 MiB`) and `60 s` `ManifestV1` cold archival segments (`>= 4 MiB`) are `GF(2^16)` Reed-Solomon encoded across `M_slots = 100` equal storage slots (`SHA3-256` row roots `R_1..R_{n_r}` and column roots `C_1..C_{n_c}`). * Custodians re-encode their assigned row & column before signing `CustodyCertProto` (`FN-DSA-512` `666 B` × `>= 67` slots = `~44.6 KiB`, `ctx = "zenon-avid:v2"`). 2. **Sentinel Incentives, Collateral & Objective Slashing (`M08` Fix):** * **Collateral Bond (`SentinelContract`):** Operators lock `5,000 ZNN + 50,000 QSR` (`>= 30`-day unbonding delay aligned with `Joint-Epoch Freeze`) and register a dedicated `FN-DSA-512` (`0x02`) slot public key. * **Dual Revenue Stream:** 1. **Epoch Archival Rewards:** Existing protocol `Sentinel` emission pool is distributed strictly pro-rata to verified slot signatures inside committed `ManifestV1` archival `CustodyCertProto`s (requiring `>= 80%` segment participation in Epoch `E` to qualify). 2. **`Zeno` `DA_BATCHED` Blob Custody Fees:** Sequencers submitting `DA_BATCHED` batches pay `znnPerMiBDaBlob` in `SettlementContract (#13)`: `30%` is burned and `70%` is credited directly to the signing `CustodyCertProto` slot operators! * **Objective Slashing & Slot Eviction:** * **Equivocation (`SlashCustodyEquivocation`):** Submitting two valid `FN-DSA-512` slot signatures by the same slot custodian over distinct `(row_root, col_root)` commitments for the same `(epoch, blob_id)` burns **`50%` (`2,500 ZNN`)** of the Sentinel bond, pays **`10%` (`500 ZNN`)** to the proof submitter, and immediately evicts the slot. * **Retrieval / Liveness Audits:** Custodians failing `>= 20%` of `ManifestV1` certifications in an epoch forfeit 100% of epoch Sentinel rewards and rotate out of `M_slots` at `E + 1`. --- ## 4. Progressive Censorship-Free Routing (`H07`) & `25 Mbps` Root Shaper (`H12`) 1. **Progressive Non-Exclusive Routing:** `t = 0 ms` -> `HomePillar(Address, E)`; `t = 250 ms` -> `Rank_2..Rank_5`; `t = 600 ms` -> direct **`D0` Bypass** to `>= 34` Pillars inside the mandatory **`10%` `D0` admission quota**. 2. **Node-Wide Sliding-Window Shaper:** `internal/protocol/budget.go` enforces **`25 Mbps` TX / `100 Mbps` RX** (`<= 15 Mbps` control plane; `2–6 Mbps` protected `Class 0` recovery floor) and five-state byte credits (`B_reserved + B_certified <= W_avail`), capping Sovereign Pi 5 RSS at **`<= 6.5 GB`**. ================================================================================ CHAPTER 16 / 31: Mahi-Mahi (Profile C-AS Default, Stride=5) & Steelhead (Profile B Gated) PQ Meta-DAG FILE: docs/consensus/uncertified-meta-dag.md | URL: https://0x3639.com/zenon-phase-1/docs/consensus/uncertified-meta-dag ================================================================================ # Layer 2: `Mahi-Mahi` (`Profile C-AS` Default, `stride = 5`) & `Steelhead` (`Profile B` Refinement-Gated) PQ Meta-DAG > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciles `ZDC-ZP1-HR-001` (`M01, H16, B01–B04, H10`) and Round-4 Wave & Coin Audit (`R4-05`): > - **Normative Shipping Default (`Profile C-AS` — Non-Overlapping `stride = 5` `Mahi-Mahi`, `R4-05` fix):** Fixes `v2/v3`'s `5x` coin-rate mismatch (`period = 1` overlapping waves actually trigger `5` coin reveals/s at `5 Hz` = `15.63 Mbps` TX and drain a `256`-wave bank in `51.2 s`!) by locking **non-overlapping `stride = 5` 5-round waves** (`round mod 5 == 4` coin reveal = **`1.0 Hz` at `5 Hz`**, matching `1.0 s` `Momentum v4` projection **`1:1`**!) over `M_shares = 4,096` voting + pure-`SHA3-256` `HashRand-PQ` (`M_coin = 256`) at **`5.32–6.37 Mbps` total DAG+Coin TX**! > - **Formal Refinement Gate on `Profile B` (`Steelhead`, `H10` fix):** `Steelhead` (`k_0 = 4` optimistic fast path) activates **if and only if** mechanized refinement gate **`ZP-Q11`** proves `LEDGER`/`CONTROL` safety and liveness over compact ancestry + quantized `4,096` shares; otherwise `Profile C-AS` ships directly with **zero loss of `1.0 s` `Momentum v4` cadence or mandatory asynchronous liveness**! > - **Equivocation-Only `MAP_REPLY` (`34 B/entry`, `H16` fix):** Eliminates `3.4 KiB` full-parent-list recovery amplification under `order_mode == 1`. --- ## 1. Refinement-Gated Dual-Profile Engine Seam & `stride = 5` Wave Law (`H10` + `R4-05` Fix) 1. **Mandatory Shipping Baseline (`Profile C-AS` — Non-Overlapping `stride = 5` Asynchronous `Mahi-Mahi` `[R6]`, `R4-05` Fix):** * `v2/v3` described `period = 1` overlapping waves (`1` anchor per round) while budgeting `1` coin reveal per `5` rounds (`2.36 Mbps`). Because every wave `w` requires its own `r_4(w)` coin reveal, `period = 1` actually emits a coin reveal **every single round** (`5 Hz` coin rate at `5 Hz` rounds -> `5x` coin bandwidth and `51.2 s` bank drain), which is completely unnecessary when public `Momentum v4` blocks coalesce on a **`1.0 s` cadence**! * **`ZNN-SPEC-PHASE1-v4` Normative Rule:** `Profile C-AS` executes **sequential non-overlapping 5-round asynchronous waves (`stride = 5`)**: wave `w` spans rounds `[5w, 5w+1, 5w+2, 5w+3, 5w+4]` (`Propose -> Vote -> Boost -> Ack -> HashRand-PQ Coin Reveal at r = 5w + 4`). * At the `5 Hz` (`200 ms`) round pace, `1` complete 5-round wave finishes **every `1.0 s` (`1.0 Hz`)**—aligning `1:1` with `1.0 s` `Momentum v4` projection, guaranteeing `256.0 s` (`4.27 min`) lifetime per `256`-wave `HashRand-PQ` bank, requiring **zero `CONTROL/LEDGER` mode-switching state machine**, terminating with **probability `1` in `O(1)` expected waves under arbitrary asynchrony**, and consuming only **`5.32–6.37 Mbps` framed DAG+Coin TX at `N = 100, 5 Hz`**! 2. **Refinement-Gated Fast-Path Option (`Profile B` — `Steelhead` `[R31]`, Gate `ZP-Q11`):** * Runs `k_0 = 4` (`3` optimistic coin-free `3-round` fast waves per `1` `5-round` `Mahi-Mahi` wave -> `1` coin reveal per `14–20` rounds) with `CONTROL(scan_id)` step-down to non-overlapping `stride = 5` `Mahi-Mahi` under asynchrony. * **Hard Activation Rule (`H10`):** `Profile B` remains disabled (`semantic_version = 8` `Profile C-AS` active) unless TLA+ / Apalache + Lean 4 refinement artifact **`ZP-Q11`** discharges safety and liveness of the exact `CompactDagVertexProto` + `M = 4,096` + `HashRand-PQ` composition. --- ## 2. Lossless Compact Post-Quantum Vertex Wire Schema (`R4-05, H16` Fix) ```protobuf syntax = "proto3"; package znn.dag.v2; message PQCoinShareBundleProto { uint32 bank_id = 1; // Pipelined 256-wave HashRand-PQ bank id (R4-05) uint32 wave_offset = 2; // 0..255 within bank_id (populated iff round % 5 == 4) bytes packed_gf256_shares = 3; // Salt-free, branch-free K_d * c_i * 32B shares in GF(2^256) // Verified in O(K_d) RAM lookups against LeafHashManifest(d,b)[w][j]! } message CompactDagVertexProto { // Fixed authenticated header prefix: uint32 network_id = 1; // ChainIdentifier (1 = Alphanet) uint64 epoch = 2; uint64 round = 3; // 0-indexed canonical round r >= 0 uint32 authority_index = 4; // u16 canonical index in CommitteeManifest(epoch) uint32 semantic_version = 5; // 8 = PQ Profile C-AS Mahi stride=5 (default); 7 = Profile B (ZP-Q11) uint64 timestamp_unix_ms = 6; bytes payload_batches_root = 7; // 32B SHA3-256 Merkle root over possessed L1 WorkerBatch digests bytes committee_hash = 8; // 32B SHA3-256 of Epoch CommitteeManifest (M=4096, M_coin=256) // Lossless Compact Ancestry (reconstructs exact source-ordered VertexRef[] list): uint32 order_mode = 9; // 0 = Canonical author-index order; 1 = Exception delta bytes strong_parent_bitmap = 10; // ceil(N / 8) bytes MSB-first (4B at N=30; 13B at N=100) bytes ordered_parent_root = 11; // 32B: SHA3-256("IZ/parents/v2" || count || (u16 idx, 32B digest)[]) bytes reference_order_root = 12; // 32B: SHA3-256("IZ/reforder/v2" || ref_count || (kind, pos)[]) repeated bytes weak_links = 13; // Bounded <= 8 source-ordered 32B digests for rounds r' < r - 1 // Pure-SHA3-256 HashRand-PQ Coin Share (populated ONLY on wave coin reveal rounds r = 5w + 4): PQCoinShareBundleProto pq_coin_reveal = 14; bytes vertex_id = 15; // 32B domain-separated SHA3-256 semantic digest bytes pq_signature_wire = 16; // [0x02] || FN-DSA-512 (667B) or [0x04] || XMSS-SHAKE_22 (2,885B) } ``` ### Targeted Equivocation-Only `MAP_REPLY` & Per-Round Digest Cache (`H16` Fix) 1. **Canonical Ordering Mandate:** Honest validators MUST sort `r - 1` strong parents strictly in ascending `authority_index` order (`order_mode = 0`) and reference at most `1` vertex per `authority_index`. Any vertex setting `order_mode = 1` without an explicit index-order permutation list (`<= 200 B` inline) is malformed and dropped! 2. **`RoundDigestCache` + Delta `GET_MAP`:** Every node caches `KnownRoundVertex[r][idx]` upon verifying `r - 1` vertices. If `recomputed_parent_root != v.ordered_parent_root` (meaning either a parent `idx` is missing locally or `idx` equivocated in round `r - 1`), the receiver sends `GET_MAP(vertex_id, unknown_or_equivocated_bitmap[13B])` and receives **only `(u16 idx, 32B vertex_id)` (`34 B`) for the unresolved/equivocated indices**, cached globally per `(epoch, round, idx)` so an equivocating Byzantine validator triggers **at most `34 B` per peer per round** (`<= 0.13 Mbps` worst-case for `33` simultaneous equivocators at `5 Hz`, `< 7%` of `Class 0` floor!). ### Exact Direct-Mesh Bandwidth Verification (`M01, R4-05, M04` Verified) | Operating Mode (`N = 100` Active Pillars, `1.15x` QUIC/Yamux Framing) | Round Pace | Non-Coin Vertex | Coin Reveal Vertex (`c_i = 2.56` avg, `K_d = 20..34`) | Framed Validator Mesh TX (`99` Peers) | |---|:---:|---:|---:|---:| | **`Profile C-AS` Default (`FN-DSA-512`, `stride = 5` -> `1.0 Hz` coin)** | **`5 Hz`** | `840 B` | `2,478 – 3,625 B` | **`5.32 – 6.37 Mbps`** (`3.83` base + `1.49–2.54` coin) | | **`Profile C-AS` High-Tempo (`FN-DSA-512`, `stride = 5` -> `2.0 Hz` coin)** | `10 Hz` | `840 B` | `2,478 – 3,625 B` | **`10.63 – 12.73 Mbps`** (`7.65` base + `2.98–5.08` coin) | | **`Profile B` Healthy (`ZP-Q11` gated, `k_0 = 4` -> `0.25 Hz` coin)** | `5 Hz` | `840 B` | `2,478 – 3,625 B` | **`4.20 – 4.46 Mbps`** (`3.83` base + `0.37–0.64` coin) | | **Emergency Zero-Lattice Mode (`XMSS-SHAKE_22_256` `0x04`, `0.4 Hz` coin)** | **`2 Hz`** | `3,058 B` | `4,696 – 5,843 B` | **`6.17 – 6.59 Mbps`** (`5.57` base + `0.60–1.02` coin `R4-05`) | --- ## 3. Reconciled Commit & Order-Then-Execute Rules (`B04, R4-05, C01–C05`) 1. **`Mahi-Mahi` (`Profile C-AS`, `stride = 5`) Asynchronous Wave Commit:** * Each non-overlapping 5-round wave `w` (`[5w .. 5w+4]`) elects `Leader(w)` at `r = 5w + 4` via `Coin_w` (`>= T_coin = 86 / 256` verified `GF(2^256)` coin shares across `D_agreed(b)`). If `>= Q_vote = 2,731 / 4,096` voting shares at `5w + 3` (`Ack`) certify boost support for `Leader(w)`'s `5w` anchor `A_w`, `A_w` commits immediately; otherwise `A_w` commits indirectly via the next committed wave anchor `A_{w'}` (`w' > w`) having a strong/boost path to `A_w`. 2. **Repaired Optimistic Rules (When `Profile B` Passes `ZP-Q11`):** * Direct Commit requires `>= 2,731 / 4,096` shares at `r + 2`; `DirectSkip` requires `>= 2,731 / 4,096` explicit negative certificates at `r + 1` (`C02`); indirect anchor search starts at `r' >= r + 3` (`C01`). 3. **Order-Then-Execute (`F1`):** Canonical L1 state mutates strictly after DAG ordering; `1-RTT` (`10–50 ms`) off-chain finality runs over **[Regime 4 Unbounded Edge `d_channels`](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)**. ================================================================================ CHAPTER 17 / 31: 3-Horizon Adapter, Disjoint-Commuting F1==F0, MomentumPQQC Lifecycle & H_fork Scaling FILE: docs/consensus/virtual-momentum-projection.md | URL: https://0x3639.com/zenon-phase-1/docs/consensus/virtual-momentum-projection ================================================================================ # Layer 3: 3-Horizon Adapter, Disjoint-Commuting `F1 == F0`, `MomentumPQQC` Lifecycle & `H_fork` Scaling > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciles `ZDC-ZP1-HR-001` (`H09, H15, M03, M05, B08`) and Round-4 `MomentumVM` Supervisor Audit (`R4-01, R4-02, R4-03, R4-07`): > 1. **Complete `MomentumPQQC` Formation & Single-Vote WAL Protocol (`H09` fix):** Pillars deterministically execute each coalesced `1.0 s` `Momentum v4` cut first, persist `(Height, Momentum.Hash)` to `qc_wal` (forbidding double-signing), and broadcast one `666 B` `FN-DSA-512` partial signature on `/znn/dag/qc/v2` (`0.65 Mbps` framed TX)—verifying `>= 2,731 / 4,096`-share `seal_qc`s in **`0.59 ms` ideal / `0.9–1.4 ms` realistic 4-core Go (`M03` fix)**! > 2. **Exact Height-Indexed Migration Law Across `Spork #11` (`H_fork`, `H15` fix):** Rescales pre-fork height-locked expirations via `H_fork + 10 * (targetHeight - H_fork)` and widens `W_ack` `10x` with weighted pre-fork tick accounting. > 3. **Disjoint-Footprint `F1 == F0` Determinism + `postPromoStore` & `InclusionContext` (`M05` + `R4-02` + `R4-03` fix):** Reconstructs `postPromoStore` after Step-1 `AuthRegistry` promotion, passes `(InclusionHeight, InclusionMomentumStore)` into `GenerateEmbeddedReceive`, emits `Version = 2` contract blocks post-`Spork #10`, and keeps `ProofWitness` in `[0x11]` outside `Momentum.ChangesHash` (`R4-07`). --- ## 1. Three-Horizon Crash-Safe Adapter Contract (`ZDC-MM-ER-01 §3.2–3.8`) `go-zenon-v1` connects consensus to `MomentumVM` exclusively through five deterministic adapter methods: ```text 1. ingest(native_bytes) // Durable WAL intake; continues safely during execution backpressure 2. native_progress() // Emits committed LEDGER cuts in deterministic wave/anchor order 3. derive_next(state, cursor) // Pure function -> CanonicalOutputUnit | PENDING(missing_deps) 4. drain_prefix() // Stages contiguous LEDGER units past durable_executed_ordinal 5. ack_persisted(cursor, digest) // Called ONLY after atomic Pebble WriteBatch(Sync: true)! ``` * **Witness-Excluded Semantic Digest (`HR-12` + `R4-07`):** `unit_semantic_digest` commits to `(namespace, epoch, ordinal, prev_digest, ordered_vertex_ids, payload_batch_digests)` while `AccountBlock` state patches exclude raw `[0x11]` `ProofWitness` bytes (`32B` `WitnessCommitment` is already bound inside `AccountBlock.Data`), so `14`-day witness compaction never breaks `30`-day `Momentum.ChangesHash` replay (`R4-07`). * **Three-Horizon Atomic Persistence (`H03, HR-01`):** `ordered_ordinal >= staged_ordinal >= durable_executed_ordinal`. --- ## 2. `1.0 s` `Momentum v4` Coalescing, Async Burst Recovery & `H_fork` Migration (`H09, H15` Fix) 1. **Coalesced `1.0 s` Cadence + Post-Partition Monotonic Timestamp Rule (`H09` Fix):** * During normal operation (`5 Hz` `stride = 5` `Profile C-AS`), `1` 5-round wave commits every `1.0 s` and projects a public `Momentum v4` block whenever `rawMedianSec >= parent.TimestampUnix + 1`, where `rawMedianSec = floor(StakeWeightedLowerMedian(Cut_Anchors.timestamp_unix_ms) / 1000)`. * **Post-Partition Burst Rule (`H09`):** If a prolonged asynchronous delay heals and commits `K > 1` delayed wave cuts whose anchor median timestamps fall within the same second or `<= parent.TimestampUnix`, consecutive cuts sharing `rawMedianSec <= parent.TimestampUnix` coalesce into **one** `Momentum v4` block (up to `MaxBasePlasmaInMomentum = 8,400,000` and `MaxProofWitnessBytesPerMomentum = 262,144`), while any overflow cuts emit sequentially with `TimestampUnix = max(parent.TimestampUnix + 1, rawMedianSec)`—guaranteeing **strictly increasing integer Unix seconds** (`TimestampUnix > parent.TimestampUnix`, zero `-38003` EVM Engine API errors and zero pipeline stalls!). 2. **Canonical Height-Indexed Migration Law at `Spork #11` (`H_fork`, `H15` Fix):** When `SporkBitMomentumMahiPQ` activates at `Momentum` height `H_fork` (`10.0 s` `v3` -> `1.0 s` `v4`): * **`MomentumsPerEpoch`:** Scales `10x` (`8,640 -> 86,400` heights = `24 hours`), with `Epoch(H)` for `H >= H_fork` computed as `Epoch(H_fork) + floor((H - H_fork) / 86,400)`. * **In-Flight Height-Locked Records (`Stake`, `Spork`, `Pillar`, Delayed Governance):** During the deterministic `H_fork` transition crank, every active protocol record storing a future `expirationHeight > H_fork` or `activationHeight > H_fork` calibrated under `10 s` ticks is atomically rewritten to **`H_fork + 10 * (oldTargetHeight - H_fork)`**, preserving **exact wall-clock duration to the second**. *(Unix-timestamp locks such as `HtlcInfo.ExpirationTime` and `PtlcInfo.ExpirationTime` are already in Unix seconds and require zero rescaling.)* * **`MomentumAcknowledged` Window (`W_ack`):** Scales `10x` (`360 -> 3,600` virtual `1s` ticks = `1 hour`). Across `H_fork`, virtual tick distance is `VirtualAge(H_inc, H_ack) = (H_inc - max(H_ack, H_fork)) + 10 * max(0, H_fork - H_ack) <= 3,600`, ensuring user transactions signed immediately before `H_fork` remain valid across the spork boundary! --- ## 3. Disjoint-Commuting `F1 == F0` Execution & Post-Execution `MomentumPQQC` Protocol (`H09, M03, M05, R4-03` Fix) ### 3.1 Algorithm 1: Serial-Equivalent `ProjectVirtualMomentum` (`M05` + `R4-02` + `R4-03` Fix) ```text ALGORITHM 1: ProjectVirtualMomentum(parentStore, coalescedUnits[], nextHeight) -> DetailedMomentum (v4) ------------------------------------------------------------------------------------------------------- 1. PROMOTE AUTH REGISTRY, REFRESH STORE & SUB-DAG AUTHOR BITMAP (R4-03 Landmine #8): Promote AuthRegistry (#14) pendingRecords with pendingEffectiveHeight <= nextHeight (B05) inside momOverlay, then construct postPromoStore = newMomentumStore(momOverlay) so all Stage-2/3 reads observe newly promoted keys! Compute SubDAG-only non-equivocating authorBits (C06). 2. DEDUPLICATE, TWO-LANE ADMISSION & CONTIGUITY FILTER: Extract possessed L1 WorkerBatches in SubDAG order; keep first b per (b.Address, b.Height) unconfirmed in postPromoStore with VirtualAge <= 3,600; enforce Lane-1 (<= 8,400,000 BasePlasma) and Lane-2 (<= 262,144 ProofWitness bytes, 1 slot reserved for non-empty PoKoS queue H02). 3. DISJOINT-COMMUTING PARALLEL EXECUTION (F1 == F0 CONTRACT — CLOSES M05 + R4-03 Landmines #9, #10): a) Reference Oracle F0 Order: Build causal graph (h -> h+1 and Send -> Receive) and define the unique deterministic topological sequence Seq_F0 by popping ReadyQueue in canonical 60-byte AccountHeader.Bytes() lexicographic min-heap order. b) Parallel Engine F1: - Stage 2 (Stateless Preverify): Verify all BoundSigningDigest PQ signatures (R4-01), Equi-X solutions, WitnessPlasma, and WHIR-SHA3-v1 STARK proofs (<= 8,000 Keccak perms, <= 3.5 ms R4-04) across GOMAXPROCS workers (100% read-only against postPromoStore). - Stage 3a (Disjoint User Stripes): Partition user blocks in Seq_F0 by 256 Address stripes; each worker executes blocks for its assigned Address accounts strictly in per-account height order against isolated per-account AccountStore forks (zero cross-account / AuthRegistry writes!). - Stage 3b (Canonical Patch Fold & Sequential Embedded Contracts): Apply per-account patches and execute ALL Embedded Contract (#1..#15) ContractReceive + Update cranks strictly in single-threaded Seq_F0 order, passing (InclusionHeight = nextHeight, InclusionMomentumStore) into GenerateEmbeddedReceive (R4-03 #9) and setting generated ContractReceive/ContractSend AccountBlock.Version = 2 whenever Spork #10 is active (R4-03 #10)! (For Phase 1A v3 Momentums, post-content producer/PTLC Ed25519 reveals update AuthRegistry[0x03] AFTER m.Content R4-02.) 4. ATOMIC PEBBLE COMMIT (R4-07): Assemble Momentum v4 (Hash computed WITHOUT seal_qc), write witness-stripped AccountBlocks + StatePatch + smt-v1 NodeTree + sidecar [0x11] ProofWitness records + durable_executed_ordinal in ONE pebble.Batch(Sync: true) BEFORE calling adapter.ack_persisted()! ``` ### 3.2 Normative `MomentumPQQC` Signing, Aggregation & Pruning Lifecycle (`H09, M03, B08` Fix) 1. **Deterministic Preimage:** Once `Momentum v4` at `Height` commits locally in Step 4 above, every active Pillar `P_i in P_E` computes: ```text qcMsg = "zenon-mom-qc:v4" || be_u64(ChainId) || be_u64(Epoch) || be_u64(Height) || Momentum.Hash[32] ``` 2. **Crash-Safe Single-Vote WAL (`qc_wal.go`) & Direct `1 Hz` Broadcast:** * `P_i` checks `qc_wal` at `Height`: if a different `Momentum.Hash` was ever signed at `Height` (impossible under deterministic execution unless storage was corrupted), `P_i` halts rather than double-signing (`SlashQCEquivocation` burns `100%` of Pillar stake on two conflicting `qcMsg` signatures at the same `Height`!). * `P_i` persists `(Height, Momentum.Hash)` via `fdatasync` (`1` sync/s) and unicasts `QCVoteProto(epoch, height, momentum_hash, auth_idx, sig_666B)` (`~710 B`) across the direct validator mesh `/znn/dag/qc/v2` (**`0.647 Mbps` framed TX/RX at `N = 100, 1 Hz`**). 3. **Quorum Assembly & Non-Unique `seal_qc` Equivalence:** * Upon verifying `QCVoteProto` shares summing to **`>= Q_vote = 2,731 / 4,096`**, every node writes `MomentumPQQCProto` (`seal_qc`, `~14 KiB` at `N=30` to `~44.8 KiB` at `N=100`) to `MomentumQCStore[Height]`. * Because honest validators sign **at most one** `Momentum.Hash` per `Height` and Byzantine validators hold `<= 1,365` shares (`2 * 2,731 - 4,096 = 1,366 > 1,365`), **no two conflicting `Momentum.Hash`es can ever obtain a valid `MomentumPQQC` at the same `Height`**! Two peers holding different `>= 2,731`-share signer subsets certify the **exact same `Momentum.Hash`**. * **Verification Latency (`M03` Verified):** `67` `FN-DSA-512` signatures × `35 µs` = `2.345 ms` single-core -> **`0.59 ms` ideal 4-core (`0.9–1.4 ms` realistic Go worker pool on Pi 5)**! 4. **Sync Gate & `14`-Day Rolling Compaction (`B08`):** * Syncing peers and light clients MUST verify a valid `MomentumPQQC` on the chain tip and on every `EpochTerminalQC` (`Height mod 86,400 == 0`). Sovereign Pi 5 nodes compact intermediate `seal_qc` records older than `14` days (`1,209,600` heights), keeping permanent QC storage at **`16.4 MB/year`**. --- ## 4. Exact Post-Quantum `MomentumProto` Schema (`v3` & `v4`) ```protobuf message MomentumPQQCProto { uint64 epoch = 1; uint32 sig_alg_id = 2; // 0x02 = FN-DSA-512 (default) or 0x04 = XMSS-SHAKE_22_256 bytes signer_bitmap = 3; // Active P_E bitset (>= Q_vote = 2,731 / 4,096 shares) repeated bytes raw_signatures = 4; // Ordered 666B FN-DSA-512 (or 2,884B XMSS) sigs over qcMsg } message MomentumProto { uint64 version = 1; // 1=Origin, 2=DynamicPlasma, 3=StateRootSpork, 4=MomentumMahiPQSpork uint64 chain_identifier = 2; HashProto hash = 3; HashProto previous_hash = 4; uint64 height = 5; uint64 timestamp = 6; // Strict integer Unix seconds (ZVM Paris Engine API safe) bytes data = 7; repeated AccountHeaderProto content = 8; HashProto changes_hash = 9; bytes public_key = 10; // Used in v1..v3 (supports [algID] || PQPubKey in Phase 1A); empty in v4 bytes signature = 11; // Used in v1..v3 (BoundSigningDigest [algID] || PQSig R4-01); empty in v4 uint64 next_fusion_price = 12; uint64 next_work_price = 13; // Version >= 3 (Phase 1A+ — Domain-Separated smt-v1 SHA3-256 Sparse Merkle Root R4-07): HashProto state_root = 14; // Version == 4 (Phase 1B+ — Post-Quantum Momentum-Mahi Meta-DAG Projection): uint64 dag_epoch = 15; uint64 terminal_unit_ordinal = 16; HashProto unit_semantic_digest = 17; // Witness-excluded cut digest (HR-12) bytes author_bitmap = 18; // SubDAG-only participating Pillars (C06) MomentumPQQCProto seal_qc = 19; // Excluded from ComputeHash(); 0.9-1.4 ms realistic 4c verify (M03) } ``` ================================================================================ CHAPTER 18 / 31: Proof-First Architecture: smt-v1 StateRoot, Settlement (#13) & Pure-SHA3 WHIR STARKs FILE: docs/proof-first-and-btc/proof-first-architecture.md | URL: https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/proof-first-architecture ================================================================================ # Proof-First Architecture: `smt-v1` StateRoot, `SettlementContract` (`#13`) & Pure-`SHA3` `WHIR` STARKs > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** *"Consensus orders. Executors compute. Settlement anchors."* > Reconciling `ZDC-ZP1-HR-001` (`H02, H07, H13, M02, M10`) and Round-4 QROM, `smt-v1`, & Anchor Hardening (`R4-04, R4-07, R4-09`), **Zenon Phase 1 `v4`** locks a 100% pure-`SHA3-256` Proof-First verification surface: > 1. **Domain-Separated `smt-v1` (`[0x00]`/`[0x01]`) & Stateless Light-Client Chain (`H13` + `R4-07` + `R4-09` fix):** Enforces RFC-6962 `[0x00]` leaf / `[0x01]` internal domain separation + `32B` sibling bitmap (`1.2 KB` proof), plus `BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight` on `SunsetAnchorCheckpoint`. > 2. **True `2^-128` QROM `WHIR-SHA3-v1` Profile (`R4-04` fix):** Eliminates `BN254` pairings (`PQ-03`) and `Poseidon2` algebraic hashes (`M10`), discharges the `CMS19` quadratic QROM loss via **`224-bit` classical query security + `32-bit` Fiat-Shamir PoW grinding + `256-bit` extension field** (`57–86 KiB` receipts, `<= 128 KiB` hard cap), and tightens `MaxSHA3KeccakPermutations` from `45,000` (`17.1 ms` on Cortex-A76!) down to **`8,000` (`<= 3.5 ms` on Pi 5 Cortex-A76, `< 0.5 ms` on Apple Silicon)** in a zero-alloc `256 KiB` arena! > 3. **Post-Quantum Signature Compression (`M02` fix):** One `57–90 KiB` STARK batch proves `1,000+` `ML-DSA-44` / `FN-DSA-512` signatures (`2.42 MB` raw)—a **`26.3x+` wire compression**! --- ## 1. Why Proof-First Solves Dual-Ledger Programmability & Post-Quantum Bloat Together Programmability fails on dual-ledger architectures whenever execution lands on the wrong layer (`[R36]`): * Executing smart contracts on individual user account-chains destroys shared-state atomicity. * Executing WASM or EVM bytecode inside `Momentum` consensus forces every Sovereign Raspberry Pi 5 Pillar to re-execute heavy global VM workloads. **The Proof-First Separation of Duties (`v4`):** ```mermaid flowchart LR U["User / Sequencer
L1_NATIVE or DA_BATCHED"] -->|"Order / Commit"| S["Zenon L1: Settlement (#13)
Input Chain + DA Custody Root"] S -->|"1.2 KB smt-v1 Proof"| EX["Off-Chain zeno-stf Worker (Rust)
Applies Batch -> Witness + Roots"] EX --> PR["Off-Chain zkVM Prover
2^-128 QROM WHIR-SHA3-v1 STARK"] PR -->|"SubmitBatch + 57-90 KiB ProofWitness"| V["Zenon L1: VerifyWHIRStark (<=3.5 ms)
Accept == Instant Finality (S1)!"] ``` 1. **Zenon L1 Owns Canonical Input Ordering & Asset Custody:** Supports both `L1_NATIVE` forced/direct inputs (`CallL2`, `Deposit`) and `DA_BATCHED` high-throughput rollup batches anchored over Sentinel `2D AVID` DA (`H03`). 2. **Off-Chain Executors Own Computation:** Pillar-operated `zeno-executor` nodes execute the deterministic Rust `zeno-stf` state transition off-chain and generate a **`WHIR-SHA3-v1` STARK receipt**. 3. **`SettlementContract (#13)` Owns Instant Validity Finality (`S1`):** `SubmitBatch` verifies one `<= 128 KiB` proof (`57–86 KiB` analytical target) in `~1.2–3.5 ms` pure Go on Cortex-A76 (`< 0.5 ms` on Apple Silicon). **Acceptance equals immediate cryptographic finality**—zero 7-day fraud challenge windows. --- ## 2. Domain-Separated `smt-v1` State Tree & Complete Light-Client Chain (`H13` + `R4-07` + `R4-09` Fix) To eliminate second-preimage / leaf-internal type confusion (`32B path || 32B value` == `64B` vs `left[32] || right[32]` == `64B`), `ZNN-SPEC-PHASE1-v4` mandates explicit RFC-6962 `1-byte` node domain tags (`[0x00]` leaf, `[0x01]` internal) and a canonical compact proof format (`R4-07`): ```text EmptyHash = [32]byte{0} // Constant zero at all 256 levels LeafHash(path, value) = FIPS202_SHA3_256([0x00] || path[32] || value) // 0x00 Leaf domain tag (R4-07) InternalHash(left, right) = EmptyHash if left == 0 and right == 0 FIPS202_SHA3_256([0x01] || left[32] || right[32]) otherwise // 0x01 Internal tag // Canonical Compact SMTProof Wire Format (~1.0-1.3 KiB typical): SMTProof = nonEmptyBitmap[32] || nonEmptySiblings[popcount(bitmap) * 32] ``` ### Complete End-to-End Trustless Light-Client & Post-CRQC Bootstrap Chain (`H13` + `B11` + `R4-09` Fix) `ZNN-SPEC-PHASE1-v4` specifies both the **pre-CRQC classical history freeze** and the **3-link light-client chain (`ledger.getLightClientBundle`)**: 0. **Link 0 — Pre-CRQC `SunsetAnchorCheckpoint` + `MaxPreCRQCBitcoinHeight` (`B11` + `R4-09` Fix):** * Phase 0 (`2021`) through Phase 1A headers were signed by classical `Ed25519` Pillar keys (`0` post-CRQC Shor resistance against long-range genesis fabrication). * When `Spork #14` (`LegacyCryptoSunsetSpork`) activates **ahead of CRQC**, `SunsetAnchorCheckpoint = (H_sunset, MomentumHash_sunset, StateRoot_sunset, CommitteeHash_sunset, BitcoinAnchorHeight, BitcoinBlockHash)` is permanently pinned in node `common/params.go` **and** anchored in Bitcoin's `SHA-256d` PoW chain (`99-byte` checkpoints) at **`BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight`** (`R4-09`). * **Why `MaxPreCRQCBitcoinHeight` Is Essential (`R4-09`):** After CRQC arrival, an attacker can break old Bitcoin `secp256k1` keys to broadcast *new* Bitcoin transactions carrying spoofed `99-byte` `OP_RETURN` payloads at heights `> MaxPreCRQCBitcoinHeight`, whereas rewriting a block at `<= MaxPreCRQCBitcoinHeight` requires inverting cumulative `SHA-256d` PoW (`128-bit` Grover secure)! Requiring `BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight` freezes **100% of classical 2021–Phase 1A history** unconditionally (`Gate ZP-Q25`). 1. **Link 1 — Post-Sunset Committee Chain (`16.4 MB/yr` OR `57–90 KiB` STARK):** * From `CommitteeHash_sunset` (or Genesis pre-CRQC) forward, every `EpochTerminalMomentum` (`Height mod 86,400 == 0`) commits `NextCommitteeHash = SHA3-256(CommitteeManifest(E + 1))` and carries an unpruned PQ `EpochTerminalQC` (`>= 2,731 / 4,096` shares of `P_E`, `~44.8 KiB` = `16.4 MB/yr`), optionally compressed into **one `~57–90 KiB` `WHIR-SHA3-v1` Epoch-Chain STARK (`circuitId = 0x03`)**. 2. **Link 2 — Epoch `E` to Target `Momentum v4` Header (`~45.2 KiB`):** * Verify `MomentumPQQC` (`>= 2,731 / 4,096` shares under `CommitteeManifest(E)`) over `qcMsg` binding `(ChainId, Epoch, Height, Momentum.Hash)`, authenticating `Momentum.StateRoot`. 3. **Link 3 — `Momentum.StateRoot` to Account / Contract Key (`1.2 KB`):** * Verify the domain-separated `smt-v1` (`[0x00]`/`[0x01]`) Sparse Merkle inclusion or non-membership proof against `Momentum.StateRoot`. --- ## 3. Normative `WHIR-SHA3-v1` L1 Verifier Contract (`H02, H07, M02, M10, R4-04` Fix) ### 3.1 Pure `FIPS 202 SHA3-256` Commitment & True `2^-128` QROM Budget (`M10` + `R4-04` Fix) To uphold the strict invariant that L1 STARK soundness relies solely on NIST standard symmetric primitives (`0` algebraic hash assumptions), **`WHIR-SHA3-v1` forbids `Poseidon2`, `Rescue`, or `Monolith` anywhere in L1-verified receipts**: * **Trace & Folding Merkle Trees:** 100% `FIPS 202 SHA3-256` (`[0x00]` leaf / `[0x01]` internal, `32-byte` digests, `128-bit` Grover preimage margin). * **Fiat-Shamir Transcript:** Domain-separated `SHA3-256` / `SHAKE256` sponge (`"zenon-whir-sha3:v1"`). * **True `CMS19` QROM Soundness Budget (`R4-04` Fix):** Under Chiesa-Manohar-Spooner (`CMS19`), Fiat-Shamir compilation of a multi-round IOP into the Quantum Random Oracle Model incurs a `2x` bit-security halving on query + grinding rounds (`k` classical bits -> `k/2` quantum bits). To achieve **unconditional `<= 2^-128` QROM soundness**: 1. **Extension Field (`>= 256` bits):** Folding & sumcheck challenges live in a **`256-bit` extension field** (`Goldilocks^4`, `p = 2^64 - 2^32 + 1`, or `KoalaBear^8`, `p = 2^31 - 2^24 + 1`) so algebraic soundness error satisfies `eps_alg <= 2^-256` classical (`<= 2^-128` QROM). 2. **WHIR Domain-Shift Query Schedule + `32-Bit` Grinding (`224 + 32 = 256` Classical Bits -> `128` QROM Bits):** Outer $2^{16}$-row wrapper starts at rate $\rho_0 = 2^{-4}$ (`1/16`) with $2^4$-bundled coset leaves (tree depths `[16, 15, 14]`, effective shift rates $\rho_0 = 2^{-4}, \rho_1 = 2^{-7}, \rho_2 = 2^{-10}$): * **Conjectured list-decoding capacity (`1 - rho`):** `[56, 32, 23] = 111` total queries -> **`~56.7 KiB`** receipt (`~2,200` Keccak permutations). * **Unconditional Johnson proximity-gap bound (`1 - sqrt(rho)`):** `[112, 64, 45] = 221` total queries -> **`~86.2 KiB`** receipt (`~3,500` Keccak permutations). * Paired with **`32-bit` Fiat-Shamir PoW grinding** (`16` QROM bits; `< 0.12 s` on 1 GPU / `~0.8 s` on 32c CPU), both regimes comfortably clear `<= 2^-128` QROM inside the `90 KiB` planning / `128 KiB` hard cap! ### 3.2 Hard Resource Caps Inside `internal/crypto/zkverify` (`H02, H07, M02, R4-04` Fix) | Verifier Parameter | Normative Hard Cap (`v4`) | Rationale & `R4-04` Cortex-A76 Verification | |---|---:|---| | `proofAlgID` | `0x10` (`WHIR-SHA3-v1`) | Explicit versioned L1 verifier dispatch | | `MaxSingleProofWitnessBytes` | **`131,072 B` (`128 KiB`)** | Fits `56.7–86.2 KiB` `2^-128` QROM proofs & `2.37M < 8.40M` Plasma (`H02`) | | Standard `SubmitBatch` / `PoKoS` Target | **`57–90 KiB` (`<= 92,160 B`)** | `<= 0.737 Mbps` per proof (`2` proofs/s = `<= 180 KiB/s < 256 KiB/s` `M02`) | | `MinGrindingBits` | **`32 bits`** (`16` QROM bits) | Verified in `1` `SHA3-256` hash by L1; `+224b` query = `256b` classical (`R4-04`) | | `MaxFoldingRounds` | `6` | Bounds polynomial evaluation loop depth | | `MaxTotalMerkleQueries` | `256` | Fits unconditional Johnson `[112, 64, 45] = 221` queries (`R4-04`) | | `MaxSHA3KeccakPermutations` | **`8,000`** *(tightened from `45,000`)* | Pi 5 Cortex-A76 (`ARMv8.2` w/o `FEAT_SHA3`, `~380 ns`/perm): `45k` took `17.1 ms`; **`8,000` caps worst-case at `<= 3.5 ms`** (`~0.85–1.35 ms` typical; `< 0.5 ms` on Apple Silicon)! | | Verifier Scratch Arena | **`256 KiB` pre-allocated/worker** | **`0` dynamic heap allocations (`0` GC amplification DoS `H07`)** | Any receipt violating any cap above returns `vmerr.ErrInvalidStarkProof` in `< 50 µs` before executing folding rounds. ### 3.3 Five Public Inputs Verified Deterministically by `SettlementContract (#13)` 1. `vkeyDigest[32]`: Registered `WHIR-SHA3-v1` circuit commitment from `VerifierRegistry`. 2. `preStateRoot[32]`: Must equal the domain's current `postStateRoot`. 3. `postStateRoot[32]`: New `smt-v1` domain root. 4. `inputChainValue[32]`: Must equal `Settlement`'s running `SHA3-256` input chain at `endOrdinal` (plus verified `daBlobCommitment` for `DA_BATCHED` domains `H03`). 5. `batchOutputDigest[32]`: `SHA3-256(outboxRoot || assetFlowSummary || submitterAddress[20])`. ================================================================================ CHAPTER 19 / 31: Zeno Multi-Domain Execution (L1_NATIVE vs DA_BATCHED), Prover Hardware & Economics FILE: docs/proof-first-and-btc/zeno-domains-wasm-and-zvm.md | URL: https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/zeno-domains-wasm-and-zvm ================================================================================ # `Zeno` Multi-Domain Execution (`L1_NATIVE` vs. `DA_BATCHED`), Prover Hardware & Economics > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciles `ZDC-ZP1-HR-001` (`H03, H04, H12`) and Round-4 `WHIR-SHA3-v1` `2^-128` QROM Wrapper Parameters (`R4-04`): > 1. **Explicit `L1_NATIVE` vs. `DA_BATCHED` Domain Modes (`H03` fix):** Distinguishes censorship-immune L1 inbox inputs (`67–264` L1 blocks/s) from high-throughput off-chain-sequenced rollup batches posting `12 B/tx` state diffs to **Sentinel `2D AVID` DA** (`10.4M+ TPS` DA ceiling) while preserving L1 forced-inclusion escape! > 2. **Realistic `WHIR-SHA3-v1` Prover Hardware (incl. `32-bit` QROM Grinding) & `S3` Bounty Escape (`H12` + `R4-04` fix):** Documents concrete proving times (`6–18 s` on `32c` CPU + RTX 4090/5090; `20–45 s` on `32–64c` CPU; `50–120 s` on `16c` desktop, including `< 0.12 s` GPU / `~0.8 s` CPU `32-bit` Fiat-Shamir grinding) inside a `T_2 = 300 s` (`5 min`) `S3` escape window, plus `RequestForcedExit` bounty delegation for light/mobile wallets! --- ## 1. Multi-Domain `zeno-stf` Architecture & Two Inbox Modes (`H03` Fix) ```text zeno-stf/ (Rust — compiled twice: native Pillar worker + RV64IM zkVM guest) core/ codec, domain-separated smt-v1 ([0x00]/[0x01]) CompactTree, driver, Runtime trait runtime-wasm/ wasmi integer WASM Core 1.0 MVP, gas table, host imports (d_wasm) runtime-zvm/ revm EVM execution (1.0s Momentum v4 integer-second safe! d_zvm) runtime-accounts/ PQ batch account-abstraction & 26.3x+ signature compression (d_accounts) runtime-btc/ Bitcoin SHA-256d SPV ChainVerifier + BridgeLedger (d_btc) worker/ native binary supervised by zeno-executor (Go) guest/ zkVM guest + 2^16-row WHIR-SHA3-v1 outer wrapper -> emits 57-86 KiB (<=128 KiB) STARK ``` ### Explicit Domain Ingestion Modes (`H03` Closed) `ZNN-SPEC-PHASE1-v4` defines two composable ingestion paths on every domain: | Ingestion Path | How User Transactions Enter | Active Throughput Bound | Role | |---|---|---|---| | **Path 1: `L1_NATIVE` Forced / Direct Inbox** | User submits feeless L1 `AccountBlock v2` (`Deposit`, `CallL2`, `RequestForcedExit`) to `SettlementContract (#13)`. | **`67 – 264` L1 inputs/s** (`Regime 0a`) | Trustless asset deposits, high-value atomic L1->L2 calls, and **unconditional censorship-resistant forced inclusion**! | | **Path 2: `DA_BATCHED` Sequenced Rollup Stream** | Users submit PQ-signed L2 txs directly to the domain's active executor/sequencer; executor posts compressed `12 B/tx` state diffs + batch witness commitment to **Sentinel `2D AVID` DA** (`CustodyCertProto` `rank >= 67`) and anchors `(daBlobRoot, custodyCertDigest)` in `SubmitBatch`. | **`10.4M TPS` (`1 Gbps` DA)** to **`400M+ TPS` (sharded `2D AVID`)** *(prover-gated `H04`)* | Everyday DeFi, `d_wasm`, `d_zvm`, and `26.3x+`-compressed `d_accounts` PQ transfers at `< 1%` Sovereign Pi 5 load! | **Mandatory Anti-Censorship Coupling:** Every `SubmitBatch` call on a `DA_BATCHED` domain MUST drain all pending `L1_NATIVE` inbox items whose `MomentumHeight <= currentHeight - MaxForcedInboxDelay` (`30` Momentums = `30 s`), guaranteeing no off-chain sequencer can ever censor a user's L1 `CallL2` or `RequestForcedExit`! --- ## 2. Proposer Rotation (`S2`), Realistic Prover Profile & `S3` Bounty Escape (`H12` + `R4-04` Fix) 1. **Concrete Pure-`SHA3` `WHIR-SHA3-v1` Prover Hardware Profile (`H12` + `R4-04` Verified):** Proving `SHA3-256` Merkle commitments and `ML-DSA-44`/`FN-DSA-512` signatures inside a `zkVM` plus the $2^{16}$-row `WHIR-SHA3-v1` outer wrapper (`256-bit` extension field + `32-bit` Fiat-Shamir PoW grinding = `~4.29B` parallel `SHA3-256` evaluations) establishes three concrete hardware tiers for a `1,000`-tx batch (`57–86 KiB` receipt, `<= 128 KiB` cap): * **Tier 1 (Production Executor — `32c` EPYC + `1×` RTX 4090 / RTX 5090 GPU):** **`~6 – 18 s`** wall-clock prove time (including `< 0.12 s` for `32-bit` GPU `SHA3-256` grinding; `~55–165 TPS` sustained per single consumer GPU; scales linearly across multi-GPU prover pools via parallel chunk recursion). * **Tier 2 (CPU-Only Pillar Server — `32–64c` AVX-512 CPU, `128 GB` RAM):** **`~20 – 45 s`** wall-clock prove time (including `~0.8 s` for `32-bit` CPU `SHA3-256` grinding). * **Tier 3 (Self-Sovereign Desktop Escape Prover — `16c` Ryzen/Apple M-Max, `64 GB` RAM):** **`~50 – 120 s`** wall-clock prove time for a minimal single-exit batch (`<= 16` forced inputs, including `~1.8 s` grinding). 2. **Calibrated Rotation (`S2`) & Permissionless Escape Hatch (`S3`):** * **Round-Robin Primary (`S2`):** Primary executor window `T_1 = 45` Momentums (`45 s`, comfortably accommodating Tier 1–2 proving). Proofs bind `submitterAddress[20]` inside `batchOutputDigest` against front-running. * **Active-Executor Fallback (`45 s < age <= 300 s`):** Any registered executor may prove and claim the batch fee. * **Permissionless `S3` Escape (`age > T_2 = 300` Momentums = `5 minutes`) + `RequestForcedExit` Bounty (`H12` Fix):** After `300 s`, **anyone** can submit a valid `WHIR-SHA3-v1` proof over `D0`. Mobile/browser users who do not own a `64 GB` desktop prover attach an optional `proverBountyZNN` to `RequestForcedExit`, incentivizing any permissionless internet prover to generate and land the `<= 128 KiB` exit proof on their behalf! --- ## 3. Defense-in-Depth Bug Containment (`Settlement` Core Invariants) 1. **Per-`(domainId, asset)` Solvency Conservation:** ```text ESCROW (ZNN, QSR, ZTS): totalReleased + pendingWithdrawalReserve <= totalDeposited MINTED (zBTC): authorizedForeignRelease <= burnedSupply <= provenForeignLocks ``` 2. **Per-Batch Withdrawal & Mint Caps:** `MaxBatchWithdrawal` bounds `ZNN`/`QSR` outflows per batch; `MaxBatchMint` bounds newly minted `zBTC` per batch. 3. **Mandatory Runtime-Upgrade Exit Window:** Any verifying-key rotation (`RegisterVerifyingKey`) waits `MinRuntimeUpgradeDelay` (`>= 7` epochs = `604,800` `1s` Momentums), giving dissenting users `7` full days to exit under the existing key. 4. **Post-Quantum Governance (`SLH-DSA-SHAKE-128s` Multisig):** Time-locked PQ multisig; emergency `PAUSE_RELAY` freezes unverified outflows without touching user state roots. --- ## 4. Sustainable Proving & Sentinel DA Economics (`M08, H12`) * **Feeless L1 Submission + In-Domain Proving Credit:** L1 `Deposit` / `CallL2` blocks use feeless `QSR` Plasma; `DA_BATCHED` batches pay `znnPerMiBDaBlob` to signing Sentinel `2D AVID` custodians (`M08`) and settle per-cycle proving fees inside the domain (`30%` burned permanently, `70%` paid to `submitterAddress`). ================================================================================ CHAPTER 20 / 31: Trust-Minimized Bitcoin L2 (d_btc): Plain-English Guide, SPV STARKs, BitVM2 & Contingent BIP-360 FILE: docs/proof-first-and-btc/trust-minimized-btc-bridge.md | URL: https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/trust-minimized-btc-bridge ================================================================================ # Trust-Minimized Bitcoin L2 Interoperability (`BTC` ↔ `zBTC`) > **[TIP: TL;DR — How Zenon Scales Bitcoin (In Plain English, `ZNN-SPEC-PHASE1-v4`)]** > * **The Core Idea:** Bitcoin is the world's safest digital vault (~10-minute blocks, ~7 transactions/sec, on-chain miner fees), while **Zenon Phase 1** is a **feeless**, post-quantum, asynchronously live express highway (`1.0 s` `Momentum v4` blocks, unbounded edge TPS). Together, **`zBTC`** lets you move, trade, and program real Bitcoin instantly with **zero Zenon L1 transaction fees** (powered by regenerating `QSR` Plasma or lightweight `Equi-X` client PoW)—**without handing custody to a centralized company or exchange**. *(Standard Bitcoin L1 miner fees apply only when locking or withdrawing directly on the Bitcoin blockchain.)* > * **Bringing Bitcoin In (`BTC → zBTC`):** You lock BTC in a Bitcoin deposit output. Zenon verifies Bitcoin's `SHA-256d` Proof-of-Work math directly inside `Zeno`'s `d_btc` pure-`SHA3` `WHIR-SHA3-v1` STARK (`SPV`) and mints `1:1 zBTC` to your Zenon wallet (**100% post-quantum on Zenon today**). > * **Getting Real Bitcoin Back (`zBTC → BTC`) — Honest Cryptographic Horizon (`H11` Fix):** > 1. **Lane A · Express Atomic Swaps (`SHA-256 HTLC` + Lightning):** Instant wallet-to-wallet trades (`1–10 s`) with **zero bridge vault custody**—**100% post-quantum unconditionally today** (`SHA-256` 32B preimage = `128-bit` Grover security)! > 2. **Lane B · Threshold Pillar Vault (Capped Pre-CRQC Retail Reserve):** Fast direct L1 BTC withdrawals co-signed by `> 2/3` staked Pillars (`FROST` Taproot—explicitly **pre-CRQC transitional**, wound down ahead of CRQC/`BIP-361`). > 3. **Lane C · Fortress Vault (`BitVM2` Pre-CRQC Today → Contingent `BIP-360 P2MR + OP_CAT` Post-CRQC):** Today's `BitVM2` (`[E3]`) enforces **`1-of-N` honest watcher security** (even `100%` corrupt Pillars cannot steal BTC!), explicitly classified as **pre-CRQC transitional** because Bitcoin L1 currently requires Taproot (`secp256k1`) + `BN254` Groth16 (`H11`). Full post-quantum vault custody upgrades to keyless **`BIP-360` (`P2MR` `[E4]`) + `OP_CAT`** STARK covenants **contingent on upstream Bitcoin consensus soft-fork activation**! > * **Bitcoin Protects Zenon (`99-Byte` Checkpoints + `MaxPreCRQCBitcoinHeight`, `M11` + `R4-09` Fix):** Every `900` `Momentum v4` blocks (`15 minutes`), Zenon anchors its exact **`99-byte` canonical checkpoint preimage** (`MomentumHash` + `smt-v1` `StateRoot`) onto Bitcoin, with `SunsetAnchorCheckpoint` strictly bounded by `BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight`. --- ## Plain-English Visual Guide: How the Architecture Works Most crypto bridges in the past failed because **they worked like an unregulated bank**: users sent real BTC to 5-of-8 human keyholders. Zenon Phase 1 replaces middlemen with **verifiable cryptography** across **Deposits**, **Withdrawals**, and **Bitcoin Checkpoints**. ### The Big Picture: The Armored Vault & The Express Highway ![The Big Picture: Bitcoin's Security Vault + Zenon's High-Speed Highway](https://0x3639.com/zenon-phase-1/img/btc-bridge/01-big-picture-overview.svg) --- ### Flow 1: Bringing Bitcoin In (`BTC → zBTC`) — Certified Math, Not Custodians ![Step 1: Bringing Bitcoin In (BTC to zBTC Deposit Flow)](https://0x3639.com/zenon-phase-1/img/btc-bridge/02-deposit-peg-in.svg) 1. **You lock BTC on Bitcoin:** Send BTC to a deposit script tagged with your Zenon address (`z1...`). 2. **Bitcoin miners seal it:** Wait `K_conf` confirmations (`6` blocks retail; `12–36` blocks institutional). 3. **Any courier relays the public receipt:** Any Sentinel or `Syrius` wallet submits the public `80-byte` Bitcoin headers + Merkle branch to Zenon. Bitcoin's `SHA-256d` PoW + Merkle hashes are **already 100% post-quantum secure**! 4. **Proven `1:1 zBTC` Mint:** `Zeno`'s `d_btc` STF verifies PoW chainwork, `K_conf`, and replay non-membership inside a **pure-`SHA3` `WHIR-SHA3-v1` STARK**, minting `1:1 zBTC`. --- ### Flow 2: Getting Real Bitcoin Back (`zBTC → BTC`) — Three Exit Lanes (`H11` Reconciled) ![Step 2: Getting Real Bitcoin Back (Three Exit Lanes)](https://0x3639.com/zenon-phase-1/img/btc-bridge/03-withdraw-three-lanes.svg) | Exit Lane | Latency | Best For | Trust Model & Explicit Quantum Horizon (`H11` Fix) | |---|---|---|---| | **Lane A · Atomic Swaps (`SHA-256 HTLC` / Lightning)** | `1–10 s` | Everyday exits & Lightning payments | **Zero vault custody & 100% Post-Quantum Unconditionally Today** (`SHA-256` 32B preimage; requires bounded partition `Delta < T_htlc / 2` `B06`). | | **Lane B · Capped Pillar Vault** | `~10 min` | Medium direct BTC withdrawals | Honest `> 2/3` staked Pillars (`FROST` Taproot — **Pre-CRQC Transitional Only**; scheduled wind-down prior to CRQC). | | **Lane C · Fortress Vault (`BitVM2` `[E3]` → `BIP-360` `[E4]`)** | Instant front / PoW settle | Large institutional & treasury reserves | **Today (Pre-CRQC):** `1-of-N` honest watcher (`BitVM2` over `BN254` + Taproot, `Delta_watcher < T_challenge / 2` `B06`). **Post-CRQC:** Keyless `P2MR` + `OP_CAT` STARK covenant (**Contingent on Bitcoin L1 activating `BIP-360` + `OP_CAT` `H11`**). | --- ### Flow 3: Carving Zenon's History into Bitcoin Stone (`99-Byte` Checkpoints + `MaxPreCRQCBitcoinHeight`, `M11` + `R4-09` Fix) ![Step 3: Locking Zenon's History into Bitcoin Stone (Checkpoints)](https://0x3639.com/zenon-phase-1/img/btc-bridge/04-bitcoin-checkpoints.svg) Every `900` `Momentum v4` blocks (`15 minutes`), Zenon constructs the exact **`99-byte` canonical checkpoint preimage (`M11` fix)**: ```text Bytes 0..11 : "ZNN_CKPT_P1" // 11 ASCII bytes Bytes 11..19 : be_u64(ChainIdentifier) // 8 bytes (1 on Alphanet) Bytes 19..27 : be_u64(Epoch) // 8 bytes Bytes 27..35 : be_u64(Height) // 8 bytes Bytes 35..67 : MomentumHash[32] // 32 bytes Bytes 67..99 : StateRoot[32] // 32 bytes (exact total = 99 bytes!) ``` * **Post-Sunset Checkpoint Validity (`M11`):** Requires **both** `>= 6` Bitcoin `SHA-256d` PoW blocks **and** a valid post-quantum `MomentumPQQC` (`FN-DSA-512` `>= 2,731 / 4,096` shares) so fake third-party Bitcoin transactions are deterministically ignored. * **Pre-CRQC History Freeze (`MaxPreCRQCBitcoinHeight`, `R4-09` Fix):** For the one-time `Spork #14` `SunsetAnchorCheckpoint` sealing Zenon's classical `2021–Phase 1A` `Ed25519` history, light clients additionally enforce **`BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight`** (pinned in `common/params.go`). Once CRQC arrives, an attacker who steals exposed Bitcoin `secp256k1` keys can broadcast new `OP_RETURN` transactions at heights `> MaxPreCRQCBitcoinHeight`, **but cannot forge `SHA-256d` PoW history at `<= MaxPreCRQCBitcoinHeight`** (`128-bit` Grover security)! --- ## Technical Specification: Bounded-Partition Assumption (`B06`) & Contingent Bitcoin Soft-Fork Contingency (`H11`) 1. **Explicit Bounded-Partition Assumption for Time-Locked Disputes (`B06` Fix):** * Zenon L1 consensus (`Mahi-Mahi`) preserves safety under unbounded asynchrony (`Delta = infinity`) and resumes committing the instant messages arrive. * However, **any finite block/time-locked challenge protocol** (`BitVM2` operator challenges on Bitcoin `T_btc >= 1,008` BTC blocks = `~7 days`, `HTLC` timeouts, and `d_channels`) inherently requires **bounded partition `Delta_watcher < T_challenge / 2`** so at least 1 honest watcher/counterparty can land its dispute transaction before the timelock expires! 2. **Tiered Confirmation & Reorg Quarantine (`H13`):** `K_conf = 6 / 12 / 36` BTC blocks by amount; `ProveBitcoinReorg` triggers `Settlement` `PAUSE_RELAY` automatically if a heavier BTC branch ever orphans a credited UTXO. 3. **Closing the `100%` Corrupt Pillar Attack (`C12`):** Lane C (`BitVM2` Clementine vault `[E3]`) verifies **both** Zenon's `MomentumPQQC` **and** `d_btc`'s execution validity proof showing `authorizedForeignRelease <= burnedSupply <= provenForeignLocks` against real `SHA-256d` Bitcoin PoW headers. 4. **Contingency If CRQC Arrives Before Bitcoin Activates `BIP-360` + `OP_CAT` (`H11` Fix):** * Because Zenon does not control Bitcoin Core consensus, `ZNN-SPEC-PHASE1-v4` never assumes `BIP-360` (`[E4]`) or `OP_CAT` (`BIP-347`) is already active on Bitcoin mainnet. * If a credible CRQC milestone triggers `LegacyCryptoSunsetSpork` (`Spork #14`) **before** Bitcoin activates `BIP-360` + `OP_CAT`, `SettlementContract (#13)` executes **`OrderedVaultRedemptionMode`**, returning custodied BTC from Taproot/`BitVM2` vaults to `zBTC` holders (and similarly disallowing new unshielded `secp256k1` deposits if Bitcoin L1 has not yet activated PQ output scripts) while **Lane A (`SHA-256` `HTLC` atomic swaps)** continues operating with 100% unconditional post-quantum safety! ================================================================================ CHAPTER 21 / 31: Regime 4 Unbounded Edge Channels (d_channels #15): Adjudication State Machine, PQ SigLocks & HTLC Mesh FILE: docs/proof-first-and-btc/unbounded-edge-channels.md | URL: https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels ================================================================================ # Regime 4 Unbounded Edge Channels (`ChannelContract #15`): Adjudication State Machine, PQ `SigLock`s & `HTLC` Mesh > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Reconciling `ZDC-ZP1-HR-001` (`B06, B07, B09, M06, M07`) and Round-4 `ChannelContract` Audit (`R4-08`), **Regime 4 (`d_channels` / `ChannelContract #15`)** delivers **strictly unbounded global edge throughput (`O(Active Channel Pairs)`)** with an airtight L1 dispute adjudication contract: > - **Throughput Decomposition (`M06` fix):** `20–100` sequential RTT updates/s per pair (`10–50 ms` WAN), **`1,280–6,400` pipelined (`W = 64`) micro-payments/s per pair**, and **`0` Pillar/Sentinel bytes per off-chain hop** (`O(Active Pairs)` unbounded global ceiling). > - **Valid Bech32 Address + Lockout-Free & Hostage-Free `ChannelContract (#15)` (`R4-08` fix):** Fixes the invalid `v3` Bech32 checksum (`...9n4k2p`) to verified BIP-173 **`z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2`** (`01b3b6e5adcb4d8bf673cfcc6318c6318c6318c6`), enables **immediate in-`CLOSING` `ClaimHTLC(channelId, preimage32)`** (`RevealedPreimage` survives `ChallengeHigherNonce` and never expires during `finalizeAtHeight`!), and decouples **`FinalizeBasePayouts`** from **`SettleHTLC`** so unsettled/withheld dust HTLCs can never freeze `balance_a` or `balance_b`! > - **Accurate Primitive Naming (`B07` fix) & Exact `1,538 B` Wire Vector (`M07` fix):** Renames `PtlcContract` types `3` & `4` to **PQ Signature Locks (`SigLockMLDSA44`, `SigLockFNDSA512`)** with recipient-bound redeem digests, designates **`SHA-256`/`SHA3-256` `HTLC`s** as the normative multi-hop atomic lock, and fixes `ZenonCommitStateProto` at a constant **`1,538 bytes`**. --- ## 1. Plain-English Walkthrough & Latency vs. Pipelining Math (`M06` Fix) ```mermaid sequenceDiagram participant A as Account A (User / AI Agent) participant B as Account B (Merchant / Router / GPU Node) participant L1 as Zenon Phase 1 L1: ChannelContract (#15) Note over A,B: 0. Pre-Sign sequence_nonce = 0 Refund State Before Dual Funding (M07) A->>L1: 1. OpenChannel + FundCounterparty (Feeless QSR Plasma, <= 1.0s Finality) Note over A,B: Off-Chain P2P Stream Over Encrypted X25519MLKEM768 Link (0 L1 Bytes!) A->>B: Update #1..W (Pipelined Window W=64, FN-DSA-512 sig_A, 1,538B/msg) B-->>A: Countersign #1..W (FN-DSA-512 sig_B, ~72 us dual verify!) Note over A,B: 20-100/s sequential RTT OR 1,280-6,400/s pipelined per pair; O(Pairs) globally! B->>L1: 2. CooperativeClose (1 Feeless AccountBlock -> Instant Net Payout!) ``` ### Exact Per-Pair vs. Network-Wide Edge Capacity (`M06` Reconciled) * **Sequential Stop-and-Wait Mode (`W = 1`):** Over a `10–50 ms` WAN RTT, waiting for each countersignature before sending the next yields **`20 – 100` sequential state transitions/s per pair** (`1,000+ /s` on `< 1 ms` LAN/colocated links). * **Pipelined Streaming Mode (`W = 64` in-flight monotonic states, e.g., per-token AI billing):** Achieves **`1,280 – 6,400` micro-payments/s per pair** over WAN, bounded locally only by dual `FN-DSA-512` verification (`~72 µs` = `~13,800` states/s/core). * **Global Edge Capacity:** Across `K` independent pairs, global consensus load is **`0` bytes/hop**, so network-wide throughput scales as **`O(K)` without any global ceiling**. --- ## 2. Explicit Dispute Safety Model (`B06` Fix) & PQ Lock Primitives (`B07` Fix) ### 2.1 Bounded-Partition Dispute Assumption (`B06` Fix) While Zenon L1 consensus (`Mahi-Mahi`) is safe under arbitrary asynchrony (`Delta = infinity`), **unilateral channel closure uses a finite L1 dispute window `T_dispute`** (`MinDisputeWindow = 86,400` `Momentum v4` blocks = **`24 hours`**). Therefore, unilateral dispute safety holds under the explicit assumption: ```text Delta_party_or_watchtower < T_dispute / 2 (i.e., < 12 hours max eclipse/offline window) ``` On Zenon Phase 1, feeless `QSR` Plasma + mandatory `10%` `D0` Pillar bypass + asynchronous DAG liveness eliminate **mempool fee-spike / congestion pinning attacks**, while optional **Watchtower Delegation** (`ChallengeHigherNonce` is callable by *any* third party without spending authority!) protects offline mobile users. ### 2.2 PQ Signature Locks (`SigLock`) vs. Multi-Hop Atomic `HTLC`s (`B07` Fix) 1. **Normative Multi-Hop Atomic Routing (`SHA-256` / `SHA3-256` `HTLC`s, `M10` Entropy Rule):** * Both on-chain `HtlcContract` and in-channel `ChannelHTLCLeaf`s use `32-byte` hashlocks `H = SHA-256(r)` where `r` **MUST be sampled from a `256-bit` CSPRNG** (`crypto/rand`, never user-chosen passphrases `M10`), preserving `128-bit` Grover security and `1:1` Bitcoin Lightning `BOLT-11` compatibility. * *(Optional Unlinkable PQ Multi-Hop Privacy:* Routers wanting correlation-free hops without elliptic adaptors use `H_i = SHA-256(r || hopSalt_i)` paired with an off-chain `WHIR-SHA3-v1` `ZK-HTLC` proof.) 2. **Conditional Single-Hop Escrow (`PtlcContract` Types `3` & `4` Renamed to `SigLock`, `B07` + `B12` Drain):** * Types `3` (`SigLockMLDSA44`) and `4` (`SigLockFNDSA512`) are **recipient-bound PQ Signature Locks** (single-hop escrow, not scalar adaptors). Classical `{0, 1, 2}` types undergo a zero-stranded-funds two-step drain before `Spork #14` (`B12` — see [PoKoS & Sunset §4](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). * **Anti-Griefing Redeem Transcript (`B07`):** Redeeming `lockId` requires `sig` under `pk` over **`SHA3-256("zenon-siglock-redeem:v2" || be_u64(ChainId) || GenesisHash[32] || lockId[32] || recipientAddress[20])`** (`92 B`). --- ## 3. Normative `ChannelContract` (`Embedded Contract #15`) Adjudication State Machine (`B09` + `R4-08` Fix) `SporkBitBitcoinAndEdge` (`Spork #13`) activates **`ChannelContract` (`Embedded Contract #15`)** at verified BIP-173 Bech32 address **`z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2`** (raw 20-byte embedded core `01b3b6e5adcb4d8bf673cfcc6318c6318c6318c6`, replacing `v3`'s malformed `...9n4k2p` checksum `R4-08`) with five states (`FUNDING -> OPEN -> CLOSING -> CLOSED | ABORTED`) and strict conservation: ```text Invariant (Every State): remaining_base_a + remaining_base_b + remaining_htlc_sum == remaining_locked_total ``` ### Why `ZNN-SPEC-PHASE1-v4` Decouples Preimage Reveal & Base Payouts (`R4-08` Audit Fix) In `v3`, `ClaimHTLC` was blocked until `H_inc >= finalizeAtHeight` (`>= 24h` + `1h` challenges), allowing a malicious sender to set `leaf.expiryTs < finalizeAtHeight`, trigger `StartUnilateralClose`, lock out `ClaimHTLC` until `expiryTs` passed, and steal forwarded funds via `TimeoutHTLC`! Furthermore, `FinalizeClose` required `remaining_htlc_sum == 0` before releasing `balance_a` and `balance_b`, allowing an uncooperative party to freeze `99.99%` of channel funds behind a single unsettled HTLC! **`v4` closes both bugs cleanly:** | Method (`ChannelContract #15`) | Guard Conditions & State Transition (`B09` + `R4-08` Closed) | |---|---| | **`1. OpenChannel`** `(partyB, zts, amountA, disputeWindow, pkA_fndsa, pkB_fndsa)` | Requires `disputeWindow >= 86,400` (`24h`), `len(pkA) == 897`, `len(pkB) == 897`. Escrows `amountA`. Single-funded (`expectedAmountB == 0`) enters `OPEN`; dual-funded enters `FUNDING` (`fundingExpiry = H_inc + 3,600`) after pre-signing `sequence_nonce == 0` refund state (`M07`). | | **`2. FundCounterparty`** `(channelId, amountB)` | Callable in `FUNDING` before `fundingExpiry` (`AbortFunding` refunds `amountA` if `partyB` stalls). Escrows `amountB`, sets `locked_total = amountA + amountB`, transitions to `OPEN`. | | **`3. CooperativeClose`** `(channelId, balA, balB, sigA, sigB)` | Callable in `OPEN` or `CLOSING` (prior to `FinalizeBasePayouts`). Verifies `balA + balB == locked_total` (`pending_htlc_sum == 0`) and dual `FN-DSA-512` sigs over `"zenon-chan-coop:v2" \|\| channelId \|\| balA \|\| balB`. Credits `balA`, `balB` immediately; sets `CLOSED`. | | **`4. StartUnilateralClose`** `(stateBytes[1538])` | Callable in `OPEN` by `partyA` or `partyB`. Verifies dual `FN-DSA-512` sigs over `stateHash` and `balA + balB + pending_htlc_sum == locked_total`, sets `closingState = state`, `finalizeAtHeight = H_inc + disputeWindow`, transitions to `CLOSING`. | | **`5. ChallengeHigherNonce`** `(stateBytes[1538])` | Callable in `CLOSING` by **anyone** (party or **watchtower**!) while `H_inc < finalizeAtHeight`. Requires valid dual `FN-DSA-512` sigs AND **`new.sequence_nonce > closingState.sequence_nonce`**. Replaces `closingState = new` and sets **`finalizeAtHeight = max(finalizeAtHeight, H_inc + 3,600)`** (`1h` anti-snipe extension!). | | **`6. ClaimHTLC`** `(channelId, preimage32)` *(`R4-08a` Fix)* | Callable **IMMEDIATELY in `CLOSING` (`H_inc < finalizeAtHeight` OR `H_inc >= finalizeAtHeight`)** by anyone! Records `RevealedPreimage[channelId][SHA-256(preimage32)] = (preimage32, Momentum.Timestamp)` in contract state (`<= 64` active HTLCs/channel). Survives `ChallengeHigherNonce` replacements so `leaf.expiryTs` can **never** lock out an honest router during the `24h+` dispute window! | | **`7. FinalizeBasePayouts`** `(channelId)` *(`R4-08b` Fix)* | Callable in `CLOSING` once **`H_inc >= finalizeAtHeight`** (`basePaid == false`) — **DOES NOT wait for `remaining_htlc_sum == 0`!** Immediately emits Embedded `ContractSend` payouts `(closingState.balance_a, closingState.balance_b)` (`basePaid = true`), and sets `CLOSED` if `remaining_htlc_sum == 0`. | | **`8. SettleHTLC`** `(channelId, leaf, merkleBranch)` *(`R4-08` Fix)* | Callable in `CLOSING` once **`H_inc >= finalizeAtHeight`** for any unsettled `leaf` verified against `closingState.htlc_merkle_root`: if `RevealedPreimage[channelId][leaf.hashLock]` exists with `revealedTs < leaf.expiryTs`, pays `leaf.amount` to `leaf.recipient`; else if `Momentum.Timestamp >= leaf.expiryTs`, refunds `leaf.amount` to `leaf.sender`. Decrements `remaining_htlc_sum`; sets `CLOSED` when `basePaid && remaining_htlc_sum == 0`. | --- ## 4. Exact `1,538-Byte` Constant-Size `ZenonCommitStateProto` Wire Vector (`M07` Verified) Using `fixed64` integer tags eliminates variable-length varint drift across `sequence_nonce in [0 .. 2^64 - 1]`, locking every signed channel state at **exact `1,538 bytes`**: ```protobuf syntax = "proto3"; package znn.edge.v2; message ZenonCommitStateProto { bytes channel_id = 1; // 1B tag + 1B len + 32B = 34 B fixed64 sequence_nonce = 2; // 1B tag + 8B le_u64 = 9 B (0 = initial refund state!) bytes token_standard = 3; // 1B tag + 1B len + 10B = 12 B bytes balance_a = 4; // 1B tag + 1B len + 32B = 34 B bytes balance_b = 5; // 1B tag + 1B len + 32B = 34 B bytes pending_htlc_sum = 6; // 1B tag + 1B len + 32B = 34 B bytes htlc_merkle_root = 7; // 1B tag + 1B len + 32B = 34 B ([32]byte{0} when sum == 0) fixed64 dispute_window_momentums = 8; // 1B tag + 8B le_u64 = 9 B (>= 86,400) // ---- State Body Subtotal: 200 B ---- bytes sig_party_a_fndsa = 9; // 1B tag + 2B len + 666B = 669 B bytes sig_party_b_fndsa = 10; // 1B tag + 2B len + 666B = 669 B // ==== Exact Wire Total: 1,538 B ==== } ``` * **`stateHash` Signed by Both Parties:** `SHA3-256("zenon-chan-state:v2" || be_u64(ChainId) || ProtobufBytes(fields 1..8)[200])` (`32 B`), fitting **`10` full channel dispute proofs inside a single `16 KiB` L1 `AccountBlock.Data` payload**! ================================================================================ CHAPTER 22 / 31: Unified Phase 1 Master Roadmap: Stake-Signaled Sporks, 0x1f→uint64 Mask & Pi 5 Envelope FILE: docs/roadmap/master-five-stage-roadmap.md | URL: https://0x3639.com/zenon-phase-1/docs/roadmap/master-five-stage-roadmap ================================================================================ # Unified Phase 1 Master Roadmap & Stake-Signaled Spork Governance (`ZNN-SPEC-PHASE1-v4`) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** **Zenon Phase 1 begins immediately at `Phase 1.0`** by upgrading mainnet nodes from legacy [`zenon-network/go-zenon`](https://github.com/zenon-network/go-zenon) (Phase 0) to **[`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1)** (`pebble/v2`, 4-stage parallel sync, `ZP-Q22`) and activating **`DynamicPlasmaSpork` (`pow.SporkMask` Bit 3)** + **`Libp2pSpork`**, followed by `v1.1` (`Go 1.27+` `X25519MLKEM768`, `0x1f → uint64 SporkMask` `M07`, and `25/100 Mbps` shaper). Reconciling `ZDC-QS-DEEZ-HR-001` (`M09, B02, B11, B12`) and Round-4 (`R4-01–R4-09`), every consensus-upgrading Spork (`Phase 1A → 1E`) is explicitly classified as a **stake-coordinated hard fork** requiring **`>= 85%` active-stake `ProtocolVersion` readiness signaling** across `2` consecutive epochs before activation (`0` chain halts for upgraded nodes; un-upgraded legacy binaries fail closed cleanly). --- ## 1. Visual Phase 1 Upgrade Pipeline (`Phase 1.0` → `Phase 1E`) ```mermaid flowchart TD P10["Phase 1.0 · Start of Implementation: Upgrade go-zenon -> go-zenon-v1
• CockroachDB pebble/v2 & 4-Stage Parallel Sync (Benchmarked Under Gate ZP-Q22)
• Activate DynamicPlasmaSpork (pow Bit 3) + Libp2pSpork on Phase 0 Wire Format
• Point Release v1.1 (Go 1.27+): X25519MLKEM768, 0x1f->uint64 SporkMask & >=85% Stake Readiness Gate"] P1A["Phase 1A · Sporks #9 & #10 (smt-v1 StateRoot + BoundSigningDigest PQ Accounts + PoKoS)
• Momentum v3: Domain-Separated [0x00]/[0x01] SHA3-256 smt-v1 StateRoot (~1.2 KB Proofs)
• AccountBlock v2: BoundSigningDigest (R4-01), 0x02 Addr, ML-DSA-44, FN-DSA-512, SLH-DSA-128s, [0x11] Sidecar
• AuthRegistry (#14): H_inc+1 Promotion, 179B PoP, PrecommitKey & O(1)-Exposure Day-1 PoKoS (R4-02, R4-03)"] P1B["Phase 1B · Spork #11 (Momentum-Mahi Post-Quantum Meta-DAG)
• 2+ Epochs Non-Authoritative Shadow Mesh Over Direct 1-Hop /znn/dag/vertex/v2
• Momentum v4 (1.0s, 0 Reorgs): Non-Overlapping stride=5 Mahi-Mahi Default (Steelhead ZP-Q11 Gated)
• M=4,096 Voting Shares + FN-DSA-512 (666B) + Pure-SHA3 HashRand-PQ Coin (M_coin=256, 0 Lattices R4-05)"] P1C["Phase 1C · Spork #12 (Proof-First Zeno Mainnet & PQ Batch Compression)
• SettlementContract (#13) in ZK_VALIDITY Mode (L1_NATIVE + DA_BATCHED)
• 2^-128 QROM WHIR-SHA3-v1 STARKs (57-86 KiB Target, <= 8,000 Keccak Perms <= 3.5 ms Cortex-A76 R4-04)
• Launch d_wasm, d_zvm (EVM), and d_accounts (26.3x+ PQ Signature Compression)"] P1D["Phase 1D · Spork #13 (Trust-Minimized Bitcoin d_btc & ChannelContract #15)
• d_btc SHA-256d SPV Proven in WHIR-SHA3-v1 + 99B Bitcoin Checkpoints
• ChannelContract (#15, z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2): In-CLOSING ClaimHTLC + FinalizeBasePayouts (R4-08)
• Cap Classical PTLC {0..2} Expiries Ahead of Sunset; Pre-CRQC BitVM2 -> Contingent BIP-360"] P1E["Phase 1E · Spork #14 (H_inc Complete Classical Sunset & SunsetAnchorCheckpoint)
• Enforced at InclusionMomentumHeight (H_inc): Disable v1, 0x00, 0x81, Bridge ECDSA, Swap & PTLC {0..2}
• Seal SunsetAnchorCheckpoint (<= MaxPreCRQCBitcoinHeight R4-09) on BTC + params.go; Keep PoKoS & Reclaim Open"] P10 --> P1A --> P1B --> P1C --> P1D --> P1E P1A -.->|"Can Activate Atop 10s v3 w/ Rescaled T_1, T_2!"| P1C ``` --- ## 2. Hard-Fork Honesty & `>= 85%` Stake-Signaled Spork Activation (`M09` Fix) `ZDC-QS-DEEZ-HR-001` (`M09`) observed that `go-zenon-v1/internal/common/params.go:274` sets `SporkEnforcementDelay = 6` Momentums (`60 s` on Phase 0), which cannot protect mainnet if `ActivateSpork` fires before `> 2/3` of validator stake has upgraded binaries—and that new block/Momentum versions (`v2`, `v3`, `v4`) are **consensus hard forks** (not soft forks) for legacy 2021 clients. **Normative `v4` Activation Protocol (`M09` Closed):** 1. **Explicit Hard-Fork Fail-Closed Semantics:** Nodes running older `ProtocolVersion` binaries reject unknown `Momentum.Version` / `AccountBlock.Version` fail-closed at the activation boundary rather than silently accepting unvalidated witnesses. *"Zero chain halts"* applies strictly to networks meeting the pre-activation stake threshold below. 2. **On-Chain `>= 85%` Active-Stake Readiness Gate:** * Pillars advertise supported `MaxProtocolVersion` (`u16`) and pre-registered PQ producer/consensus keys inside `Momentum.Data` / `PillarContract`. * For consensus hard-fork sporks (`Sporks #9..#14`), `SporkContract.ActivateSpork` reverts on-chain unless **`>= 85%` of active `P_E` stake weight** has signaled `MaxProtocolVersion >= RequiredVersion(spork)` across the **entire preceding `2` epochs (`48 hours`)**, and enforces **`HardForkEnforcementDelay = 1` full epoch (`24 hours`)** instead of `6` Momentums! --- ## 3. Collision-Free `0x1f → uint64` Master Spork Registry (`M07` + `R4-03` Aligned) | Stage | `SporkMask` Bit (`uint64`) | Spork / Upgrade Milestone | `Momentum` Ver. | `AccountBlock` Ver. | Contracts & Sunset Rules | |---|:---:|---|:---:|:---:|---| | **Phase 0 *(Live)*** | `pow` Bits `0..2` + `EmbeddedRefund` (`Bit 6`) | Legacy `go-zenon` (`Accelerator`, `BridgeAndLiquidity`, `Htlc`, `Refund`) | `v1` (`10s`) | `v1` | `#1 .. #12` (`goleveldb`, `RLPx`) | | **Phase 1.0 *(Start)*** | **`pow` Bits `3, 4` (`0x1f`) + `Bit 5` (`Libp2p`)** | **`go-zenon → go-zenon-v1` + `DynamicPlasmaSpork` (`1<<3`) + `Libp2pSpork`** + `v1.1` (`Go 1.27+`, `uint64` mask) | **`v2` (`10s`)** | `v1` | `pebble/v2`, Dynamic Plasma, `X25519MLKEM768`, `>=85%` Stake Gate | | **Phase 1A** | `Bits 8, 9` | `#9 StateRootSpork` + `#10 PQAccountsSpork` | **`v3` (`10s`)** | **`v1, v2`** *(Contract blocks emit `v2`! `R4-03`)* | **`#14 AuthRegistry`** (`BoundSigningDigest`, `H_inc+1`, `179B` PoP, `O(1)` `PoKoS`) | | **Phase 1B** | `Bit 10` | `#11 MomentumMahiPQSpork` | **`v4` (`1.0s`)** | `v1, v2` | `M=4,096` `Mahi-Mahi` (`stride=5`) + Pure-`SHA3` `HashRand-PQ` (`M_coin=256`) | | **Phase 1C** | `Bit 11` | `#12 ProofFirstZenoSpork` | `v4` (`1.0s`)* | `v1, v2` | **`#13 SettlementContract`** + `2^-128` QROM `WHIR-SHA3-v1` (`<= 8,000` perms) | | **Phase 1D** | `Bit 12` | `#13 BitcoinAndEdgeSpork` | `v4` (`1.0s`) | `v1, v2` | `d_btc` SPV + **`#15 ChannelContract`** (`...r7xsx2`) + `SigLock 3..4` + PTLC `{0..2}` cap | | **Phase 1E** | `Bit 13` | `#14 LegacyCryptoSunsetSpork` *(at `H_inc`!)* | `v4` (`1.0s`) | **`v2` only** | Disables `0x00, 0x81, Bridge, Swap, PTLC {0..2}` + `SunsetAnchorCheckpoint` (`<= MaxPreCRQCBitcoinHeight`) | --- ## 4. Sovereign vs. Provisioned Hardware Envelopes (`B08, H01, M01, R4-05`) | Node Role | Reference Hardware Target | Network Envelope | Disk & Retention (`B08` + `R4-02/07`) | Qualified Capacity & Trust | |---|---|---|---|---| | **Sentry / Light `Syrius`** | `1–2 vCPU` · `512 MB – 2 GB RAM` | `< 1 Mbps` | `< 500 MB` (`SunsetAnchorCheckpoint` + `16.4 MB/yr` `EpochTerminalQC`s + `1.2 KB` `smt-v1` proofs) | End-user wallet; runs **Regime 4 Unbounded Edge `d_channels`**. | | **Sovereign Pillar Validator** *(`RFC-00` Floor)* | **Raspberry Pi 5** (`4× Cortex-A76`, `8 GB RAM`, `<= 6.5 GB` RSS, `<= 12 W` DC) | **`100 Mbps` RX / `25 Mbps` TX** (`6.88–9.27 Mbps` total `5 Hz` direct mesh + QC + batch + `AVID-FP` TX `R4-05`) | **`1 TB` NVMe** (`<= 450 GB` steady-state: full `smt-v1` + `30d` rolling blocks + `14d` `[0x11]` witnesses & QCs + `H in {1,2}` legacy pin) | **Full Consensus & Proof-First Validator** (`67–132` PQ L1 txs/s `1.0x`, `134–264` burst + `2` STARK batches/s). | | **Provisioned Sentinel Node** | `8–16 Cores` · `16–32 GB RAM` | **`200 Mbps – 1 Gbps`** | `2–4 TB NVMe` (`ManifestV1` full block/witness archives & `Zeno` DA shards) | **Bonded Relay & Coded DA Service** (`5,000 ZNN + 50,000 QSR` bond; `0` consensus votes). | | **`Zeno` Executor / Prover** | `32 Cores` · `64–128 GB RAM` + `1×` RTX 4090/5090 GPU | `500 Mbps – 1 Gbps` | `2–4 TB NVMe` (domain `CompactTree` + `zeno-stf` witness staging) | **Opt-In Off-Chain Prover** (`6–18 s` batch prove target incl. `32b` grinding; `70%` domain fee share; `S3` bounty escape). | ================================================================================ CHAPTER 23 / 31: 0x3639/go-zenon-v1 Master Implementation Blueprint (Verified Go 1.27+ API, zenon-rs, syrius, zeno-stf) FILE: docs/roadmap/go-zenon-v1-master-blueprint.md | URL: https://0x3639.com/zenon-phase-1/docs/roadmap/go-zenon-v1-master-blueprint ================================================================================ # `0x3639/go-zenon-v1` Master Implementation Blueprint (`Go 1.27+` Verified, `ZNN-SPEC-PHASE1-v4`) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Maps the entire **Zenon Phase 1 `v4`** architecture onto [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1)'s strictly acyclic `L0–L9` package graph (`CGO_ENABLED=0`), using **live-compiled `Go 1.27+` `crypto/mldsa` API signatures + `BoundSigningDigest` (`R4-01`, KAT `f79b6f58...` / `b7444ca3...`) + startup `GOFIPS140 != v1.0.0` KAT verification (`B01` fix)**, full pure-Go `fn-dsa v0.3` (`32B` seed keygen/sign/verify `R4-09`), Pure-`SHA3-256` `HashRand-PQ` (`R4-05`), `SunsetAnchorCheckpoint` (`<= MaxPreCRQCBitcoinHeight` `R4-09`), all `10` verified `MomentumVM` supervisor hooks (`R4-03`), `SettlementContract (#13)`, `AuthRegistryContract (#14)`, and `ChannelContract (#15)`. > > **Ready to Implement Post-Quantum on `go-zenon-v1`?** See the step-by-step, PR-ordered LLM engineering blueprint: **[`go-zenon-v1` Post-Quantum Validator Implementation Spec (`ZNN-IMP-PQ-V1` · `v4`)](https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec)**. --- ## 1. Unified `L0–L9` Acyclic Package Map (`0x3639/go-zenon-v1`) ```text Layer 0: internal/common (0x1f->uint64 SporkMask, Sporks #9..#14, SunsetAnchorCheckpoint, M=4096, M_coin=256) internal/crypto (Go 1.27+ crypto/mldsa + BoundSigningDigest KAT, crypto/mlkem, fndsa512_v03.go, slhdsa.go, xmss22_wal.go, hashrand_pq.go, zkverify/whir_sha3_v1.go [<=8k perms]) Layer 1: internal/types ({0x00, 0x02} UserClass allowlist, Settlement #13, AuthRegistry #14, Channel #15) internal/trie/smtcore (Domain-separated [0x00]/[0x01] smt-v1 depth-256 SHA3-256 Sparse Merkle Tree R4-07) internal/storage (Pebble v2 VersionedStore + [0x11] ProofWitness sidecar + 32B pubKeyHash HotCache) Layer 2: internal/codec (<=180 KiB self-node / 10 MiB tree caps; LP-framed WitnessCommitment R4-07) internal/nom (Unchanged 306B AccountBlock.ComputeHash; Momentum v3 & v4) internal/wallet (m/44'/73404'/1'/alg'/idx' KDF [32B FN-DSA seed] + fresh 256b seed + PoKoS client) internal/p2p (Direct 1-hop /znn/dag/{vertex,map,qc}/v2, /znn/dag/avss/v4, /znn/tls-pq/1.0.0) Layer 3: internal/pow (Two-Lane DynamicPlasma + WitnessPlasma + Equi-X [E5] verifier) Layer 4: internal/chain (AccountStore[0x09] PQ PK + [0x0a] + AuthRegistry[0x03] O(1) exposure resolver R4-02) Layer 5: internal/consensus (3-horizon adapter + Mahi-Mahi [C-AS stride=5 default] + Steelhead [B, ZP-Q11]) Layer 6: internal/vm (postPromoStore #8, InclusionContext #9, v2 contract blocks #10 R4-03; H_inc Sunset; AuthRegistry #14; Bridge/Swap/PTLC sunset; ChannelContract #15 [...r7xsx2 R4-08]) Layer 7: internal/protocol (25/100 Mbps sliding-window shaper, InvalidWitnessPenalty, Class-0 delta map) Layer 8: internal/pillar (5 Hz stride=5 FN-DSA-512 worker, 1 Hz qc_wal, HashRand-PQ AVID-FP, >=85% stake gate) internal/rpc (ledger.getLightClientBundle, ledger.getProof, embedded.{auth,channel}.*) Layer 9: internal/node, cmd/* (znnd w/ AssertMLDSAReady(), znnd-sentinel-d1, cmd/libznn PQ exports) ``` --- ## 2. Live-Verified `Go 1.27+` `BoundSigningDigest` (`crypto/mldsa`) & `WHIR-SHA3-v1` Interfaces (`R4-01, R4-04`) ```go title="internal/crypto/pq_wire.go" //go:build go1.27 package crypto import ( "bytes" "crypto/mldsa" // Go 1.27+ public stdlib API "crypto/sha3" "encoding/hex" ) const ( AlgEd25519 uint8 = 0x00 // Disabled at H_inc >= H_sunset (Spork #14) AlgMLDSA44 uint8 = 0x01 // Final FIPS 204 (Go 1.27+ stdlib crypto/mldsa) AlgFNDSA512 uint8 = 0x02 // Provisional Draft FIPS 206 (Pure-Go fn-dsa v0.3, 0x05 reserved) AlgSLHDSA128s uint8 = 0x03 // Final FIPS 205 (Pure Keccak SHAKE256 — Governance & Cold Vaults) AlgXMSSShake22 uint8 = 0x04 // Final SP 800-208 (Dual-tree 2^22 validator emergency key, 2,884B sig) AlgProofWHIRSha3V1 uint8 = 0x10 // Pure-SHA3-256 WHIR-SHA3-v1 STARK (Settlement #13 & PoKoS #14) AlgHybridEdMLDSA44 uint8 = 0x81 // Forbidden on 0x00 Path-C first reveals (R4-01); disabled at Spork #14 MLDSA44PubKeySize = mldsa.MLDSA44PublicKeySize // 1312 MLDSA44SigSize = mldsa.MLDSA44SignatureSize // 2420 FNDSA512PubKeySize = 897 FNDSA512SigSize = 666 SLHDSA128sPubSize = 32 SLHDSA128sSigSize = 7856 MaxSingleProofWitnessBytes = 131_072 // 128 KiB per AccountBlock (fits 57-86 KiB 2^-128 QROM receipts) MaxMomentumProofBytes = 262_144 // 256 KiB/s dedicated Momentum v4 Lane-2 ProofWitness cap ) // ComputeBoundSigningDigest (R4-01) binds (domainCtx, algID, SHA3-256(resolvedPubKeyWire), msg32) // so 0x81 hybrid signatures can NEVER be stripped down to 0x00 or 0x01! func ComputeBoundSigningDigest(domainCtx string, algID uint8, resolvedPubKeyWire, msg32 []byte) [32]byte { pkHash := sha3.Sum256(resolvedPubKeyWire) h := sha3.New256() h.Write([]byte(domainCtx)) h.Write([]byte{0x00, algID}) h.Write(pkHash[:]) h.Write(msg32) var out [32]byte h.Sum(out[:0]) return out } func VerifyMLDSA44Bound(resolvedPubKeyWire, msg32, rawSig []byte, domainCtx string, outerAlgID uint8) bool { if len(rawSig) != MLDSA44SigSize || len(msg32) != 32 || len(domainCtx) > 255 { return false } var rawPub []byte if outerAlgID == AlgMLDSA44 && len(resolvedPubKeyWire) == 1+MLDSA44PubKeySize { rawPub = resolvedPubKeyWire[1:] } else if outerAlgID == AlgHybridEdMLDSA44 && len(resolvedPubKeyWire) == 1+32+MLDSA44PubKeySize { rawPub = resolvedPubKeyWire[33:] } else { return false } pk, err := mldsa.NewPublicKey(mldsa.MLDSA44(), rawPub) if err != nil { return false } digest := ComputeBoundSigningDigest(domainCtx, outerAlgID, resolvedPubKeyWire, msg32) return mldsa.Verify(pk, digest[:], rawSig, &mldsa.Options{Context: domainCtx}) == nil } // AssertMLDSAReady verifies both the low-level stdlib KAT and the v4 BoundSigningDigest KAT at startup! func AssertMLDSAReady() { var seed [32]byte for i := range seed { seed[i] = byte(i + 1) } sk, err := mldsa.NewPrivateKey(mldsa.MLDSA44(), seed[:]) if err != nil { panic("crypto/mldsa disabled (ensure GOFIPS140 is off or >=v1.26.0): " + err.Error()) } pubWire := append([]byte{AlgMLDSA44}, sk.PublicKey().Bytes()...) msg32 := sha3.Sum256([]byte("zenon-v4-bound-ab-kat")) digest := ComputeBoundSigningDigest("zenon-ab:v2", AlgMLDSA44, pubWire, msg32[:]) sig, err := sk.SignDeterministic(digest[:], &mldsa.Options{Context: "zenon-ab:v2"}) if err != nil { panic("crypto/mldsa deterministic sign failed: " + err.Error()) } wantSum, _ := hex.DecodeString("b7444ca31c5c802bd2cdc7f3fd5c76d1e2bce8655bfd44dd96a099e26c8608cf") gotSum := sha3.Sum256(sig) if !bytes.Equal(gotSum[:], wantSum) { panic("crypto/mldsa v4 BoundSigningDigest KAT mismatch") } } ``` ```go title="internal/crypto/zkverify/whir_sha3_v1.go" package zkverify // VerifyWHIRStarkV1 verifies a 2^-128 QROM WHIR-SHA3-v1 receipt using EXCLUSIVELY // domain-separated ([0x00]/[0x01]) FIPS-202 SHA3-256 Merkle commitments and SHA3-256/SHAKE256 // Fiat-Shamir transcripts (256-bit extension field + >= 32-bit grinding, zero Poseidon2 / BN254). // Enforces <= 131,072 B length, <= 6 folding rounds, <= 256 Merkle queries, and <= 8,000 Keccak // permutations inside a pre-allocated 256 KiB worker arena (0 heap allocs, <= 3.5 ms on Cortex-A76). func VerifyWHIRStarkV1(arena *[262144]byte, vkeyCommitment [32]byte, publicInputsDigest [32]byte, proofWire []byte) bool ``` --- ## 3. Cross-Client & Ecosystem Parity (`zenon-rs`, `syrius`, `zeno-stf`) 1. **`0x3639/zenon-rs` (Rust Node):** Uses RustCrypto `ml-dsa` (verified against both `621b16f8...` and `b7444ca3...` `BoundSigningDigest` KATs), `slh-dsa`, `ml-kem`, pinned `fn-dsa = "=0.3.0"` (`32B` seed), `hashrand-pq`, and `whir-sha3-v1`. 2. **`syrius` (Dart/Flutter Wallet):** Inherits `Go 1.27+` `BoundSigningDigest` (`crypto/mldsa`), `FN-DSA-512` (`32B` seed), `0x02` `z1q{2,f,g,t}...` KDF, independent `256-bit` seed generation, `179-byte` `zenon-auth-pop:v3` signer, `d_channels` (`...r7xsx2`), and `PoKoS` prover via `cmd/libznn`. 3. **`Zeno` (`zeno-stf` + `zeno-executor`):** Emits `57–86 KiB` (`<= 128 KiB` cap, `<= 8,000` Keccak perms) `2^-128` QROM `WHIR-SHA3-v1` STARKs (`AlgProofWHIRSha3V1 = 0x10`) directly. ================================================================================ CHAPTER 24 / 31: 6-State Closure Taxonomy, Bend + Lean Proofs & Gates G1–G10 + ZP-Q11–Q30 FILE: docs/roadmap/formal-verification-and-fuzzing.md | URL: https://0x3639.com/zenon-phase-1/docs/roadmap/formal-verification-and-fuzzing ================================================================================ # 6-State Closure Taxonomy, `Bend + Lean` Proofs & Qualification Gates (`G1–G10` + `ZP-Q11–Q30`) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Governed by the **6-State Closure Taxonomy** (`OPEN -> SPEC-RESOLVED -> IMPLEMENTED -> PROVEN -> PHYSICALLY QUALIFIED -> CLOSED`), **Zenon Phase 1 `v4`** enforces **30 conjunctive qualification gates**: core gates **`G1–G10`**, Round-2 supplemental gates **`ZP-Q11–Q22`** (`ZDC-ZP1-HR-001`), Round-3 post-quantum & sunset gates **`ZP-Q23–Q26`** (`ZDC-QS-DEEZ-HR-001`), and Round-4 cryptographic & supervisor gates **`ZP-Q27–Q30`** (`ZDC-ZP1-R4-AUDIT`). **No Spork may activate on mainnet until every applicable gate reaches `CLOSED`.** --- ## 1. Mandatory 6-State Audit Closure Taxonomy | Closure State | Required Falsifiable Artifact | |:---:|---| | **`OPEN`** | Confirmed defect or underspecification without normative specification text. | | **`SPEC-RESOLVED`** | Normative specification updated in `zenon-phase-1` with byte-exact formulas, state machines, and internally consistent arithmetic (`0` contradictions). | | **`IMPLEMENTED`** | Clean-room `CGO_ENABLED=0` Go `1.27+` (`go-zenon-v1`) and/or Rust (`zenon-rs`, `zeno-stf`) implementation merged with deterministic unit + golden-vector tests. | | **`PROVEN`** | Mechanized `Bend 2.0.40 + Lean 4.34.0` / `TLA+` / `Apalache` theorem or cryptographic soundness bound discharged with `0` `sorry` axioms. | | **`PHYSICALLY QUALIFIED`** | Sustained 24h+ benchmark/fault-injection run on physical `RFC-00` hardware (`>= 3` Raspberry Pi 5 `8 GB` nodes over shaped `100/25 Mbps` WAN). | | **`CLOSED`** | All four upstream artifacts (`SPEC-RESOLVED + IMPLEMENTED + PROVEN + PHYSICALLY QUALIFIED`) archived and hash-pinned in CI. | --- ## 2. Core 10-Gate Mainnet Qualification Ladder (`G1–G10`) | Gate | Falsifiable Pass Criterion (`ZNN-SPEC-PHASE1-v4`) | Scope | |:---:|---|---| | **`G1`** | **Pinned Commits & Cross-Language Golden Wire Vectors:** Byte-identical `Go 1.27+` (`AssertMLDSAReady` `621b16f8...` & `BoundSigningDigest` `b7444ca3...` KATs `R4-01`, golden `0x02` `z1qgyf208a5...` `N02`, `ChannelContract` `...r7xsx2` `R4-08`) and Rust vectors across `AccountBlock v2`, `179B` PoP, `ZenonCommitStateProto` (`1,538 B`), `99B` checkpoints, and `[0x00]/[0x01]` `smt-v1`. | All Layers | | **`G2`** | **Exhaustive Small-State Model Checking (`n = 4, 7`):** Exhaustive permutation check of non-overlapping `stride = 5` `Mahi-Mahi` (`Profile C-AS`) wave commits and (if enabled) `Profile B` `DirectSkip` (`C02`) & `r + 3` maturity (`C01`). | Consensus | | **`G3`** | **Lossless `13B/50B` Ordered Parent Bitmap & `34B` Delta `MAP_REPLY` Parity (`H16`):** `100%` identical traversals vs. uncompressed engine under `15%` delayed parents and `33` simultaneous equivocators within `< 0.2 Mbps` `Class 0` budget. | Consensus | | **`G4`** | **Asynchronous Prefix Liveness & Pure-`SHA3-256` `HashRand-PQ` Coin (`R4-05`):** Verified `epsilon > 0` wave progress, `1-bit` unique `S_w` interpolation (`M_coin = 256`, `T_coin = 86`), `2^-512` QROM degree check, and `< 8 MB` RSS `AVID-FP` replenishment (`0.69–1.34 Mbps`). | Consensus | | **`G5`** | **Quantized `M = 4,096` Voting & `M_coin = 256` Intersection + `2D AVID` Custody (`B04, R4-05, H08, M08`):** Verified `2 * 2,731 - 4,096 == 1,366 > F_Q` and `2 * 171 - 256 == 86 == T_coin` across skewed stake distributions and malicious `AVID-FP` / `2D AVID` codeword injection. | Consensus & DA | | **`G6`** | **3-Horizon Crash Recovery, `qc_wal` & `xmss_wal` (`H09, M04`):** `SIGKILL` fault injection around Pebble `WriteBatch(Sync: true)`, `qc_wal` single-vote height lock, and `xmss_wal` `fdatasync` leaf high-water mark (`0` double-signs). | Storage & WAL | | **`G7`** | **Disjoint-Commuting `F1 == F0`, `H_inc + 1`, `postPromoStore` & `InclusionContext` (`B03, B05, M01, M05, R4-03`):** `256`-striped user execution + sequential Embedded Contract fold matches `SerialOracle F0` byte-for-byte across `postPromoStore` (`#8`), `InclusionContext` (`#9`), and `Version = 2` contract blocks (`#10`). | VM & Projection | | **`G8`** | **Physical Raspberry Pi 5 WAN Qualification (`B08, M01, M02, C05`):** Separate `-race` concurrency pass + uninstrumented release run on `>= 3` Pi 5 (`8 GB`, `1 TB` NVMe) nodes over shaped `100/25 Mbps` sustaining 24h load within `<= 6.5 GB` RSS, `<= 15 Mbps` control TX, and `<= 450 GB` projected NVMe. | Hardware Gate | | **`G9`** | **Post-Quantum, `/znn/tls-pq/1.0.0` & `Equi-X` Fuzzing Gate (`H14, M04, M08, R4-09`):** `10^8` differential Go/Rust fuzz iterations for `Go 1.27+` `crypto/mldsa`, pure-Go `fn-dsa v0.3` (`32B` seed keygen/sign/verify, `0` FPU verify!), `SLH-DSA-128s`, `/znn/tls-pq/1.0.0`, and `Equi-X` `[E5]`. | Post-Quantum L1 | | **`G10`** | **Pure-`SHA3` `WHIR-SHA3-v1` `2^-128` QROM Soundness & Zero-Alloc Arena Audit (`H02, H07, M10, R4-04`):** External cryptographic audit + mutation testing confirming `<= 2^-128` `CMS19` QROM soundness (`256b` ext field + `32b` grind), `0` `Poseidon2`, `<= 8,000` Keccak perms, `<= 131,072 B` cap, and `0` heap allocs. | Proof-First ZK | --- ## 3. Supplemental Adversarial Gates (`ZP-Q11` – `ZP-Q30`, Rounds 2, 3 & 4) | Gate | Falsifiable Pass Criterion | Blocks Stage | |:---:|---|:---:| | **`ZP-Q11`** | **Mechanized `Profile B` (`Steelhead`) Refinement Proof (`H10`):** TLA+/Lean refinement proof; until `CLOSED`, `Profile C-AS` (`stride = 5` `Mahi-Mahi`) is mandatory. | `Profile B` Opt-In | | **`ZP-Q12`** | **`5%`-Capped Coin Share Whale Bound (`R4-05`):** Proves `c_i <= 13` `HashRand-PQ` `PQCoinShareBundleProto` stays `<= 14.2 KiB` (`< 13 Mbps` at `1.0 Hz`). | Phase 1B | | **`ZP-Q13`** | **`HashRand-PQ` Memory, `AVID-FP` Replenishment & Bad-Dealer Exclusion (`R4-05`):** `< 8 MB` dealer RSS (`2.03 MiB` matrix) & `0` deadlocks across `10` bank rollovers with `33%` corrupt dealers. | Phase 1B | | **`ZP-Q14`** | **End-to-End `MomentumPQQC` Formation & Equivocation Slash (`H09`):** `100%` unique `Momentum.Hash` QCs, `qc_wal` crash safety, and `0.65 Mbps` wire bound. | Phase 1B | | **`ZP-Q15`** | **Direct Mesh Topology & Zero-Lattice `XMSS-SHAKE_22` + `HQC-192` Failover (`M01, M04, R4-05`):** Live `N = 100` shaped test (`<= 6.59 Mbps` at `2 Hz` `XMSS` + `0.4 Hz` coin) + `SIGKILL` leaf-uniqueness check. | Phase 1B | | **`ZP-Q16`** | **`AuthRegistry (#14)` Competing-Generation, `PrecommitKey` & `179B` PoP Suite (`B03, B05, M06`):** Exhaustive two-intent `Send->Receive` race, `ErrAuthNonceOverflow`, cross-genesis replay, and address-bricking rejection tests. | Phase 1A | | **`ZP-Q17`** | **Two-Lane Dynamic Plasma, `0x1f->uint64` Mask & `PoKoS` Anti-Starvation (`H01, H02, M07`):** Saturated `SubmitBatch` queue test proving `1` reserved `PoKoS` slot/s + bit-exact Phase 0 `0x1f` replay parity. | Phase 1A / 1C | | **`ZP-Q18`** | **Sovereign Pi 5 `1-Year` Accelerated Storage & RAM Projection (`B08`):** Proves `<= 450 GB` NVMe (incl. `H in {1,2}` legacy pin) and `<= 320 MB` `pubKeyHash` RAM cache under `10M`-account dust pressure. | Phase 1B | | **`ZP-Q19`** | **`Equi-X` (`[E5]`) + `306B` Hash + `WitnessPlasma` Conformance (`H14`):** Cross-language Go/Rust vector suite for `HashX` compilation, `uint128` effort target, and `+272` plasma. | Phase 1A | | **`ZP-Q20`** | **`WHIR-SHA3-v1` Verifier (`<= 3.5 ms` Cortex-A76) & Client/Server Prover Benchmark (`R4-04`):** Physical Pi 5 verifier (`<= 8,000` Keccak perms, `<= 3.5 ms`, `0` allocs) + measured laptop/mobile `R_PoKoS` & Tier 1–3 `zeno-stf` benchmarks. | Phase 1A / 1C | | **`ZP-Q21`** | **`ChannelContract (#15)`, `SigLock` & `256b` `HTLC` Conservation Suite (`B06, B07, B09, M07, M10`):** Lean 4 conservation proof + `GraceExtension = 3,600` anti-snipe & `92B` `SigLock` recipient-binding tests. | Phase 1D | | **`ZP-Q22`** | **Reproducible `Phase 1.0` `go-zenon` vs. `go-zenon-v1` Benchmark:** Published open-source sync/storage/verification benchmark harness on identical hardware. | Phase 1.0 | | **`ZP-Q23`** | **Era-Separated `H_inc` Sunset vs. `MomentumAcknowledged` Replay Suite (`DEEZ-B02, M09`):** Proves `0x00`/`0x81` blocks referencing `H_ack < H_sunset` are rejected at `H_inc >= H_sunset` while historical sync replays cleanly, plus `>= 85%` stake-readiness spork gate test. | Phase 1E | | **`ZP-Q24`** | **`pubKey_A`-Bound `R_PoKoS` Soundness & Cohort Conformance (`DEEZ-B06, B08, M05`):** QROM knowledge-soundness proof + test vectors verifying `32B` `expectedPubKeyA` binding on exposed accounts (`~2^126` Grover), zero-balance sponsor submission, and `12/24`-word + `KeyFile` + raw seed coverage. | Phase 1A | | **`ZP-Q25`** | **Post-CRQC `SunsetAnchorCheckpoint` + `MaxPreCRQCBitcoinHeight` Rejection (`DEEZ-B11, R4-09`):** Proves `100%` rejection of forged Phase 0 `Ed25519` chains AND post-CRQC spoofed BTC `OP_RETURN`s at heights `> MaxPreCRQCBitcoinHeight`. | Phase 1E | | **`ZP-Q26`** | **Complete Embedded-Contract Classical Sunset & Zero-Stranded-Funds Drain (`DEEZ-B12`):** End-to-end state tests verifying `Bridge`, `Swap`, `Pillar.RegisterLegacy`, and `Ptlc` `{0,1,2}` `Unlock` halt at `H_inc >= H_sunset` while `Ptlc.Reclaim` deletes `ReclaimLock` cleanly (`R4-03`). | Phase 1D / 1E | | **`ZP-Q27`** | **`BoundSigningDigest` (`0x81` Anti-Stripping), `O(1)` Exposure Resolver & `MomentumVM` Landmines `#8–#10` (`R4-01, R4-02, R4-03`):** Verifies `0x81 -> 0x00` stripping & Path-C ransomware rejection, `O(1)` `ByHeight(1..2)` + `AuthRegistry[0x03]` exposure parity (`0` `ChangesHash` drift), `postPromoStore`, `InclusionContext`, and `Version = 2` contract blocks. | Phase 1A | | **`ZP-Q28`** | **`HashRand-PQ` `AVID-FP` Re-Encoding Uniqueness & `stride = 5` Wave Suite (`R4-05`):** Mechanized Lean 4 proof of `(100, 34)` Reed-Solomon `ReencodeCheck` uniqueness + `1.0 Hz` coin cadence verification at `5 Hz` rounds. | Phase 1B | | **`ZP-Q29`** | **Domain-Separated `smt-v1` (`[0x00]/[0x01]`), `LP`-Framed Witness & `[0x11]` Sidecar Compaction (`R4-07, C03`):** Proves leaf/internal collision immunity and `0` `Momentum.ChangesHash` divergence when `[0x11]` `ProofWitness` compacts at `14` days. | Phase 1A / 1C | | **`ZP-Q30`** | **`ChannelContract (#15)` In-`CLOSING` `ClaimHTLC` + `FinalizeBasePayouts` Suite (`R4-08`):** Proves `RevealedPreimage` survives `ChallengeHigherNonce` snipes before `expiryTs` and `FinalizeBasePayouts` releases `balance_a, balance_b` while dust HTLCs remain unsettled. | Phase 1D | --- ## 4. Extended `Bend 2.0.40 + Lean 4.34.0` Proof Suites (`test/bend/`) 1. **Suite 12 (`dag_m4096_and_hashrand_pq`):** `m4096_quorum_identity`, `m256_coin_identity`, `avid_fp_reencode_uniqueness`, and `mahi_stride5_wave_safety`. 2. **Suite 13 (`adapter_qc_and_hfork`):** `witness_excluded_unit_identity`, `qc_single_vote_uniqueness`, `hfork_wallclock_preservation`, and `disjoint_stripes_commute_with_f0`. 3. **Suite 14 (`smt_v1_and_settlement`):** `smt_v1_domain_separated_soundness`, `sidecar_witness_pruning_preserves_changes_hash`, and `settlement_escrow_minted_conservation`. 4. **Suite 15 (`pq_auth_plasma_and_sunset`):** `bound_signing_digest_non_strippable`, `o1_exposure_resolver_soundness`, `h_inc_sunset_and_key_immutability`, and `channel_decoupled_base_htlc_conservation`. ================================================================================ CHAPTER 25 / 31: Master Audit Index: 118 Tracked Findings Across Rounds 1, 2, 3 & 4 (v0 → v4) FILE: docs/roadmap/audit-disposition-ledgers.md | URL: https://0x3639.com/zenon-phase-1/docs/roadmap/audit-disposition-ledgers ================================================================================ # Master Audit Disposition Index (`118` Tracked Findings Across Iterations `0 → 5`) > **60-Second TL;DR (`ZNN-SPEC-PHASE1-v4`):** Every hostile review conducted against the Zenon Phase 1 architecture is permanently archived, independently checked against actual source code & Python/Go math, diff-tracked by iteration, and governed by the **6-State Closure Taxonomy** (`OPEN -> SPEC-RESOLVED -> IMPLEMENTED -> PROVEN -> PHYSICALLY QUALIFIED -> CLOSED`): > - **[Iteration Changelog (`v0 → v4`)](https://0x3639.com/zenon-phase-1/docs/reviews/iteration-changelog):** Side-by-side record of what changed in every specification iteration (`Momentum-Mahi v4 → v5 → ZP1 v1 → ZP1 v2 → ZP1 v3 → ZP1 v4`). > - **[Round 1 Ledger (`41` IDs: `MM4-HR-001` + `ZDC-MM-ER-01` + `PQ-01–10`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-1-mm4-hr-001):** Pre-unification & `v1` cross-stack unification audit ledger. > - **[Round 2 Maintainer Response (`37/37` IDs: `ZDC-ZP1-HR-001`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-2-zp1-hr-001-maintainer-response):** Complete 7-column disposition ledger resolving all `37` findings from the `4f8e3c7` (`ZNN-SPEC-PHASE1-v1`) review. > - **[Round 3 Independent Verification & Response (`26/26` IDs: `ZDC-QS-DEEZ-HR-001`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-3-deez-pq-hr-001-maintainer-response):** Point-by-point source-code & cryptographic check of `DeeZ_Post_Quantum_Hostile_Review_v0.1`. > - **[Round 4 Independent Cryptographic & Source Audit (`14/14` IDs: `v4-RC3` + `R4-01–R4-09`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit):** Critical audit of `v4-Candidate-RC3` (`C01–C05`, `RC2`, `RC3`) plus nine independent cryptographic, consensus, and `go-zenon-v1` supervisor bugs resolved in `ZNN-SPEC-PHASE1-v4`. > - **Verbatim Hostile Review Archives:** [`ZDC-ZP1-HR-001` v1.0](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-zp1-hr-001-verbatim) · [`ZDC-QS-DEEZ-HR-001` v0.1](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-qs-deez-hr-001-verbatim). --- ## Summary Rollup Across All Four Hostile Review Rounds (`118` Total Findings) | Audit Round & Document ID | Audited Snapshot | Findings Count | `ZNN-SPEC-PHASE1-v4` Disposition | Qualification Gates to `CLOSED` | |---|---|---:|---|---| | **Round 1A · `ZDC-FRONTIER-MM4-HR-001` + `ZDC-MM-ER-01`** | `Momentum-Mahi v4 → v5` | **`31` IDs** + `HR-01–12` | **`31 / 31 SPEC-RESOLVED`** ([Round 1 Ledger](https://0x3639.com/zenon-phase-1/docs/reviews/round-1-mm4-hr-001)) | `G1–G8`, `ZP-Q11–Q15` | | **Round 1B · Cross-Stack `PQ × DAG × Zeno`** | `MM v5 + PQ + Zeno → ZP1 v1` | **`10` IDs** (`PQ-01–10`) | **`10 / 10 SPEC-RESOLVED`** ([Round 1 Ledger](https://0x3639.com/zenon-phase-1/docs/reviews/round-1-mm4-hr-001)) | `G8–G10`, `ZP-Q12–Q21` | | **Round 2 · `ZDC-ZP1-HR-001` Consolidated Review** | `ZP1 v1` (`4f8e3c7`) → `ZP1 v2` | **`37` IDs** (`10B, 18H, 9M`) | **`37 / 37 SPEC-RESOLVED`** ([Round 2 Ledger](https://0x3639.com/zenon-phase-1/docs/reviews/round-2-zp1-hr-001-maintainer-response)) | `G1–G10`, `ZP-Q11–Q22` | | **Round 3 · `ZDC-QS-DEEZ-HR-001` PQ Deep-Dive** | `zenon-post-quantum@e5930af` + `go-zenon-v1@124b4ced` → `ZP1 v3` | **`26` IDs** (`12B, 12M, 2N`) | **`26 / 26 SPEC-RESOLVED`** ([Round 3 Ledger](https://0x3639.com/zenon-phase-1/docs/reviews/round-3-deez-pq-hr-001-maintainer-response)) | `G1, G7–G10`, `ZP-Q23–Q26` | | **Round 4 · `v4-Candidate-RC3` + Independent Crypto/Source Audit** | `ZP1 v3` + `v4-Candidate-RC3` + `go-zenon-v1` → **`ZP1 v4`** | **`14` IDs** (`5` RC3 + `9` new `R4-01..09`) | **`14 / 14 SPEC-RESOLVED`** (`3` valid RC3 catches integrated, `3` broken RC3 patches rejected, `9` new crypto/supervisor bugs closed — [Round 4 Ledger](https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit)) | `G1, G4, G7–G10`, **`ZP-Q27–Q30`** | 👉 **Inspect the complete side-by-side evolution in [06 · Iterative Hostile Reviews](https://0x3639.com/zenon-phase-1/docs/reviews/iteration-changelog).** ================================================================================ CHAPTER 26 / 31: LLM Hostile Review Protocol & Master Sourced Bibliography ([R1]–[R59], [E1]–[E7]) FILE: docs/roadmap/llm-hostile-review-and-references.md | URL: https://0x3639.com/zenon-phase-1/docs/roadmap/llm-hostile-review-and-references ================================================================================ # LLM Hostile Review Protocol & Master Sourced Bibliography (`[R1]`–`[R59]`, `[E1]`–`[E7]`) > **Single-File Full Ingestion URL (`ZNN-SPEC-PHASE1-v4`):** [`https://0x3639.com/zenon-phase-1/llms-full.txt`](pathname:///llms-full.txt) > **Structured Agent Index URL:** [`https://0x3639.com/zenon-phase-1/llms.txt`](pathname:///llms.txt) > **Previous Hostile Review Rounds (`118` Findings Tracked):** [`docs/reviews/iteration-changelog`](https://0x3639.com/zenon-phase-1/docs/reviews/iteration-changelog) --- ## 1. Round-5 Multi-Agent Hostile Re-Audit Prompt (`ZNN-SPEC-PHASE1-v4`) Attach [`llms-full.txt`](pathname:///llms-full.txt) to independent frontier reasoning models (ChatGPT Pro, Claude Opus, Gemini Pro, DeepSeek-R1) — **and independently verify every claim against source code and executable math**: ```text You are an adversarial distributed-systems, post-quantum cryptography, and ZK proof auditor executing Round-5 hostile review of Zenon Phase 1 (ZNN-SPEC-PHASE1-v4). Ingest the complete specification in llms-full.txt (including Section 06 Iterative Hostile Reviews covering Rounds 1, 2, 3 & 4) and attempt to construct concrete mathematical countermodels, source-code mismatches against 0x3639/go-zenon-v1, or byte/memory/disk budget violations against: 1. Consensus Quorums, Pure-SHA3-256 HashRand-PQ Coin, Stride=5 Waves & Post-CRQC Bootstrap: - M_shares = 4,096 voting (Q_vote = 2,731) + M_coin = 256 coin shares (T_coin = 86, c_i <= 13), 260-row GF(2^256) dealer matrix (2.03 MiB, 4-row 2^-512 QROM degree check), column-major AVID-FP re-encoding uniqueness (0.69-1.34 Mbps dealing), stride = 5 non-overlapping waves (1.0 Hz coin = 5.32-6.37 Mbps TX), zero-lattice 0x04 XMSS + HQC-192 mode, and SunsetAnchorCheckpoint (BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight). 2. Post-Quantum L1, BoundSigningDigest, O(1) Exposure Resolver & go-zenon-v1 Supervisor Hooks: - Verify BoundSigningDigest (b7444ca3... KAT, defeating 0x81 <-> 0x00 stripping & Path-C ransomware), O(1) ResolveLegacyEd25519Exposure (ByHeight(1..2) + post-content AuthRegistry[0x03]), postPromoStore (#8), InclusionContext in GenerateEmbeddedReceive (#9), Version = 2 generated contract blocks (#10), and Pebble [0x11] ProofWitness sidecar separation from Momentum.ChangesHash. 3. 2^-128 QROM WHIR-SHA3-v1, Domain-Separated smt-v1 ([0x00]/[0x01]) & ChannelContract (#15): - Verify CMS19 QROM budget (256b ext field + 32b grind + [56,32,23]/[112,64,45] queries <= 8,000 Keccak perms <= 3.5 ms on Cortex-A76), [0x00]/[0x01] smt-v1, and z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2 in-CLOSING ClaimHTLC + hostage-free FinalizeBasePayouts. Report only concrete falsifiable defects with exact chapter/section citations, arithmetic derivations, and minimal specification fixes. ``` --- ## 2. Master Sourced Bibliography (`[R1]`–`[R59]` & `[E1]`–`[E7]`) ### Primary External Verification Sources (`[E1]`–`[E7]`) * **`[E1]` Go Project (`golang/go#77626` & `go1.27` `crypto/mldsa`).** *Public `crypto/mldsa` (FIPS 204) Standard Library Package & `GOFIPS140` Module Requirements.* 2026 — [https://go.dev/doc/go1.27](https://go.dev/doc/go1.27) / [https://github.com/golang/go/issues/77626](https://github.com/golang/go/issues/77626) * **`[E2]` T. Pornin.** *`fn-dsa` (`v0.3`): Deterministic `32B`-Seed Keygen, Fixed-Point Signing & Pure-Integer NTT Verification (Provisional Draft FIPS 206 Notice).* — [https://crates.io/crates/fn-dsa](https://crates.io/crates/fn-dsa) * **`[E3]` R. Linus et al.** *"BitVM2: Bridging Bitcoin to Second Layers."* (`BN254` Groth16 + Taproot Pre-Signed Challenge Graph) — [https://bitvm.org/bitvm_bridge.pdf](https://bitvm.org/bitvm_bridge.pdf) * **`[E4]` H. Beast, E. Heilman, I. Foxen Duke.** *`BIP-360`: Pay-to-Merkle-Root (`P2MR`, Draft Bitcoin Soft-Fork Proposal).* — [https://bip360.org/](https://bip360.org/) * **`[E5]` tevador (Tor Project).** *`Equi-X` & `HashX`: CPU-Friendly Asymmetric Client Puzzle (`16-byte` 8-Index Solution).* — [https://github.com/tevador/equix](https://github.com/tevador/equix) * **`[E6]` C. Zalka.** *"Grover's Quantum Searching Algorithm Is Optimal" (Depth-Bounded Parallel Grover Penalty `M = N / K^2`, `W = N / K`).* *Phys. Rev. A 60, 2746* (1999) & NIST PQC `MAXDEPTH` Call Specification. * **`[E7]` A. Chiesa, P. Manohar, N. Spooner (`CMS19`).** *"Succinct Arguments in the Quantum Random Oracle Model."* *TCC 2019* (`ePrint 2019/834`) & **J. Hendricks, G. Ganger, M. Reiter.** *"Verifying Distributed Erasure-Coded Data (`AVID-FP`)."* *PODC 2007*. ### Zenon Core, Hostile Reviews, `go-zenon-v1`, `Zeno-L2` & `Frontier` * **`[R1]` The Zenon Team.** *"Network of Momentum — Leaderless BFT Dual Ledger Architecture (v0.1)."* March 2020. * **`[R14]` Zenon Community.** *"The Road to Phase 1 | Network of Momentum."* Oct 2026 — [https://roadmap.zenon.foo/](https://roadmap.zenon.foo/) * **`[R15]`–`[R19]` TminusZ & DigitalSloth.** *Commons Essays & Commit Channels v1.5* — [`TminusZ/zenon-developer-commons`](https://github.com/TminusZ/zenon-developer-commons) * **`[R20]` `0x3639/go-zenon-v1` (`@124b4ced` / `@1c6e3d8`).** *Clean-Room Go Full Node & Pillar Validator (`pebble/v2`, 300 Bend + Lean Laws).* — [https://github.com/0x3639/go-zenon-v1](https://github.com/0x3639/go-zenon-v1) * **`[R21]` `0x3639/zenon-rs`.** *Rust Network of Momentum Node Implementation.* — [https://github.com/0x3639/zenon-rs](https://github.com/0x3639/zenon-rs) * **`[R22]` `zenon-network/go-zenon` (`@e8986a63`).** *Legacy Alphanet Phase 0 Reference Node.* — [https://github.com/zenon-network/go-zenon](https://github.com/zenon-network/go-zenon) * **`[R25]` C. LeMahieu.** *"Nano: A Feeless Distributed Cryptocurrency Network (Block-Lattice)."* 2018. * **`[R26]`–`[R30]` TminusZ (with Neon reviews).** *Frontier Series (`RFC-00–05`, `Vol. I–III`, `ZDC-FRONTIER-MM4-HR-001`, `ZDC-MM-ER-01`, `Impulse-Z`).* Dec 2026 — [`docs/research/frontier`](https://github.com/TminusZ/zenon-developer-commons/tree/main/docs/research/frontier) * **`[R36]`–`[R37]` DigitalSloth (`Zeno-L2`).** *`zeno-docs` (`ATTESTATION` & `ZK_VALIDITY` specs, `R1–R9`, `smt-v1-test-vectors.json`), `zeno-executor`, and `digitalSloth/go-zenon` (`2835c436`).* — [https://github.com/Zeno-L2](https://github.com/Zeno-L2) * **`[R41]`–`[R42]` `0x3639/zenon-phase-1`.** *Unified Zenon Phase 1 Master Specification (`ZNN-SPEC-PHASE1-v1 → v2 → v3 → v4`).* — [https://github.com/0x3639/zenon-phase-1](https://github.com/0x3639/zenon-phase-1) * **`[R56]` TminusZ (Coordinating ChatGPT + Neon).** *`ZDC-ZP1-HR-001`: Consolidated Hostile Review of `ZNN-SPEC-PHASE1-v1` (`4f8e3c7`).* v1.0, Dec 2026 — [Archived Verbatim](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-zp1-hr-001-verbatim) * **`[R57]` TminusZ Research Program (`DeeZ`).** *`ZDC-QS-DEEZ-HR-001`: Zenon Post-Quantum Independent Hostile Review (`edgepillar/zenon-post-quantum@e5930af` & `go-zenon-v1@124b4ced`).* v0.1, Dec 2026 — [Archived Verbatim](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-qs-deez-hr-001-verbatim) * **`[R58]`–`[R59]` Round-4 Audit (`v4-Candidate-RC3` + `ZDC-ZP1-R4-AUDIT`).** *Evaluation of `v4-Candidate-RC3` (`C01–C05`) & Independent Cryptographic/Source Audit (`R4-01–R4-09`).* Dec 2026 — [Round 4 Ledger](https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit) ### DAG-BFT Consensus, Coded Dissemination & Post-Quantum Literature * **`[R2]`–`[R6]`** **Danezis et al.** *Narwhal & Tusk*; **Spiegelman et al.** *Bullshark*; **Babel et al.** *Mysticeti*; **Jovanovic et al.** *Mahi-Mahi* (`ICDCS '25`). * **`[R31]`–`[R40]`** **de Angeli et al.** *Steelhead* (`arXiv:2609.30163v2`); **Polyanskii et al.** *Bluestreak* & *Starfish*; **Qiu et al.** *LiDO-DAG*; **Locher & Pignolet.** *2D AVID*; **Danezis et al.** *Walrus / RedStuff*. * **`[R43]`–`[R55]`** **NIST** *FIPS 203, FIPS 204, FIPS 205, Draft FIPS 206, SP 800-208, HQC Backup KEM (2025)*; **RFC 8032**; **Arnon et al.** *WHIR* (`ePrint 2024/1586`); **Plonky3**; **Chalkias et al. / Anza** *`Ed25519-PoKoS`* (`ePrint 2025/1368`); **Das, Xiang, Kokoris-Kogias, Ren** *`HashRand`* (`CCS '24`). ================================================================================ CHAPTER 27 / 31: Iterative Hostile Reviews & Specification Changelog (v0 → v4) FILE: docs/reviews/iteration-changelog.md | URL: https://0x3639.com/zenon-phase-1/docs/reviews/iteration-changelog ================================================================================ # Iterative Hostile Reviews & Specification Changelog (`v0 → v4`) > **Why We Document Every Hostile Review Iteration — And Verify Every Claim Ourselves:** Following Mr. Kaine's architectural thesis—*"Only the vision and the architecture design will matter. The implementation will be done by AI"*—every revision of **Zenon Phase 1** is subjected to multi-model adversarial review against hash-pinned snapshots, and **every reviewer claim is independently checked against actual `go-zenon-v1` / `zenon-rs` / `go-zenon` / `znn_sdk_dart` source code and executable Python/Go math** before updating the specification. --- ## 1. Visual History of Specification Iterations (`Iteration 0` → `Iteration 5`) ```mermaid flowchart LR I0["Iteration 0
Momentum-Mahi v4
(Initial Hybrid DAG Draft)"] -->|"Round 1A+1B
41 IDs"| I2["Iteration 2
ZNN-SPEC-PHASE1-v1
(Commit 4f8e3c7)"] I2 -->|"Round 2 Review
ZDC-ZP1-HR-001
(37 IDs: 10B, 18H, 9M)"| I3["Iteration 3
ZNN-SPEC-PHASE1-v2
(Commit cee69c0)"] I3 -->|"Round 3 PQ Review
ZDC-QS-DEEZ-HR-001
(26 IDs + Source Check)"| I4["Iteration 4
ZNN-SPEC-PHASE1-v3
(104 IDs)"] I4 -->|"Round 4 Crypto & Source
v4-RC3 Eval + R4-01..09
(14 IDs + Live Go KATs)"| I5["Iteration 5 (Current)
ZNN-SPEC-PHASE1-v4
(118/118 SPEC-RESOLVED)"] ``` --- ## 2. Summary Ledger of All Iterations & Pinned Snapshots (`118` Findings Tracked) | Iteration | Spec Identifier | Audited Snapshot / Commit | Hostile Review Document(s) | Findings & Lifecycle Outcome | |:---:|---|---|---|---| | **0 → 1** | `Momentum-Mahi v4 → v5` | `zenon-consensus-upgrade` (`v4`) | [`ZDC-FRONTIER-MM4-HR-001` + `ZDC-MM-ER-01`](https://0x3639.com/zenon-phase-1/docs/reviews/round-1-mm4-hr-001) (`TminusZ` + `Neon`) | **`31` IDs + `12` adapter rules:** Retired throwaway `2s` `Phase A`, repaired `DirectSkip`/`r+3`, added 3-horizon adapter, `2D AVID`, and Pi 5 `25 Mbps` shaper. | | **1 → 2** | `MM v5 + PQ + Zeno → ZNN-SPEC-PHASE1-v1` | Unified into `0x3639/zenon-phase-1` (`4f8e3c7`) | [Cross-Stack `PQ-01 – PQ-10` Audit](https://0x3639.com/zenon-phase-1/docs/reviews/round-1-mm4-hr-001) | **`10` IDs:** Replaced `Ed25519`/`BLS12-381`/`BN254` with `FN-DSA-512`, `ML-DSA-44`, `SLH-DSA-128s`, `AVSS` coin, pure-hash `WHIR` STARKs, `AuthRegistry (#14)`, and Day-1 `PoKoS`. | | **2 → 3** | `ZNN-SPEC-PHASE1-v1 → ZNN-SPEC-PHASE1-v2` | Audited `4f8e3c7` → committed `cee69c0` | **[`ZDC-ZP1-HR-001` v1.0](https://0x3639.com/zenon-phase-1/docs/reviews/round-2-zp1-hr-001-maintainer-response)** ([Verbatim](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-zp1-hr-001-verbatim), `ChatGPT` + `Neon`) | **`37` IDs (`10B, 18H, 9M`):** `M=4,096` shares, `1-hop` mesh, `qc_wal`, Two-Lane Plasma, `WHIR-SHA3-v1`, `ChannelContract (#15)`, gates `ZP-Q11–Q22`. | | **3 → 4** | `ZNN-SPEC-PHASE1-v2 → ZNN-SPEC-PHASE1-v3` | Audited `zenon-post-quantum@e5930af` + `go-zenon-v1@124b4ced` | **[`ZDC-QS-DEEZ-HR-001` v0.1](https://0x3639.com/zenon-phase-1/docs/reviews/round-3-deez-pq-hr-001-maintainer-response)** ([Verbatim](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-qs-deez-hr-001-verbatim), `TminusZ DeeZ`) | **`26` IDs (`12B, 12M, 2N`):** `0x02` `z1q{2,f,g,t}`, `Go 1.27` `crypto/mldsa` API, `H_inc` sunset, `179B` PoP, `pubKey_A`-bound `PoKoS`, `SunsetAnchorCheckpoint`, gates `ZP-Q23–Q26`. | | **4 → 5 *(Current)*** | **`ZNN-SPEC-PHASE1-v3 → ZNN-SPEC-PHASE1-v4`** | Audited `v3` + `v4-Candidate-RC3` + `go-zenon-v1` + `go1.27` | **[Round 4 `v4-RC3` + Independent Crypto Audit](https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit)** | **`14` IDs (`5` RC3 + `9` new `R4-01..09`):** `BoundSigningDigest` (`0x81` anti-stripping/ransomware), `O(1)` exposure resolver, `3` `MomentumVM` landmines (`#8–#10`), `2^-128` QROM `WHIR-SHA3-v1` (`<= 8k` Keccak perms), Pure-`SHA3` `HashRand-PQ` (`M_coin=256`, `stride=5`), `[0x00]/[0x01]` `smt-v1` + `[0x11]` sidecar, `ChannelContract` `...r7xsx2` + `FinalizeBasePayouts`, `MaxPreCRQCBitcoinHeight`, gates **`ZP-Q27–Q30`**. | --- ## 3. Iteration 5 Diff: What Changed from `v3` (+ `v4-RC3`) to `v4` (`ZNN-SPEC-PHASE1-v4`) | Subsystem | `ZNN-SPEC-PHASE1-v3` / `v4-Candidate-RC3` | Verified Round-4 Finding ([Round 4 Ledger](https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit)) | `ZNN-SPEC-PHASE1-v4` Normative Fix | |---|---|---|---| | **Hybrid `0x81` Auth & Path-C First Reveal** | `0x81` signed raw `msg` identically to `0x00`/`0x01`; allowed `0x81` on `0x00` Path-C first spend | **`R4-01`:** Relayer could strip `0x81 -> 0x00` without changing `Block.Hash`; CRQC attacker could ransomware-lock `0x00` victim's `AccountStore[0x09]`! | Mandatory **`BoundSigningDigest`** binding `(domainCtx, algID, SHA3-256(pubKeyWire), msg32)` (live `go1.27` KAT `b7444ca3...`) + **`0x81` forbidden on unregistered `0x00` Path-C reveals** (`Gate ZP-Q27`) | | **Legacy `Ed25519` Exposure Tracking** | `v3` checked `Height >= 1`; `RC3` proposed `Step 0a` genesis-wide migration + `Step 0c` pre-content write | **`R4-RC3-C01` + `R4-02`:** `GenesisReceive` at `H=1` is unsigned (`0` PK!), while `RC3 Step 0a/0c` stalls `smt-v1` and splits `AccountBlock.ChangesHash`! | **`O(1)` `ResolveLegacyEd25519Exposure`**: `AccountStore[0x0a]` -> post-content `AuthRegistry[0x03]` (`< 15 KiB`) -> `ByHeight(1..2)`, failing closed if pruned (`Gate ZP-Q27`) | | **`go-zenon-v1` `MomentumVM` Supervisor** | Missed `momStore` snapshot timing, `ContractReceive` `targetMA` store, and hardcoded `Version: 1` | **`R4-03` (`momentum_vm.go:167`, `vm.go:671, 758, 813`):** Stale `momStore`, `H_ack` vs `H_inc` contract context, missing `DeletePtlcReclaimLock`, and `Version: 1` bricking contracts at `Spork #14`! | Documented Landmines `#8–#10`: reconstruct `postPromoStore`, pass `(InclusionHeight, InclusionMomentumStore)`, delete `ReclaimLock`, and emit `Version = 2` contract blocks post-`Spork #10` (`Gate G7, ZP-Q27`) | | **`WHIR-SHA3-v1` QROM & Cortex-A76 Latency** | `112b` query + `16b` grind (`64b` QROM!); `45,000` Keccak perms (`17.1 ms` on Cortex-A76 w/o `FEAT_SHA3`!) | **`R4-04`:** `CMS19` halves classical query/grinding bits in QROM; Pi 5 BCM2712 Cortex-A76 is `ARMv8.2` without `FEAT_SHA3` (`~380 ns`/perm) | Upgraded to **`256-bit` ext field + `32-bit` grind + `[56,32,23]`/`[112,64,45]` queries** (`57–86 KiB`, `<= 2^-128` QROM) and tightened `MaxSHA3KeccakPermutations` to **`8,000` (`<= 3.5 ms` Cortex-A76)** (`Gate G10, ZP-Q29`) | | **PQ Common Coin & `Mahi-Mahi` Waves** | `GF(2^256)` + `R_q` `Module-SIS RLC` (`1,280 B`, `RBC` `1,981 Mbps`) + `period = 1` overlapping waves (`5` coins/s!) | **`R4-05`:** `char 2` vs `mod 8,380,417` mismatch, `736 B/elem` `R_q` overflow, `1.98 Gbps` `RBC`, lattice dependency in `0x04` mode, and `5x` coin rate! | Replaced with **Pure-`SHA3-256` `HashRand-PQ`** (`M_coin = 256`, `c_i <= 13`, `2.03 MiB` matrix, `AVID-FP` `0.69–1.34 Mbps`, `0` lattices + `HQC-192`) + **`stride = 5` non-overlapping waves (`1.0 Hz` coin = `5.32–6.37 Mbps` TX)** (`Gate G4, ZP-Q28`) | | **Zalka `MAXDEPTH`, `smt-v1` & `[0x11]` Sidecar** | Wrote `2^88` parallel runs (`= 2^152` classical work!); unprefixed `smt-v1`; inline `[0x02]` witness | **`R4-06, R4-07, C03`:** Zalka is `M = 2^(24+2d), W = 2^(88+d)`; `64B` leaf vs internal collision; `14d` witness pruning broke `30d` `ChangesHash`! | Fixed Zalka math, added **`[0x00]/[0x01]` `smt-v1` tags** + `LP(x)` witness framing, and moved raw `ProofWitness` to Pebble **`[0x11]` sidecar** outside `MomentumChanges` (`Gate ZP-Q29`) | | **`ChannelContract (#15)`, `FN-DSA` & BTC Seal** | Invalid `...9n4k2p` Bech32; `ClaimHTLC` gated on `finalizeAtHeight`; `FinalizeClose` gated on `htlc_sum == 0` | **`R4-08, R4-09`:** Failed BIP-173 checksum; HTLC dispute lockout & dust hostage bug; `64B` vs `32B` `fn-dsa` seed; post-CRQC BTC `OP_RETURN` spoofing | Fixed to **`z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2`**, enabled **immediate in-`CLOSING` `ClaimHTLC`** + **`FinalizeBasePayouts`**, `32B` `fn-dsa v0.3` seed, and **`BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight`** (`Gate ZP-Q30`) | --- ## 4. Iteration 4 Diff Summary (`v2` `cee69c0` → `v3`, Round 3 `ZDC-QS-DEEZ-HR-001`) * **Native `0x02` Bech32 & `Go 1.27+` KAT (`N02, B01`):** Fixed `0x02` Bech32 prefix table to **`z1q{2,f,g,t}...`**, published live `ML-DSA-44` golden vector `z1qgyf208a5mven54xccm2fg93e7cu0l022alugr`, and added `AssertMLDSAReady()` startup check. * **`H_inc` Sunset, `179B` PoP, `pubKey_A`-Bound `PoKoS` & `SunsetAnchorCheckpoint` (`B02, B03, B05, B06, B11, B12, M06–M09`):** Enforced `Spork #14` at `InclusionMomentumHeight`, bound `32B` `pubKey_A` in `R_PoKoS`, halted `Bridge`/`Swap`/`PTLC` classical unlocks, aligned `0x1f -> uint64` `SporkMask`, and added `>= 85%` stake readiness signaling. --- ## 5. Complete Review Archive Navigation 1. **[Round 1 Ledger (`MM4-HR-001` `31` IDs + `ZDC-MM-ER-01` + `PQ-01–10`)](https://0x3639.com/zenon-phase-1/docs/reviews/round-1-mm4-hr-001)** 2. **[Round 2 Maintainer Response (`ZDC-ZP1-HR-001` `37/37` Disposition)](https://0x3639.com/zenon-phase-1/docs/reviews/round-2-zp1-hr-001-maintainer-response)** · **[Verbatim `ZDC-ZP1-HR-001` v1.0](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-zp1-hr-001-verbatim)** 3. **[Round 3 Independent Verification & Response (`ZDC-QS-DEEZ-HR-001` `26/26` Disposition)](https://0x3639.com/zenon-phase-1/docs/reviews/round-3-deez-pq-hr-001-maintainer-response)** · **[Verbatim `ZDC-QS-DEEZ-HR-001` v0.1](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-qs-deez-hr-001-verbatim)** 4. **[Round 4 Independent Cryptographic & Source Audit (`v4-Candidate-RC3` + `R4-01–R4-09` `14/14` Disposition)](https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit)** ================================================================================ CHAPTER 28 / 31: Round 1 Hostile Review Record: MM4-HR-001 (31 IDs), ZDC-MM-ER-01 & Cross-Stack PQ-01–10 FILE: docs/reviews/round-1-mm4-hr-001.md | URL: https://0x3639.com/zenon-phase-1/docs/reviews/round-1-mm4-hr-001 ================================================================================ # Round 1 Hostile Review Record: `ZDC-FRONTIER-MM4-HR-001`, `ZDC-MM-ER-01` & `PQ-01–10` > **Audit Provenance & Lifecycle Tracking (`ZDC-ZP1-HR-001 §5` Compliant):** > - **Round 1A (`ZDC-FRONTIER-MM4-HR-001` + `ZDC-MM-ER-01`):** Conducted by `TminusZ` + `Neon` (Rounds 1–3) against `Momentum-Mahi v4`, producing `31` findings (`C01–C12`, `H01–H17`, `M01–M02`) and `12` adapter invariants (`HR-01–12`). > - **Round 1B (`PQ-01 – PQ-10` Cross-Stack Audit):** Conducted when unifying `Momentum-Mahi v5`, `zenon-post-quantum`, and `Zeno-L2` into `ZNN-SPEC-PHASE1-v1`. > - **Round 2 Re-Verification Note:** Where Round 2 (`ZDC-ZP1-HR-001`) identified that a Round-1 resolution was only **partially closed** in `v1` (specifically `PQ-02`/`C07` share congruence & `AVSS` sizing, `PQ-05` `AuthRegistry` `H_inc+1` & PoP, `PQ-07` `SigLock` vs `PTLC` naming & `ChannelContract`, `PQ-08` contingent `BIP-360`, `PQ-09` Two-Lane Plasma, `H08` Pi 5 `1 TB` NVMe budget, and `H14` `99 B` checkpoint length), the table below links directly to the completed `v2` upgrade! --- ## 1. Round 1B: Cross-Stack Post-Quantum × Consensus × Proof-First Ledger (`PQ-01` – `PQ-10`) | ID | Severity | Original Cross-Stack Vulnerability | `ZNN-SPEC-PHASE1-v2` Normative Resolution | Gate(s) | Current State | |:---:|:---:|---|---|:---:|:---:| | **`PQ-01`** | **CRITICAL** | `ML-DSA-44` (`2,420 B`) on DAG vertices overflowed Sovereign Pi 5 `25 Mbps` TX cap. | `FN-DSA-512` (`666 B`) over direct `1-hop` validator mesh (`3.83–6.19 Mbps` at `5 Hz`) + dual-tree `2 Hz` `XMSS-SHAKE_22` (`5.57–6.51 Mbps`) fallback (`M01, M04`). | `G8, ZP-Q15` | `SPEC-RESOLVED` | | **`PQ-02`** | **CRITICAL** | Shor breaks `BLS12-381` coins; concatenated PQ multi-sigs allow `2^88` subset grinding; `v1` `32,768`-wave `AVSS` had `2.15 GB` RAM & whale proof bloat. | Upgraded in `v2` (`B01–B04, H05`) to **`M = 4,096` shares + pipelined `256`-wave (`32 MiB`) `GF(2^256)` coin-free `RBC` `AVSS` + `1,280 B` `RLC` Module-SIS opening**. | `G4, ZP-Q12, ZP-Q13` | `SPEC-RESOLVED` | | **`PQ-03`** | **CRITICAL** | `Zeno` `R1` `BN254` Groth16 wrapper is broken by Shor (`0` quantum bits). | Pure-`SHA3-256` **`WHIR-SHA3-v1`** (`<= 128 KiB` single proof in `256 KiB/s` lane, zero-alloc `256 KiB` arena, `<= 2.5 ms`, `0` `Poseidon2`/`BN254` `H02, H07, M10`). | `G10, ZP-Q20` | `SPEC-RESOLVED` | | **`PQ-04`** | **HIGH** | Raw L1 PQ signatures (`667–2,421 B`) inflated batch bandwidth. | `DA_BATCHED` `Zeno` domains compress `1,000+` PQ sigs into one `90 KiB` (`92,160 B`) STARK (`26.3x` compression `M02, H03`) + `14d` L1 witness compaction (`B08`). | `G10, ZP-Q18` | `SPEC-RESOLVED` | | **`PQ-05`** | **HIGH** | Intra-Momentum `RotateKey` raced Stage-2 parallel verify; sunset-only `PoKoS` exposed `H=0` keys. | Upgraded in `v2` (`B05, H06`) to strict **`InclusionMomentumHeight` (`H_inc + 1`)** promotion, two-slot `(active, pending)`, `115B` PoP, and Day-1 `PoKoS` (`1` reserved slot/s `H02`). | `G7, ZP-Q16, ZP-Q17` | `SPEC-RESOLVED` | | **`PQ-06`** | **HIGH** | `uint8` `SporkMask` overflow; `#13` contract & `Momentum v3` version collisions. | `uint64 SporkMask`; `Settlement = #13`, `AuthRegistry = #14`, `Channel = #15`; `Momentum v3` (`smt-v1`) → `v4` (`1.0 s` DAG). | `G1` | `SPEC-RESOLVED` | | **`PQ-07`** | **HIGH** | Sunsetting `secp256k1` `[k]G` PTLCs needed PQ edge channels & atomic routing. | Upgraded in `v2` (`B06, B07, B09, M07`) to **`ChannelContract (#15)`** 7-method state machine (`1,538 B` `fixed64`), `SHA-256` `HTLC` multi-hop, and recipient-bound PQ `SigLock`s `3..4`. | `ZP-Q21` | `SPEC-RESOLVED` | | **`PQ-08`** | **HIGH** | Trusted `ML-DSA` TSS multisigs re-introduced custodial risk; Taproot faces long-exposure Shor risk. | Reconciled in `v2` (`H11`): `SHA-256` `HTLC` swaps (`100%` PQ today) + pre-CRQC `BitVM2` (`1-of-N` `[E3]`) → **contingent** `BIP-360 P2MR + OP_CAT` covenants (`OrderedVaultRedemption` fallback). | `G1, G10` | `SPEC-RESOLVED` | | **`PQ-09`** | **MEDIUM** | `10 s` Dynamic Plasma constants mismatched `1.0 s` `Momentum v4` & `ProofWitness` size. | Upgraded in `v2` (`H01, H02`) to **Two-Lane `Momentum v4` admission** (`8.4M` BasePlasma + `256 KiB/s` `ProofWitness`, `<= 128 KiB`/proof, `PriceChangeDenominator = 200`). | `G9, ZP-Q17` | `SPEC-RESOLVED` | | **`PQ-10`** | **MEDIUM** | Sentinel `D1` batch summaries & `2D AVID` certs used classical `Ed25519`/`BLS`. | `ML-DSA-44`/`FN-DSA-512` `WorkerBatchProto` (`NATIVE_FULL` on L1 `H08`) + bonded `FN-DSA-512` `CustodyCertProto` with objective equivocation slashing (`M08`). | `G5` | `SPEC-RESOLVED` | --- ## 2. Round 1A: `ZDC-FRONTIER-MM4-HR-001` (`31` IDs) & `ZDC-MM-ER-01` (`HR-01–12`) ### Critical Findings (`C01` – `C12`) | ID | Summary | `ZNN-SPEC-PHASE1-v2` Resolution | Gate(s) | Current State | |:---:|---|---|:---:|:---:| | **`C01`** | Immature `r' >= r + 2` indirect anchor missed `r + 2` cert intersection. | Indirect anchor restricted strictly to `r' >= r + 3` (`ZP-Q11`-gated `Profile B`). | `G2, ZP-Q11` | `SPEC-RESOLVED` | | **`C02`** | `DirectSkip` evaluated vacuously `true` on empty candidate sets. | Requires `>= 2,731 / 4,096` explicit negative `r + 1` certificates (`Profile B`). | `G2, ZP-Q11` | `SPEC-RESOLVED` | | **`C03`** | Custom non-overlapping hybrid lacked async termination proof. | **`Mahi-Mahi` (`Profile C-AS`)** is mandatory shipping default; `Steelhead` (`Profile B`) gated on `ZP-Q11` (`H10`). | `G4, ZP-Q11` | `SPEC-RESOLVED` | | **`C04`** | `2 Delta` FastPath `Send` lost to earlier-sorting equivocator. | Baseline enforces **Order-Then-Execute (`F1`)**; `1-RTT` instant UX served by `ChannelContract (#15)`. | `G7, ZP-Q21` | `SPEC-RESOLVED` | | **`C05`** | Summary-only votes did not prove contextual validity. | Full contextual execution in `F1` + `batch_digest` binding `summaries_root`. | `G7` | `SPEC-RESOLVED` | | **`C06`** | Out-of-cut equivocation gossip split `AuthorBitmap`. | `AuthorBitmap` inspects strictly vertices & proofs **inside canonical `SubDAG`**. | `G7` | `SPEC-RESOLVED` | | **`C07`** | Skewed stake broke 1-share-per-Pillar coin thresholds (`v1` `M=2,048` off by 1). | Upgraded in `v2` (`B04`) to **`M_shares = 4,096`** (`Q_vote = 2,731`, `T_coin = 1,366`, `2*Q - M == T_coin`, `min w_i >= ceil(W/4096)`). | `G5` | `SPEC-RESOLVED` | | **`C08`** | Failed DKG lacked stake-exit freeze; `v1` epoch coin risked exhaustion. | `Joint-Epoch Freeze` locks unbonding exits + continuous `256`-wave coin-free `RBC` `AVSS` replenishment (`B03`). | `G6, ZP-Q13` | `SPEC-RESOLVED` | | **`C09`** | Stake-weighted DA receipts let 1 whale sign `< k` shards. | Decoupled `M_slots = 100` equal custody slots (`rank >= 67`, bonded & slashable `M08`). | `G5` | `SPEC-RESOLVED` | | **`C10`** | 1D Reed-Solomon allowed inconsistent codewords. | `2D AVID` row/column local re-encoding check prior to `FN-DSA-512` slot signature. | `G5` | `SPEC-RESOLVED` | | **`C11`** | Throwaway `2s` `Phase A` DPoS+QC lacked view-change safety proof. | `Phase A` deleted; Phase 1.0–1A keeps `10 s` `LegacyDposV1`, cutting cleanly to Phase 1B (`Momentum v4`). | `G1` | `SPEC-RESOLVED` | | **`C12`** | `BitVM2` checking only `MomentumQC` let corrupt Pillars drain BTC. | Vault verifies **both** `MomentumPQQC` **and** `d_btc` `WHIR-SHA3-v1` SPV proof (`H11` pre-CRQC / contingent `BIP-360` noted). | `G10` | `SPEC-RESOLVED` | ### High, Medium & Adapter Findings (`H01` – `H17`, `M01` – `M02`, `HR-01` – `HR-12`) | ID(s) | Summary | `ZNN-SPEC-PHASE1-v2` Resolution & Gate | Current State | |:---:|---|---|:---:| | **`H01–H04`** | Cross-epoch FastPath, Kahn equivalence, WAL/Pebble crash, `0`-indexed rounds. | `F1` baseline, disjoint-commuting `F1 == F0` (`M05`, `G7`), single `pebble.Batch(Sync: true)` before `AckPersisted` (`G6`), `0`-indexed rounds. | `SPEC-RESOLVED` | | **`H05`** | Unaudited custom crypto risk. | `Go 1.27+` stdlib `crypto/mldsa` + `crypto/mlkem` (`M12`), pinned `fn-dsa v0.3` (`[E2]`), pure-`SHA3` `WHIR-SHA3-v1` (`M10`, `G9, G10`). | `SPEC-RESOLVED` | | **`H06–H07`** | Unverified lazy pulls; fixed 4-Pillar home routing censorship. | `NATIVE_FULL` L1 batch possession (`H08`) + progressive routing (`Rank 1 -> 2..5 -> 10% D0` bypass). | `SPEC-RESOLVED` | | **`H08–H09`** | Datacenter Pillar creep & `177 Mbps` parent lists. | Sovereign Pi 5 floor (`<= 8.95 Mbps` direct mesh TX `M01`, `<= 450 GB` rolling NVMe `B08`, `34B` delta `MAP_REPLY` `H16`, `G3, G8, ZP-Q18`). | `SPEC-RESOLVED` | | **`H10–H12`** | Conflated TPS ceilings & unbounded uncommitted memory. | Reconciled `67–264` Pi 5 L1 txs/s (`H01`), `L1_NATIVE` vs `DA_BATCHED` (`H03`), `200k/13.6M/200M` STARK bounds (`H04`), `25/100 Mbps` 5-state shaper. | `SPEC-RESOLVED` | | **`H13–H14`** | BTC deep-reorg liability & truncated `44B` checkpoint. | Tiered `K_conf = 6/12/36` + auto-`PAUSE_RELAY`; exact **`99-byte` full-256-bit checkpoint** (`M11` fix) + `MomentumPQQC` check. | `SPEC-RESOLVED` | | **`H15–H17`** | `smt-v1` parity, `ZVM` `1s` timestamps, & qualification gates. | Frozen `smt-v1` + light-client chain (`H13`), monotonic post-partition `1s` coalescing (`H09`), `H_fork` rescaling, and `G1–G10 + ZP-Q11–Q22`. | `SPEC-RESOLVED` | | **`M01–M02, HR-01..12`** | Stream IDs, clock quarantine, and 3-horizon adapter laws. | `/znn/dag/{vertex,map,qc,avss,batch}/v2`, `FutureTimestampQuarantine`, and witness-excluded `unit_semantic_digest`. | `SPEC-RESOLVED` | ================================================================================ CHAPTER 29 / 31: Round 2 Maintainer Response: ZDC-ZP1-HR-001 Complete 37/37 Disposition Ledger (v1 → v2) FILE: docs/reviews/round-2-zp1-hr-001-maintainer-response.md | URL: https://0x3639.com/zenon-phase-1/docs/reviews/round-2-zp1-hr-001-maintainer-response ================================================================================ # Round 2 Maintainer Response: `ZDC-ZP1-HR-001` (`37 / 37` Disposition Ledger) > **Target Review:** [`ZDC-ZP1-HR-001_Consolidated_Hostile_Review_v1.0.md`](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-zp1-hr-001-verbatim) (`ChatGPT` + `Neon`, coordinated by `TminusZ`, 2026-12-04) > **Audited Snapshot:** `ZNN-SPEC-PHASE1-v1` (`4f8e3c7cae01bfe549f89a32b2a4dc82f690b628`, `llms-full.txt` SHA-256 `6723d2f167668e64c2f44791c773abcb8ff90ce490fc09bf2b146f2b200d9eee`) > **Resolution Target:** **`ZNN-SPEC-PHASE1-v2`** (`37 / 37` findings **`SPEC-RESOLVED`**, governed by the [6-State Closure Taxonomy](https://0x3639.com/zenon-phase-1/docs/roadmap/formal-verification-and-fuzzing) and gates `G1–G10` + `ZP-Q11–Q22`). --- ## 1. Consensus Blocking Findings (`10 / 10` `SPEC-RESOLVED` in `v2`) Formatted in the exact 7-column schema mandated by `ZDC-ZP1-HR-001 §9`: | Finding ID | Maintainer Disposition | Target Spec Version | Exact Normative Text Change | Code / Proof Artifact | Gate ID | Current State | |:---:|:---:|:---:|---|---|:---:|:---:| | **`B01`** | **ACCEPTED** | `v2` | Replaced `|D_agreed|` separate Merkle multiproofs (`~280 KiB` for a 10% whale) with an additively homomorphic Module-SIS vector commitment over the FIPS 204 ring `R_q` + **constant-size `1,280 B` Fiat-Shamir `RLC` opening** + `32 B * s_i` summed `GF(2^256)` shares (`2,592 B` avg at `s_i=41`; `14,400 B` = `14.06 KiB` for a 10% `410`-share whale, [System Model §3.3](https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto)). | `internal/crypto/avss_msis_rlc.go` + `Suite 12` | `G4, ZP-Q12` | `SPEC-RESOLVED` | | **`B02`** | **ACCEPTED** | `v2` | Replaced `32,768 × 2,048` monolithic epoch evaluation matrix (`2.15 GB` raw dealer state) with sub-epoch **`B_batch = 256` waves × `4,096` shares × `32 B` = `32.0 MiB` raw** per dealer, streamed row-by-row in `< 64 MB` peak RSS ([System Model §3.1](https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto)). | `internal/pillar/avss_dealer.go` | `G4, ZP-Q13` | `SPEC-RESOLVED` | | **`B03`** | **ACCEPTED** | `v2` | Eliminated circular coin-exhaustion deadlock via a rolling 2-bank pipeline (`Active b`, `Next b+1`) triggering `AVSS(b+2)` at wave `64` (`25%`) over **coin-free `SHA3-256` Reliable Broadcast (`RBC`)** on `/znn/dag/avss/v2` + deterministic `ML-KEM-768` ephemeral-seed complaint openings excluding bad dealers ([System Model §3.2](https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto)). | `internal/consensus/avss_rbc.go` + `Suite 12` | `G6, ZP-Q13` | `SPEC-RESOLVED` | | **`B04`** | **ACCEPTED** | `v2` | Upgraded `M_shares` from `2,048` (`mod 3 == 2`) to **`M_shares = 4,096 = 3 * 1,365 + 1`**: `F_Q = 1,365`, `Q_vote = 2,731`, `T_coin = 1,366`, restoring **`2 * Q_vote - M_shares = 1,366 == T_coin`**; enforced `min w_i >= ceil(W_total / 4,096)` (`0` zero-share seats) and proved raw-stake margin `(1365 - k + 1)/4096` ([System Model §1.1](https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto)). | `internal/common/committee.go` + `Suite 12` | `G5` | `SPEC-RESOLVED` | | **`B05`** | **ACCEPTED** | `v2` | Removed `revokeLegacy: bool`, defined two-slot `(activeRecord, pendingRecord)` rejecting overlapping rotations (`ErrAuthPendingRotationExists`), defined `115-byte` `zenon-auth-pop:v1` PoP preimage, and bound key promotion strictly to **`InclusionMomentumHeight` (`H_inc = H_confirm + 1`)**—never `MomentumAcknowledged` ([AuthRegistry §3.2–3.4](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation)). | `internal/vm/contracts/auth/` + `Suite 15` | `G7, ZP-Q16` | `SPEC-RESOLVED` | | **`B06`** | **ACCEPTED** | `v2` | Separated unbounded-asynchrony L1 consensus safety (`Mahi-Mahi`) from finite-timelock dispute protocols (`BitVM2` `T_btc >= 7d`, `ChannelContract` `T_dispute >= 24h`, `HTLC`s), stating the mandatory bounded-partition law **`Delta_party_or_watchtower < T_dispute / 2`** + third-party watchtower `ChallengeHigherNonce` ([BTC Bridge §4](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/trust-minimized-btc-bridge), [Edge Channels §2.1](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)). | `internal/vm/contracts/channel/` | `ZP-Q21` | `SPEC-RESOLVED` | | **`B07`** | **ACCEPTED** | `v2` | Renamed `PtlcContract` types `3` & `4` to **PQ Signature Locks (`SigLockMLDSA44`, `SigLockFNDSA512`)** (single-hop escrow, not algebraic scalar adaptors), bound redeem signatures to `60B` `zenon-siglock-redeem:v2` digest (`chainId \|\| lockId \|\| recipient`), and designated `SHA-256`/`SHA3-256` `HTLC`s as the normative multi-hop lock ([Edge Channels §2.2](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)). | `internal/vm/contracts/ptlc/` + `Suite 15` | `ZP-Q21` | `SPEC-RESOLVED` | | **`B08`** | **ACCEPTED** | `v2` | Bounded Sovereign Pi 5 `1 TB` NVMe to **`<= 450 GB` steady-state** via `14`-day intermediate `MomentumPQQC` compaction (`16.4 MB/yr` permanent `EpochTerminalQC`s vs `1.41 TB/yr`), `30`-day rolling native block retention, **`32B` `pubKeyHash`-only `HotStateCache` RAM pinning** (`<= 320 MB` @ `10M` accounts), and `1 ZNN / 10 QSR` refundable new-account reserve ([Scaling Math §2](https://0x3639.com/zenon-phase-1/docs/research/throughput-and-scaling-math)). | `internal/storage/pruner.go` + `HotStateCache` | `G8, ZP-Q18` | `SPEC-RESOLVED` | | **`B09`** | **ACCEPTED** | `v2` | Specified **`ChannelContract` (`Embedded Contract #15`)** with all 7 lifecycle methods (`OpenChannel`, `FundCounterparty`, `CooperativeClose`, `StartUnilateralClose`, `ChallengeHigherNonce`, `ClaimHTLC`/`TimeoutHTLC`, `FinalizeClose`), invariant `balA + balB + pending_htlc_sum == locked_total`, and `3,600s` anti-snipe `GraceExtension` ([Edge Channels §3](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)). | `internal/vm/contracts/channel/` + `Suite 15` | `ZP-Q21` | `SPEC-RESOLVED` | | **`H09`** | **ACCEPTED** | `v2` | Defined post-execution `MomentumPQQC` lifecycle: local deterministic commit -> crash-safe `qc_wal` height lock (`SlashQCEquivocation` on double-sign) -> `1 Hz` `QCVoteProto` on `/znn/dag/qc/v2` (`0.647 Mbps` framed TX) -> `>= 2,731`-share `seal_qc` assembly + post-partition monotonic `max(parent.Ts+1, median)` coalescing ([Projection §2, §3.2](https://0x3639.com/zenon-phase-1/docs/consensus/virtual-momentum-projection)). | `internal/pillar/qc_wal.go` + `Suite 13` | `G6, ZP-Q14` | `SPEC-RESOLVED` | --- ## 2. Consensus High Findings (`18 / 18` `SPEC-RESOLVED` in `v2`) | Finding ID | Maintainer Disposition | Target Spec Version | Exact Normative Text Change | Code / Proof Artifact | Gate ID | Current State | |:---:|:---:|:---:|---|---|:---:|:---:| | **`H01`** | **ACCEPTED** | `v2` | Reconciled Sovereign Pi 5 consensus L1 admission (**`67–132` PQ blocks/s at `1.0x`, `134–264` burst** under `MaxBasePlasma = 8,400,000`) across all chapters & home page, explicitly separating single-node `100k–250k` server verifier benchmarks ([Scaling Math §1](https://0x3639.com/zenon-phase-1/docs/research/throughput-and-scaling-math), [Dynamic Plasma §3](https://0x3639.com/zenon-phase-1/docs/post-quantum/dynamic-plasma-and-dos)). | `internal/pow/plasma.go` | `ZP-Q17` | `SPEC-RESOLVED` | | **`H02`** | **ACCEPTED** | `v2` | Introduced **Two-Lane `Momentum v4` admission**: `MaxBasePlasma = 8,400,000` + dedicated `256 KiB/s` `ProofWitness` lane, reduced `MaxSingleProofWitnessBytes` to **`131,072 B` (`128 KiB` = `2,372,749 < 8,400,000` plasma)**, and reserved `1` proof slot/s for non-empty `PoKoS` queue ([Dynamic Plasma §2–3](https://0x3639.com/zenon-phase-1/docs/post-quantum/dynamic-plasma-and-dos)). | `internal/pow/plasma.go` + `Suite 15` | `ZP-Q17` | `SPEC-RESOLVED` | | **`H03`** | **ACCEPTED** | `v2` | Explicitly separated **`L1_NATIVE`** forced/direct inbox inputs (`67–264/s`) from **`DA_BATCHED`** off-chain-sequenced rollup streams posting `12 B/tx` state diffs to Sentinel `2D AVID` DA (`30s` forced-inbox drain rule, [Zeno Domains §1](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/zeno-domains-wasm-and-zvm)). | `zeno-stf/core` + `Settlement #13` | `G10` | `SPEC-RESOLVED` | | **`H04`** | **ACCEPTED** | `v2` | Replaced `800M–8B+` Regime-3 headline with three qualified Sovereign Pi 5 bounds: **`200,000` ops/s** (L1 `256 KiB/s` proof lane), **`13,560,000` ops/s** (`100 Mbps` proof RX), and **`200,000,000` ops/s** (4-core `2 ms` CPU verifier ideal, [Scaling Math §1](https://0x3639.com/zenon-phase-1/docs/research/throughput-and-scaling-math)). | Documentation & capacity harness | `G10` | `SPEC-RESOLVED` | | **`H05`** | **ACCEPTED** | `v2` | Replaced blanket "`256b = 128b` quantum" shorthand with per-relation Grover (`2^128`), BHT collision (`~2^85`), NIST `MAXDEPTH = 2^64`, and QROM Fiat-Shamir bounds (`eps <= 2^-128`), and upgraded `AVSS` secret shares from `GF(2^128)` to **`GF(2^256)` (`128b` Grover)** ([Quantum Threat §2](https://0x3639.com/zenon-phase-1/docs/research/quantum-threat-and-industry-survey)). | `internal/crypto/avss_msis_rlc.go` | `G4, G10` | `SPEC-RESOLVED` | | **`H06`** | **ACCEPTED** | `v2` | Added explicit 3-row security boundary table distinguishing untouched `Height == 0` accounts (`100%` CRQC-safe via `PoKoS`) from unrotated `Height >= 1` exposed-key accounts (**vulnerable to early CRQC prior to `Spork #14`**, safe once rotated or after pre-CRQC `Spork #14` disables `0x00`, [PoKoS §2](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | Wallet UX warnings + `AuthRegistry #14` | `ZP-Q16` | `SPEC-RESOLVED` | | **`H07`** | **ACCEPTED** | `v2` | Locked `VerifyWHIRStarkV1` resource & DoS caps: `<= 131,072 B`, `<= 6` folding rounds, `<= 320` Merkle queries, `<= 45,000` Keccak permutations, `16-bit` grinding (`<= 2^-128` QROM error), and pre-allocated **`256 KiB` zero-heap-alloc worker arena (`<= 2.5 ms`)** ([Proof-First §3.2](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/proof-first-architecture)). | `internal/crypto/zkverify/whir_sha3_v1.go` | `G10, ZP-Q20` | `SPEC-RESOLVED` | | **`H08`** | **ACCEPTED** | `v2` | Mandated **`NATIVE_FULL` possession** (`0` `44.6 KiB` `CustodyCertProto` overhead) on normal L1 `WorkerBatchProto`s, restricting `CustodyCertProto` (`M_slots = 100`) strictly to `>= 1 MiB` `Zeno` DA blobs and `>= 4 MiB` `ManifestV1` cold segments ([Sentinels §1](https://0x3639.com/zenon-phase-1/docs/consensus/sentinel-workers-and-routing)). | `internal/protocol/possession.go` | `G5, G8` | `SPEC-RESOLVED` | | **`H10`** | **ACCEPTED** | `v2` | Promoted pure **`Mahi-Mahi` (`Profile C-AS`)** to the mandatory shipping default (`5 Hz`, `6.19 Mbps` TX) and gated `Steelhead` (`Profile B`) behind mechanized TLA+/Lean refinement gate **`ZP-Q11`** ([PQ Meta-DAG §1](https://0x3639.com/zenon-phase-1/docs/consensus/uncertified-meta-dag)). | `test/tla/steelhead_refinement.tla` | `ZP-Q11` | `SPEC-RESOLVED` | | **`H11`** | **ACCEPTED** | `v2` | Classified Lane B (`FROST` Taproot) and Lane C Phase-1 (`BitVM2` `BN254` + Taproot `[E3]`) as **Pre-CRQC Transitional**, marked `BIP-360` (`[E4]`) + `OP_CAT` covenants as **Contingent on Upstream Bitcoin Consensus Activation**, and added `OrderedVaultRedemptionMode` contingency ([BTC Bridge](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/trust-minimized-btc-bridge)). | `SettlementContract #13` + `runtime-btc` | `G10` | `SPEC-RESOLVED` | | **`H12`** | **ACCEPTED** | `v2` | Documented realistic pure-`SHA3` `WHIR-SHA3-v1` proving hardware & wall-clock latency (`6–18 s` on `32c` + RTX 4090/5090; `20–45 s` on `32–64c` CPU; `50–120 s` on `16c` desktop), widened `S3` escape to `T_2 = 300 s`, and added `RequestForcedExit` `proverBountyZNN` delegation ([Zeno Domains §2](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/zeno-domains-wasm-and-zvm)). | `zeno-executor` + `Settlement #13` | `ZP-Q20` | `SPEC-RESOLVED` | | **`H13`** | **ACCEPTED** | `v2` | Specified the complete 3-link trustless light-client verification chain (`Genesis -> EpochTerminalQC [16.4 MB/yr or 90 KiB epoch STARK] -> MomentumPQQC -> 1.2 KB smt-v1 proof`) via `ledger.getLightClientBundle` ([Proof-First §2](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/proof-first-architecture)). | `internal/rpc/lightclient.go` | `G1, G10` | `SPEC-RESOLVED` | | **`H14`** | **ACCEPTED** | `v2` | Removed `SHA3-256(EquiXProof24)` comment (`Nonce[8]` = strictly `EquiXSalt[8]`), specified the two-stage `Equi-X` (`[E5]`) `HashX` + `uint128(effortWord64) * EffectiveTarget <= 2^64-1` predicate over context-bound seed `C`, and added `+len(EquiXSolution)` (`+272` plasma) to `TotalWitnessBytes` ([AccountBlocks §1](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching), [Dynamic Plasma §2](https://0x3639.com/zenon-phase-1/docs/post-quantum/dynamic-plasma-and-dos)). | `internal/pow/equix.go` | `G9, ZP-Q19` | `SPEC-RESOLVED` | | **`H15`** | **ACCEPTED** | `v2` | Defined exact `H_fork` (`Spork #11`) migration law: future height-locked expirations rewrite atomically to `H_fork + 10 * (oldTarget - H_fork)`, `Epoch(H)` transitions piecewise cleanly, and `W_ack` (`3,600` virtual `1s` ticks) weights pre-fork heights by `10x` across `H_fork` ([Projection §2](https://0x3639.com/zenon-phase-1/docs/consensus/virtual-momentum-projection)). | `internal/vm/spork11_migrate.go` + `Suite 13` | `G7` | `SPEC-RESOLVED` | | **`H16`** | **ACCEPTED** | `v2` | Mandated ascending `authority_index` parent sorting (`order_mode = 0`) for honest validators and replaced `3.4 KiB` full `MAP_REPLY` pulls with cached per-round **`34 B/entry` equivocation-only delta `GET_MAP`/`MAP_REPLY`** (`<= 0.13 Mbps` for `33` equivocators at `5 Hz`, [PQ Meta-DAG §2](https://0x3639.com/zenon-phase-1/docs/consensus/uncertified-meta-dag)). | `internal/p2p/dag_map.go` | `G3` | `SPEC-RESOLVED` | | **`M01`** | **ACCEPTED** | `v2` | Replaced GossipSub vertex fanout (`47.55 Mbps`) with **direct `1-hop` validator unicast (`0` forwarding)** across `N - 1 = 99` streams at **`5 Hz` default (`3.825 Mbps` base / `6.19 Mbps` w/ coin)** and `10 Hz` high-tempo (`7.65 Mbps` base, [DAG Comparison §2](https://0x3639.com/zenon-phase-1/docs/research/dag-bft-comparison), [Sentinels §2](https://0x3639.com/zenon-phase-1/docs/consensus/sentinel-workers-and-routing)). | `internal/p2p/validator_mesh.go` | `G8, ZP-Q15` | `SPEC-RESOLVED` | | **`M04`** | **ACCEPTED** | `v2` | Upgraded emergency validator key to **dual-tree `XMSS-SHAKE_22_256` (`2^22` leaves each: `xmss_dag_root` & `xmss_qc_root`, `2,884 B` sig)**, enforced `fdatasync` WAL index lock before signing, and stepped emergency cadence to **`2 Hz` (`5.57 Mbps` base / `6.51 Mbps` w/ coin framed TX, `24.2 days` capacity)** ([System Model §4](https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto)). | `internal/crypto/xmss22_wal.go` | `G6, ZP-Q15` | `SPEC-RESOLVED` | | **`M10`** | **ACCEPTED** | `v2` | Eliminated `Poseidon2` from L1 verification completely: **`WHIR-SHA3-v1`** uses **exclusively `FIPS 202 SHA3-256` Merkle trees and `SHA3-256`/`SHAKE256` Fiat-Shamir sponges** at every layer (`0` algebraic hash assumptions, [PQ Signatures & STARKs §3](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks), [Proof-First §3.1](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/proof-first-architecture)). | `internal/crypto/zkverify/whir_sha3_v1.go` | `G10, ZP-Q20` | `SPEC-RESOLVED` | --- ## 3. Consensus Medium Findings (`9 / 9` `SPEC-RESOLVED` in `v2`) | Finding ID | Maintainer Disposition | Target Spec Version | Exact Normative Text Change | Code / Proof Artifact | Gate ID | Current State | |:---:|:---:|:---:|---|---|:---:|:---:| | **`M02`** | **ACCEPTED** | `v2` | Standardized strictly on binary `KiB` (`90 KiB = 92,160 B = 0.737 Mbps` per proof; `128 KiB = 131,072 B` single cap; `256 KiB = 262,144 B` per-Momentum cap; `26.3x` compression over `2,420,000 B`, [PQ Signatures & STARKs §3](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks)). | `internal/pow/plasma.go` | `G1` | `SPEC-RESOLVED` | | **`M03`** | **ACCEPTED** | `v2` | Corrected `67 × 35 µs / 4` `FN-DSA-512` QC verification arithmetic from `0.35 ms` to **`0.59 ms` ideal 4-core (`0.9–1.4 ms` realistic Go worker pool)** across all chapters ([Projection §3.2](https://0x3639.com/zenon-phase-1/docs/consensus/virtual-momentum-projection)). | Benchmark suite | `G8` | `SPEC-RESOLVED` | | **`M05`** | **ACCEPTED** | `v2` | Defined exact `F0` (`AccountHeader.Bytes()` min-heap sequential execution) vs `F1` (**disjoint 256-stripe user `AccountStore` execution + canonical `Seq_F0` patch fold + single-threaded Embedded Contract `#1..#15` execution**), proving `F1 == F0` by disjoint key-prefix commutativity ([Projection §3.1](https://0x3639.com/zenon-phase-1/docs/consensus/virtual-momentum-projection)). | `internal/chain/executor_f1.go` + `Suite 13` | `G7` | `SPEC-RESOLVED` | | **`M06`** | **ACCEPTED** | `v2` | Decomposed Edge Channel per-pair throughput into **`20–100` sequential stop-and-wait updates/s** (`10–50 ms` WAN RTT) vs **`1,280–6,400` pipelined (`W = 64`) updates/s** vs `~13,800/s` single-core CPU verify ([Edge Channels §1](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)). | `syrius` / `libznn` channel engine | `ZP-Q21` | `SPEC-RESOLVED` | | **`M07`** | **ACCEPTED** | `v2` | Replaced `~1,420 B` / `~1,480 B` estimates with `fixed64` tags yielding a **constant `1,538-byte` `ZenonCommitStateProto` wire vector** across all `sequence_nonce in [0..2^64-1]`, including mandatory `sequence_nonce = 0` pre-signed dual-funding refund initialization ([Edge Channels §3–4](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)). | `proto/znn/edge/v2/channel.proto` | `G1, ZP-Q21` | `SPEC-RESOLVED` | | **`M08`** | **ACCEPTED** | `v2` | Specified Sentinel operator bond (`5,000 ZNN + 50,000 QSR`), dual compensation (epoch `ManifestV1` participation rewards + `70%` of `znnPerMiBDaBlob` `Zeno` DA fees), and **`50%` objective bond slashing (`SlashCustodyEquivocation`)** + `< 80%` liveness slot rotation ([Sentinels §3](https://0x3639.com/zenon-phase-1/docs/consensus/sentinel-workers-and-routing)). | `internal/vm/contracts/sentinel/` | `G5` | `SPEC-RESOLVED` | | **`M09`** | **ACCEPTED** | `v2` | Explicitly retired transitional hybrid **`algID == 0x81` (`AlgHybridEdMLDSA44`)** alongside `0x00` in Phase 1E (`Spork #14`), adding `AuthRegistry.UpgradeHybridToPureMLDSA44` so zero `0x81` accounts can ever be stranded ([PoKoS §4](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | `internal/vm/contracts/auth/` | `ZP-Q16` | `SPEC-RESOLVED` | | **`M11`** | **ACCEPTED** | `v2` | Corrected Bitcoin checkpoint preimage byte length from `95 B` to exact **`99 bytes`** (`11 + 8 + 8 + 8 + 32 + 32 = 99 B`, [BTC Bridge §Flow 3](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/trust-minimized-btc-bridge)). | `zeno-stf/runtime-btc` | `G1` | `SPEC-RESOLVED` | | **`M12`** | **ACCEPTED** | `v2` | Updated toolchain floor from `Go 1.26` to **`Go 1.27+` (`crypto/mldsa`, `golang/go#77626` `[E1]`)** and pinned `FN-DSA-512` to **`draft-FIPS-206` (`fn-dsa v0.3` `[E2]`) KAT vectors** with versioned `algID` upgrade hooks ([Blueprint §2](https://0x3639.com/zenon-phase-1/docs/roadmap/go-zenon-v1-master-blueprint)). | `go.mod` (`go 1.27`) + KAT suite | `G1, G9` | `SPEC-RESOLVED` | --- ## 4. Reproducible `ZNN-SPEC-PHASE1-v2` Arithmetic Verification Script Every quantitative replacement in `ZNN-SPEC-PHASE1-v2` is machine-verified by the zero-dependency Python 3 script below: ```python #!/usr/bin/env python3 """Reproducible arithmetic & wire-budget verification for ZNN-SPEC-PHASE1-v2.""" # 1. B04: Congruence-exact M_shares = 4,096 quorums M = 4096 assert M % 3 == 1 and (M & (M - 1)) == 0 F_Q = (M - 1) // 3 # 1365 Q_vote = M - F_Q # 2731 T_coin = F_Q + 1 # 1366 assert 2 * Q_vote - M == 1366 == T_coin # 2. B01, B02, H05: Pipelined GF(2^256) AVSS memory & RLC reveal sizes B_batch = 256 dealer_raw_mib = (B_batch * M * 32) / (1024 ** 2) assert dealer_raw_mib == 32.0 avg_coin_reveal_b = 41 * 32 + 1280 # 2,592 B (2.53 KiB) whale10_coin_reveal_b = 410 * 32 + 1280 # 14,400 B (14.06 KiB) assert avg_coin_reveal_b == 2592 and whale10_coin_reveal_b == 14400 # 3. M01, M04, H09: Direct 1-hop validator mesh & 1 Hz MomentumPQQC TX (N=100, 1.15x framing) peers, frame = 99, 1.15 dag_5hz_base_mbps = peers * 5 * 840 * 8 * frame / 1e6 # 3.825 Mbps dag_5hz_coin_mbps = peers * (5 / 5) * avg_coin_reveal_b * 8 * frame / 1e6 # 2.361 Mbps qc_1hz_mbps = peers * 1 * 710 * 8 * frame / 1e6 # 0.647 Mbps xmss22_sig_b = 4 + 32 + 67 * 32 + 22 * 32 # 2,884 B (SP 800-208 h=22) xmss22_vertex_b = 840 - 666 + xmss22_sig_b # 3,058 B xmss_2hz_mbps = peers * 2 * xmss22_vertex_b * 8 * frame / 1e6 # 5.570 Mbps assert round(dag_5hz_base_mbps + dag_5hz_coin_mbps, 2) == 6.19 assert round(dag_5hz_base_mbps + dag_5hz_coin_mbps + qc_1hz_mbps, 2) == 6.83 assert xmss22_sig_b == 2884 and round(xmss_2hz_mbps, 2) == 5.57 # 4. M03: Honest 4-core FN-DSA-512 QC verification time qc_verify_4c_ms = (67 * 35e-3) / 4 assert round(qc_verify_4c_ms, 2) == 0.59 # 5. H01, H02, M02: Two-Lane Dynamic Plasma & <= 128 KiB single ProofWitness max_base_plasma = 8_400_000 proof_90kib = 90 * 1024 # 92,160 B proof_128kib = 128 * 1024 # 131,072 B plasma_90kib = 50_400 + (2421 + proof_90kib - 96) * 17 + 2100 + 52_500 # 1,711,245 plasma_128kib = 50_400 + (2421 + proof_128kib - 96) * 17 + 2100 + 52_500 # 2,372,749 assert plasma_90kib == 1_711_245 and plasma_128kib == 2_372_749 assert 2 * plasma_90kib < max_base_plasma and plasma_128kib < max_base_plasma # 6. B08: 14-day intermediate QC compaction vs 1.41 TB/yr unpruned epoch_qcs_per_yr_mb = 365 * 44_800 / 1e6 # 16.35 MB/yr assert round(epoch_qcs_per_yr_mb, 1) == 16.4 # 7. M07, M11: Exact 1,538B ZenonCommitStateProto & 99B Bitcoin checkpoint chan_wire_b = 34 + 9 + 12 + 34 + 34 + 34 + 34 + 9 + 669 + 669 ckpt_b = 11 + 8 + 8 + 8 + 32 + 32 assert chan_wire_b == 1538 and ckpt_b == 99 print("ALL ZNN-SPEC-PHASE1-v2 INVARIANTS VERIFIED OK!") ``` ================================================================================ CHAPTER 30 / 31: Round 3 Independent Verification & Response: ZDC-QS-DEEZ-HR-001 (26/26 Findings + Source Audit) FILE: docs/reviews/round-3-deez-pq-hr-001-maintainer-response.md | URL: https://0x3639.com/zenon-phase-1/docs/reviews/round-3-deez-pq-hr-001-maintainer-response ================================================================================ # Round 3 Independent Verification & Response: `ZDC-QS-DEEZ-HR-001` (`26 / 26` Findings) > **Target Review:** [`ZDC-QS-DEEZ-HR-001` (`DeeZ_Post_Quantum_Hostile_Review_v0.1_tminusz.md`)](https://0x3639.com/zenon-phase-1/docs/reviews/archive-zdc-qs-deez-hr-001-verbatim) (`TminusZ research program`, 2026-12-04) > **Audited Snapshot Note:** `ZDC-QS-DEEZ-HR-001` audited **`edgepillar/zenon-post-quantum@e5930af`** (a fork of the retired 9-page standalone PQ draft *before* unification into `zenon-phase-1` and *before* `ZNN-SPEC-PHASE1-v2`) alongside `0x3639/go-zenon-v1@124b4ced` and `zenon-network/go-zenon@e8986a63`. > **Verification Methodology:** Rather than blindly accepting reviewer claims, **every single one of the `26` findings (`B01–B12`, `M01–M12`, `N01–N02`) was independently checked against local `go-zenon-v1`, `go-zenon`, `znn_sdk_dart`, `go1.27.4` stdlib (`crypto/mldsa`), and executable Python/Go math**, yielding: > - **`12` Accepted Residual Fixes + `3` Self-Caught Source Fixes** integrated into **`ZNN-SPEC-PHASE1-v3`**; > - **`4` Accepted-With-Technical-Correction Dispositions** (where the valid kernel was adopted while correcting reviewer overstatements on `MAXDEPTH` Grover, `go-zenon` `KeyFile`s, `IsUserAddress`, and `400 KB` Anza proofs); > - **`10` Stale-Target Dispositions** already resolved in `ZNN-SPEC-PHASE1-v2` (`cee69c0`). --- ## 1. Three Self-Caught Bugs Uncovered While Independently Checking `ZDC-QS-DEEZ-HR-001` Checking the actual codebases and compiler APIs rather than taking the review at face value uncovered three subtle issues that neither Round 2 nor Round 3 explicitly named: 1. **`Go 1.27.4` `crypto/mldsa` Exact Constructor Signatures & `GOFIPS140=v1.0.0` Runtime Trap (`B01` Deep Check):** Running `go doc -all crypto/mldsa` on `go1.27.4` revealed (a) the exact stdlib constructors are `mldsa.NewPrivateKey(mldsa.MLDSA44(), seed32)`, `mldsa.NewPublicKey(mldsa.MLDSA44(), rawPub)`, `sk.SignDeterministic(msg, &mldsa.Options{Context: ctx})`, and `mldsa.Verify(pk, msg, sig, &mldsa.Options{Context: ctx})` (replacing `v2`'s `NewPublicKey44` shorthand), and (b) **Go 1.27 disables `crypto/mldsa` at runtime if `GOFIPS140=v1.0.0` is active**—fixed in `v3` via `AssertMLDSAReady()` (`621b16f8...` deterministic startup KAT in [Go 1.27+ Blueprint §2](https://0x3639.com/zenon-phase-1/docs/roadmap/go-zenon-v1-master-blueprint)). 2. **Live `secp256k1` Mint/Claim Surfaces in `BridgeContract.Redeem` & `SwapContract.RetrieveAssets` (`B12` Deep Check):** Grepping `go-zenon-v1/internal/vm/contracts/` revealed that `BridgeContract.Redeem` (`methods_admin.go:530`, minting bridged ZTS under a `secp256k1` ECDSA TSS key) and `SwapContract.RetrieveAssets` (`swap.go`, claiming 2021 genesis swaps under `secp256k1`) would allow unbounded post-CRQC token minting/draining if left active—explicitly halted at `Spork #14` in [PoKoS & Sunset §4](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue). 3. **`90B` vs. `115B` PoP Header Comment Mismatch (`M06` Deep Check):** In `v2`, `popPreimage` summed to `115 B` at the bottom comment while its top label read `90 bytes`—replaced in `v3` with the exact **`179-byte` `zenon-auth-pop:v3` preimage** binding `GenesisMomentumHash[32]` and `prevActivePubKeyHash[32]`. --- ## 2. Blocking Findings (`B01` – `B12`): Independent Verification & `v3` Disposition | Finding ID | Independent Verification & Technical Verdict | Target Version | Exact Normative `ZNN-SPEC-PHASE1-v3` Change | Gate ID | Current State | |:---:|---|:---:|---|:---:|:---:| | **`DEEZ-B01`** | **ACCEPTED + SELF-CAUGHT API/FIPS FIX:** `v2` already updated `Go 1.26 -> Go 1.27+`, and our `go1.27.4` check caught `mldsa.NewPublicKey(mldsa.MLDSA44(), ...)` + `GOFIPS140=v1.0.0` disablement. | `v3` | Replaced wrapper code with live-compiled `go1.27.4` `crypto/mldsa` functions + `AssertMLDSAReady()` startup KAT (`621b16f8...`, [Blueprint §2](https://0x3639.com/zenon-phase-1/docs/roadmap/go-zenon-v1-master-blueprint)). | `G1, G9` | `SPEC-RESOLVED` | | **`DEEZ-B02`** | **ACCEPTED (Verified in `momentum.go:415`):** `go-zenon-v1` evaluates spork masks at `blk.MomentumAcknowledged.Height`, creating a `1-hour` (`W_ack`) post-sunset `Ed25519` bypass if `Spork #14` used `H_ack`. | `v3` | Enforced `SporkBitLegacyCryptoSunset` (`Spork #14`) and `ActiveKey` strictly at **`InclusionMomentumHeight` (`H_inc`)** during live admission while preserving era-accurate historical replay for `H_inc < H_sunset` ([AccountBlocks §2](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching)). | `ZP-Q23` | `SPEC-RESOLVED` | | **`DEEZ-B03`** | **ACCEPTED:** Dual-ledger `RotateKey` `Send -> Receive` needed explicit `expectedRotationNonce` ABI parameter, stale-receive no-op rule, and `producer()` (`account_block.go:1075`) cached-PK branch. | `v3` | Added `expectedRotationNonce` to `RotateKey`, deterministic `ErrAuthStaleGeneration` rejection on competing `Send`s, Phase 1A vs 1B window note, and 3-path `producer()` rule ([AuthRegistry §3](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation), [AccountBlocks §3.3](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching)). | `G7, ZP-Q16` | `SPEC-RESOLVED` | | **`DEEZ-B04`** | **ALREADY RESOLVED IN `v2` (Stale Target):** `revokeLegacy: bool` only existed in retired `zenon-post-quantum`. | `v2` | `revokeLegacy` deleted in `v2`; `UpgradeHybridToPureMLDSA44` handles `0x81 -> 0x01` cleanly ([AuthRegistry §3.1](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation)). | `ZP-Q16` | `SPEC-RESOLVED` | | **`DEEZ-B05`** | **ACCEPTED WITH TECHNICAL CORRECTION:** Reviewer cites `~2^76` ideal Grover on `152b` addresses while omitting Zalka's `MAXDEPTH = 2^64` penalty (`2^152/2^64 = 2^88` parallel runs, `> 2^103` gates `[E6]`). Multi-target Grover & cold-vault pre-binding kernel is valid. | `v3` | Documented both ideal (`2^76` single / `2^((152-u)/2)` multi-target) and `MAXDEPTH = 2^64` (`> 2^103` gates) bounds, and added feeless **`AuthRegistry.PrecommitKey`** (`256-bit` pre-spend binding for `Height == 0` vaults, [AuthRegistry §2–3](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation)). | `ZP-Q16` | `SPEC-RESOLVED` | | **`DEEZ-B06`** | **ACCEPTED (High-Value Crypto Catch):** Checking only `19B` `targetAddress` in `R_PoKoS` left `Height >= 1` accounts at `2^76` ideal seed-collision search despite `32B` `pubKey_A` already being public on-chain! | `v3` | Persisted `AccountStore[0x0a] = legacyEd25519PK[32]` and bound **all `32 B` of `pubKey_A`** as a mandatory public input in `R_PoKoS` when `Height >= 1` (**`~2^126` ideal Grover**); documented `Height == 0` honestly at `152b` ([PoKoS §1–3](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | `ZP-Q24` | `SPEC-RESOLVED` | | **`DEEZ-B07`** | **ACCEPTED WITH TECHNICAL CORRECTION:** `16 KiB` `Data` cap was already replaced by `<= 128 KiB` `ProofWitness` in `v2`, and Python multiproof sizing shows compressed `WHIR-SHA3-v1` is `41–60 KiB` (Anza's `400 KB` prototype omitted outer recursion). Qualification target caveat accepted. | `v3` | Added analytical `41–60 KiB` multiproof derivation vs Anza prototype and labeled `~45k` rows / `~0.75 s` prove as **projected targets** gated on `ZP-Q20` ([PQ Sigs & STARKs §2](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks)). | `G10, ZP-Q20` | `SPEC-RESOLVED` | | **`DEEZ-B08`** | **ALREADY RESOLVED IN `v2` (+ Zero-Balance Note):** Sponsor `0x02` submission + `popPreimage` binding already existed in `v2`. | `v3` | Added explicit note that post-rescue `0`-balance `0x00` accounts claim pending `UserReceive`s feelessly via `Equi-X` PoW ([PoKoS §3](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | `ZP-Q24` | `SPEC-RESOLVED` | | **`DEEZ-B09`** | **ALREADY RESOLVED IN `v2` (Stale Target):** 3-cohort exposure table (`Height == 0` vs `Height >= 1`) was added in `v2` (`H06`). | `v2/v3` | Preserved and cross-linked with `B03` in-flight window ([PoKoS §2](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | `ZP-Q16` | `SPEC-RESOLVED` | | **`DEEZ-B10`** | **ALREADY RESOLVED IN `v2` (Stale Target):** `21/30` count example was only in standalone `zenon-post-quantum`; `v2` uses `M_shares = 4,096` (`Q_vote = 2,731`). | `v2` | Congruence-exact `M = 4,096` stake-quantized quorums ([System Model §1](https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto)). | `G5` | `SPEC-RESOLVED` | | **`DEEZ-B11`** | **ACCEPTED:** Post-CRQC attackers could forge 2021–Phase 1A `Ed25519` Pillar histories for genesis-syncing nodes without a pre-CRQC hash anchor. | `v3` | Added **`SunsetAnchorCheckpoint`** at `Spork #14` pinned in `params.go` and sealed in Bitcoin `SHA-256d` `99B` checkpoints, freezing 100% of classical history via `SHA3-256` ([Quantum Threat §2](https://0x3639.com/zenon-phase-1/docs/research/quantum-threat-and-industry-survey), [Proof-First §2](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/proof-first-architecture)). | `ZP-Q25` | `SPEC-RESOLVED` | | **`DEEZ-B12`** | **ACCEPTED + SELF-CAUGHT `Bridge` & `Swap` AUDIT:** Source grep found `BridgeContract.Redeem` (`secp256k1` ECDSA mint) and `SwapContract.RetrieveAssets` (`secp256k1`) alongside `PtlcContract` `{0..2}` escrows. | `v3` | Specified complete 6-part Phase 1E sunset halting `Bridge` ECDSA, `Swap`, `Pillar.RegisterLegacy`, plus two-step `PtlcContract` `{0..2}` drain preserving post-expiry `Reclaim` ([PoKoS & Sunset §4](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | `ZP-Q26` | `SPEC-RESOLVED` | --- ## 3. Major & Editorial Findings (`M01` – `M12`, `N01` – `N02`): Independent Verification & `v3` Disposition | Finding ID | Independent Verification & Technical Verdict | Target Version | Exact Normative `ZNN-SPEC-PHASE1-v3` Change | Gate ID | Current State | |:---:|---|:---:|---|:---:|:---:| | **`DEEZ-M01`** | **ACCEPTED (Verified in `account_block.go:85`):** `PreverifiedBlock` currently snapshots inline `32B` `PublicKey` and must bind resolved state context when `len(PublicKey) == 0`. | `v3` | Defined 8-tuple `PreverifyAuthTuple` (`GenesisHash`, `ChainId`, `BlockHash`, `ResolvedAlgID`, `ResolvedPubKeyHash`, `RotationNonce`, `SunsetActive`, `WitnessDigest`, [AccountBlocks §3.2](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching)). | `G7` | `SPEC-RESOLVED` | | **`DEEZ-M02`** | **ACCEPTED (Pre-Verify Bounds; Pruning Safe Behind `B11`):** `17` plasma/B is a policy weight; malformed witnesses need Stage-1 pre-alloc rejection. | `v3` | Added Stage-1 per-`algID` exact length checks + `InvalidWitnessPenalty` peer scoring prior to crypto verify ([AccountBlocks §3.1](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching)). | `G8` | `SPEC-RESOLVED` | | **`DEEZ-M03`** | **ALREADY RESOLVED IN `v2` (Stale Target):** `v2` replaced `4 QCs/s` / `8c` prose with `1 Hz` `MomentumPQQC` (`0.65 Mbps`) and `0.59 ms` ideal / `0.9–1.4 ms` realistic 4c Pi 5 verify. | `v2` | Retained `v2` `1 Hz` `/znn/dag/qc/v2` model ([Projection §3.2](https://0x3639.com/zenon-phase-1/docs/consensus/virtual-momentum-projection)). | `G8, ZP-Q14` | `SPEC-RESOLVED` | | **`DEEZ-M04`** | **ALREADY RESOLVED IN `v2` (`M12`):** Marked `FN-DSA-512` (`0x02`) as provisional `draft-FIPS-206` (`fn-dsa v0.3` KATs) with immutable `algID` versioning (`0x05` on post-launch change). | `v2/v3` | Reinforced provisional label in [PQ Sigs & STARKs §1](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks). | `G9` | `SPEC-RESOLVED` | | **`DEEZ-M05`** | **ACCEPTED WITH TECHNICAL CORRECTION:** Direct read of `go-zenon/wallet/keystore.go:29` proves `KeyFile`s decrypt to standard `BIP-39` entropy, and `R_PoKoS` operates on any `32B` `RFC 8032` seed (`12/24`-word, passphrased, `KeyFile`, or raw seed). Computational PRF & fresh-seed points accepted. | `v3` | Generalized wallet prose to all `RFC 8032` `32B` seeds, noted computational `HMAC-SHA512` PRF isolation, and mandated an **independent fresh `256-bit` seed option** on rotation ([AuthRegistry §4](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation)). | `ZP-Q24` | `SPEC-RESOLVED` | | **`DEEZ-M06`** | **ACCEPTED (+ Self-Caught `90B/115B` Label Fix):** Bound `GenesisMomentumHash[32]` and `prevActivePubKeyHash[32]` inside `popPreimage`. | `v3` | Upgraded to exact **`179-byte` `zenon-auth-pop:v3` preimage** (`17+8+32+1+20+20+8+8+32+1+32 = 179 B`, [AuthRegistry §3.2](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation)). | `G1, ZP-Q16` | `SPEC-RESOLVED` | | **`DEEZ-M07`** | **ACCEPTED (Verified in `plasma.go:48-55`):** `go-zenon-v1` uses 5-bit `0x1f` (`SporkBitDynamicPlasma = 1 << 3`), and `WitnessPlasma` monotonicity holds per fixed `(algID, hasProofWitness)` for `W >= 96`. | `v3` | Aligned `0x1f -> uint64` `SporkMask` bit table verbatim with `plasma.go:48` and scoped Lean law `per_suite_witness_plasma_monotonicity` ([Dynamic Plasma §1–2](https://0x3639.com/zenon-phase-1/docs/post-quantum/dynamic-plasma-and-dos)). | `ZP-Q17` | `SPEC-RESOLVED` | | **`DEEZ-M08`** | **ACCEPTED:** Separated `crypto/tls` `X25519MLKEM768` confidentiality from custom `libp2p` PQ host-key auth (`KeyType_MLDSA44`). | `v3` | Specified `/znn/tls-pq/1.0.0` binding TLS 1.3 exporter to `ML-DSA-44` host keys, `libp2p-noise` sunset at `Spork #14`, and `0` consensus trust in `peer.ID` ([Sentinels §2](https://0x3639.com/zenon-phase-1/docs/consensus/sentinel-workers-and-routing)). | `G9` | `SPEC-RESOLVED` | | **`DEEZ-M09`** | **ACCEPTED (Verified in `params.go:274`):** `SporkEnforcementDelay = 6` (`60s`) is insufficient for consensus hard forks. | `v3` | Classified `Sporks #9..#14` as hard forks requiring **`>= 85%` active-stake `MaxProtocolVersion` readiness signaling** across `2` epochs + `24h` enforcement delay ([Master Roadmap §2](https://0x3639.com/zenon-phase-1/docs/roadmap/master-five-stage-roadmap)). | `ZP-Q23` | `SPEC-RESOLVED` | | **`DEEZ-M10`** | **ALREADY RESOLVED IN `v2` (+ `256b` `HTLC` CSPRNG Rule):** `SHA3-256` `2^128` preimage vs `~2^85.3` BHT bounds were added in `v2` (`H05`). | `v3` | Added mandatory `256-bit` CSPRNG secret rule for `HTLC` preimages `r` ([Edge Channels §2.2](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)). | `ZP-Q21` | `SPEC-RESOLVED` | | **`DEEZ-M11`** | **ACCEPTED:** Unmeasured `PoKoS` / Pi 5 latency targets must not be stated as completed benchmarks. | `v3` | Explicitly labeled as **projected engineering targets** gated on physical `G8` and `ZP-Q20` runs ([PQ Sigs & STARKs §2](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks)). | `G8, ZP-Q20` | `SPEC-RESOLVED` | | **`DEEZ-M12`** | **ACCEPTED WITH TECHNICAL CORRECTION:** `#13/#14` numbering was already fixed in `v1/v2`, and grepping `go-zenon-v1`, `go-zenon`, and `znn_sdk_dart` proved `0` VM paths call `IsUserAddress` (`0x00`). Explicit class allowlist adopted. | `v3` | Enforced fail-closed `{0x00, 0x02}` user sender class allowlist (rejecting `0x03..0xff`) and clarified `Version = 2` hash domain separation ([AuthRegistry §1](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation)). | `G1` | `SPEC-RESOLVED` | | **`DEEZ-N01`** | **ACCEPTED:** `1313/3734 = 35.16%` and `898/1565 = 57.38%` are witness reductions (`32.50%` and `48.00%` of full `306B`-header block). | `v3` | Reported both witness `%` and full-block `%` side-by-side and distinguished `First v2 Reveal` from `Height = 1` ([PQ Sigs & STARKs §1](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks)). | `G1` | `SPEC-RESOLVED` | | **`DEEZ-N02`** | **ACCEPTED (Verified in Python & `go1.27.4`):** `0x02` encodes in Bech32 as **`z1q{2,f,g,t}...`**, NOT `z1z/z1y`. | `v3` | Updated prefix table to `z1q{2,f,g,t}...` and published live-compiled `go1.27.4` `ML-DSA-44` golden vector `z1qgyf208a5mven54xccm2fg93e7cu0l022alugr` ([AuthRegistry §1–2](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation)). | `G1` | `SPEC-RESOLVED` | --- ## 4. Reproducible `ZNN-SPEC-PHASE1-v3` Verification Script (`zp1_v3_checks.py`) ```python #!/usr/bin/env python3 """Reproducible verification of ZNN-SPEC-PHASE1-v3 (Round-3 DEEZ-HR-001 additions).""" import hashlib CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" def convertbits(data, frombits=8, tobits=5, pad=True): acc, bits, ret, maxv = 0, 0, [], (1 << tobits) - 1 for v in data: acc = (acc << frombits) | v bits += frombits while bits >= tobits: bits -= tobits ret.append((acc >> bits) & maxv) if pad and bits: ret.append((acc << (tobits - bits)) & maxv) return ret # 1. DEEZ-N02: Exact Bech32 prefix sets for class bytes 0x00, 0x01, 0x02 prefs_00 = sorted({"".join(CHARSET[w] for w in convertbits([0x00, b]+[0]*18)[:2]) for b in range(256)}) prefs_01 = sorted({"".join(CHARSET[w] for w in convertbits([0x01, b]+[0]*18)[:2]) for b in range(256)}) prefs_02 = sorted({"".join(CHARSET[w] for w in convertbits([0x02, b]+[0]*18)[:2]) for b in range(256)}) assert prefs_00 == ["qp", "qq", "qr", "qz"] assert prefs_01 == ["q8", "q9", "qx", "qy"] assert prefs_02 == ["q2", "qf", "qg", "qt"] assert set(prefs_00).isdisjoint(prefs_01) and set(prefs_02).isdisjoint(prefs_00 + prefs_01) # 2. DEEZ-N02: Verify golden Go 1.27.4 ML-DSA-44 0x02 address encoding addr_hex = bytes.fromhex("0208953cfda6d999d2a6c636a4a0b1cfb1c7fdea") words = convertbits(addr_hex) assert "".join(CHARSET[w] for w in words[:4]) == "qgyf" # 3. DEEZ-M06: Exact 179-byte zenon-auth-pop:v3 preimage length pop_len = 17 + 8 + 32 + 1 + 20 + 20 + 8 + 8 + 32 + 1 + 32 assert pop_len == 179 # 4. DEEZ-N01: Witness vs total-block PK caching percentages assert round(1313 / 3734 * 100, 2) == 35.16 and round(1313 / (306 + 3734) * 100, 2) == 32.50 assert round(898 / 1565 * 100, 2) == 57.38 and round(898 / (306 + 1565) * 100, 2) == 48.00 # 5. DEEZ-B05: Zalka MAXDEPTH=2^64 parallel Grover bound on 152-bit address assert 152 - 64 == 88 # 2^88 parallel depth-2^64 quantum runs (>2^103 gates) print("ALL ZNN-SPEC-PHASE1-v3 ROUND-3 INVARIANTS VERIFIED OK!") ``` ================================================================================ CHAPTER 31 / 31: Round 4 Independent Cryptographic & Source Audit: v4-Candidate-RC3 Evaluation + R4-01–R4-09 (14/14 Findings) FILE: docs/reviews/round-4-rc3-and-crypto-audit.md | URL: https://0x3639.com/zenon-phase-1/docs/reviews/round-4-rc3-and-crypto-audit ================================================================================ # Round 4 Independent Cryptographic & Source Audit: `v4-Candidate-RC3` Evaluation + `R4-01` – `R4-09` (`14 / 14` Findings) > **Target Candidate & Scope:** Independent adversarial cryptographic, numerical, and source-code review of **`ZNN-SPEC-PHASE1-v4-Candidate-RC3`** (`TminusZ` + `Neon` review patches `C01–C05`, `RC2`, `RC3`) **and** the full underlying `ZNN-SPEC-PHASE1-v3` corpus against [`0x3639/go-zenon-v1`](https://github.com/0x3639/go-zenon-v1), [`0x3639/zenon-rs`](https://github.com/0x3639/zenon-rs), live `go1.27` `crypto/mldsa`, and executable Python/Go verification scripts. > **Summary Outcome (`14` Tracked IDs -> `118` Total Findings Across Rounds 1–4):** > - **Part I (`R4-RC3-C01..C05` — Independent Audit of `v4-Candidate-RC3`'s 5 Claims):** Accepted `3` valid kernels (`C03` length-prefixed framing, `C05` `-race` memory split + `ErrAuthNonceOverflow`, and `C01` non-`AccountBlock` exposure insight) while **rejecting `3` consensus-breaking RC3 patches** (`RC3 Step 0a` genesis-wide migration stall, `RC3 Step 0c` pre-content `AccountStore(producer)` `ChangesHash` split, `C02` cross-stripe `UserSend` read, and `C04` `256 KiB` single-block / `4 MiB` batch cap). > - **Part II (`R4-01..R4-09` — Nine Independent Cryptographic & `go-zenon-v1` Supervisor Defects Discovered & Closed in `v4`):** Resolved separable `0x81 <-> 0x00` hybrid stripping & ransomware (`R4-01`), `O(1)` legacy exposure resolution (`R4-02`), three `MomentumVM` supervisor landmines (`R4-03`), `WHIR-SHA3-v1` `CMS19` QROM soundness & Cortex-A76 Keccak timing (`R4-04`), broken `char 2` / `mod q` `Module-SIS RLC` coin + `5x` wave bandwidth (`R4-05`), Zalka `MAXDEPTH` algebra (`R4-06`), `smt-v1` `[0x00]`/`[0x01]` domain separation + `[0x11]` witness sidecar (`R4-07`), `ChannelContract (#15)` invalid Bech32 + HTLC lockout/hostage bugs (`R4-08`), and `FN-DSA-512` `32B` seed + `MaxPreCRQCBitcoinHeight` (`R4-09`). --- ## 1. Part I: Independent Verification of `ZNN-SPEC-PHASE1-v4-Candidate-RC3` (`R4-RC3-C01` – `C05`) Rather than accepting `v4-Candidate-RC3`'s `C01–C05`, `RC2`, and `RC3` conclusions at face value, every claim and proposed patch was audited against `go-zenon-v1/internal/vm/` and `internal/nom/`: | ID | `v4-Candidate-RC3` Claim & Proposed Patch | Independent Source & Crypto Verdict | Normative `ZNN-SPEC-PHASE1-v4` Resolution | Gate | State | |:---:|---|---|---|:---:|:---:| | **`R4-RC3-C01`** | **`C01` + `RC2` + `RC3` (`legacyEd25519PK` Backfill):** Claimed `Height >= 1` missed genesis/unrevealed accounts and Momentum/PTLC reveals; proposed `Step 0a` genesis-wide `AccountStore[0x0a]` migration in `1` block + `Step 0c` pre-content `AccountStore(producer)` write. | **DIAGNOSIS PARTIALLY VALID; RC3 PATCH REJECTED (CONSENSUS-BREAKING):** (1) `Step 0a` mutates every historical `AccountStore` in one `10 s` Momentum (`smt-v1` OOM/stall). (2) `Step 0c` mutates `AccountStore(producer)` *before* `m.Content`, altering `AccountBlock.ChangesHash` (`momentum_vm.go:190-198`) whenever a Pillar includes its own tx! (3) In `go-zenon-v1`, only `GenesisReceive` at `H == 1` is unsigned (`UserReceive` is signed!). | Replaced both `v3`'s `Height >= 1` bug and `RC3`'s `Step 0a/0c` with the **`O(1)` Legacy Exposure Resolver (`R4-02`)**: `ByHeight(1..2)` check + post-content `AuthRegistry[0x03]` index (`< 250` non-AB reveals = `< 15 KiB`, `0` `AccountStore` `ChangesHash` drift, fail-closed `ErrAuthUnknownExposure`). | `ZP-Q27` | `SPEC-RESOLVED` | | **`R4-RC3-C02`** | **`C02` (`RotateKey` `UserSend` Nonce Check):** Proposed reading `AuthRegistry` inside `UserSend` (`methods_auth.go`) to reject stale rotations early; also added `ErrAuthNonceOverflow` (`math.MaxUint64`). | **`UserSend` READ REJECTED (BREAKS `F1` PARALLELISM); OVERFLOW GUARD ACCEPTED:** In `go-zenon-v1/internal/vm/block_processor.go:258`, `UserSend` executes against `s.accountStore` ONLY (reading `AuthRegistry` violates `Stage 3a` 256-stripe isolation!), and `rollbackEmbedded` (`vm.go:797`) already turns any failed `ContractReceive` into a deterministic `0`-patch no-op (`M05` in `go-zenon-v1-pq-implementation-spec.md` already proved this!). | Kept `expectedRotationNonce` check strictly in `ContractReceive` (preserving `Stage 3a` stripe isolation) and adopted the `rotationNonce == math.MaxUint64 -> ErrAuthNonceOverflow` guard ([Impl Spec §6](https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec)). | `G7, ZP-Q27` | `SPEC-RESOLVED` | | **`R4-RC3-C03`** | **`C03` (`WitnessDigest` Length Framing):** Noted unframed `PublicKey \|\| Signature \|\| ProofWitness` allows boundary shift across variable-length fields (`0x10` STARK proofs). | **ACCEPTED (VALID CRYPTO CATCH):** While fixed-size `(algID, hasProof)` pairs had fixed boundaries, explicit `LP(x) = be_u32(len(x)) \|\| x` framing makes `WitnessCommitment` injective across all current and future variable-length witnesses. | Adopted `LP(PublicKey) \|\| LP(Signature) \|\| LP(EquiX) \|\| LP(ProofWitness)` inside `WitnessCommitment` and `PreverifyAuthTuple` ([AccountBlocks §1.2, §3.2](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching)). | `G1, ZP-Q29` | `SPEC-RESOLVED` | | **`R4-RC3-C04`** | **`C04` (`256 KiB` Single-Block / `4 MiB` Batch Protobuf Cap):** Proposed capping `AccountBlockProto <= 256 KiB` and `AccountBlockBatch <= 4 MiB`. | **REJECTED (BREAKS `MaxDescendantDepth = 10,000` & `10 MiB` SYNC):** In `go-zenon-v1/internal/nom/account_block.go:47` & `p2p/types.go:17`, a single `ContractReceive` carries recursive `DescendantBlocks` up to depth `10,000` (`> 256 KiB`), `TxMsg` is a multi-block slice, and `MaxMessageSize = 10 MiB`! | Enforced per-node **`nonDescendantSelfBytes <= 180 KiB`** (`16 KiB Data + 128 KiB ProofWitness + PQ witness`) while preserving **`10 MiB` (`10,485,760 B`)** total message/tree budget ([Impl Spec §4.3](https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec)). | `G8` | `SPEC-RESOLVED` | | **`R4-RC3-C05`** | **`C05` (`go test -race` `5x–10x` Overhead vs `<= 6.5 GB` RSS Gate):** Noted `-race` shadow memory inflates RSS `5x–10x`, conflicting with testing `<= 6.5 GB` RSS in the same run. | **ACCEPTED (VALID ENGINEERING CATCH):** Standard Go ThreadSanitizer overhead must be separated from uninstrumented production memory measurement. | Split CI into Run A (`go test -race` functional concurrency check) and Run B (uninstrumented release binary `<= 6.5 GB` RSS / latency check, [Impl Spec §10](https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec)). | `G8` | `SPEC-RESOLVED` | --- ## 2. Part II: Nine Independent Cryptographic & Source Defects Resolved in `v4` (`R4-01` – `R4-09`) Questioning every assumption across the entire specification uncovered **nine concrete cryptographic, consensus, and `go-zenon-v1` supervisor bugs** missed by Rounds 1–3 and `v4-Candidate-RC3`: | Finding ID | Subsystem | Defect Uncovered by Independent Audit | Normative `ZNN-SPEC-PHASE1-v4` Fix | Gate | State | |:---:|---|---|---|:---:|:---:| | **`R4-01`** | **Hybrid `0x81` Auth & Path-C First Spend** | **Separable `0x81 <-> 0x00` Signature Stripping & Quantum Ransomware:** Because `0x81` signed raw `msg` identically to `0x00`/`0x01`, any relayer could strip `[0x81] \|\| edSig \|\| mlSig` (`2,485 B`) down to `[0x00] \|\| edSig` (`65 B`) without invalidating `Block.Hash`! Worse, allowing `0x81` on Path-C first reveals let a CRQC attacker lock an unrotated `0x00` victim's `AccountStore[0x09]` to an attacker-owned `ML-DSA-44` key! | Every `AccountBlock v2`, `Momentum v3`, and `AuthPopV3` signs **`BoundSigningDigest = SHA3-256(domainCtx \|\| [0x00] \|\| [algID] \|\| SHA3-256(resolvedPubKeyWire)[32] \|\| msg[32])`** (live `go1.27` KAT `f79b6f58...` / `b7444ca3...`), **and `0x81` is forbidden on unregistered `0x00` Path-C reveals** ([PQ Sigs §1.2](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks), [AccountBlocks §2](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching)). | `G1, ZP-Q27` | `SPEC-RESOLVED` | | **`R4-02`** | **`Ed25519-PoKoS` Exposure Tracking** | **Unsigned `GenesisReceive` (`H == 1`) vs Non-AB Reveals:** `v3`'s `Height >= 1` check falsely treated unsigned `GenesisReceive` (`BlockType = 1`, `len(PublicKey) == 0` at `H == 1`) as exposed while missing `H == 0` Pillar/PTLC `Ed25519` reveals. | Specified **`ResolveLegacyEd25519Exposure` (`O(1)`)**: checks `AccountStore[0x0a]` -> `AuthRegistry[0x03 \|\| addr]` (`< 250` Momentum/PTLC reveals, updated *after* `m.Content`) -> `ByHeight(1)` / `ByHeight(2)`, failing closed (`ErrAuthUnknownExposure`) if pruned; pruner retains `H in {1, 2}` (`<= 200 MB`, [PoKoS §2.1](https://0x3639.com/zenon-phase-1/docs/post-quantum/ed25519-pokos-seed-rescue)). | `ZP-Q24, ZP-Q27` | `SPEC-RESOLVED` | | **`R4-03`** | **`go-zenon-v1` `MomentumVM` Supervisor** | **Three Live Source-Code Landmines (`#8, #9, #10`):** (8) `momentum_vm.go:167` snapshots `momStore` *before* Step-0 `AuthRegistry` promotion; (9) `vm.go:671-687` binds `ContractReceive` `MomentumStore()` to `targetMA` (`H_ack`) rather than `H_inc` and omits `DeletePtlcReclaimLock` on post-sunset `Reclaim`; (10) `vm.go:758, 813` hardcodes `Version: 1` on generated `ContractReceive`/`ContractSend` blocks, bricking all contracts at `Spork #14`! | Documented exact patches in [Impl Spec §1.1 & §5–7](https://0x3639.com/zenon-phase-1/docs/post-quantum/go-zenon-v1-pq-implementation-spec) and [Projection §3.1](https://0x3639.com/zenon-phase-1/docs/consensus/virtual-momentum-projection): reconstruct `postPromoStore`, pass `(InclusionHeight, InclusionMomentumStore)` into `GenerateEmbeddedReceive`, call `DeletePtlcReclaimLock`, and emit `Version = 2` contract blocks once `Spork #10` is active. | `G7, ZP-Q27` | `SPEC-RESOLVED` | | **`R4-04`** | **`WHIR-SHA3-v1` QROM & Pi 5 Timing** | **`CMS19` QROM `2x` Halving & Cortex-A76 `FEAT_SHA3` Absence:** `v3`'s `112b` query + `16b` grind (`128b` classical) yields only `~64` QROM bits under `CMS19`, and `45,000` Keccak permutations take **`~17.1 ms`** (`6.8x` over `2.5 ms`!) on Raspberry Pi 5 Cortex-A76 (`ARMv8.2` without `FEAT_SHA3`, `~380 ns`/perm)! | Upgraded `WHIR-SHA3-v1` to **`256-bit` extension field + `32-bit` PoW grinding + `[56, 32, 23]` (`56.7 KiB`) / `[112, 64, 45]` (`86.2 KiB`) queries** (`256b` classical -> **`128b` QROM**) and tightened `MaxSHA3KeccakPermutations` to **`8,000` (`<= 3.5 ms` worst-case on Cortex-A76)** ([PQ Sigs §2](https://0x3639.com/zenon-phase-1/docs/research/pq-signatures-and-pure-hash-starks), [Proof-First §3](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/proof-first-architecture)). | `G10, ZP-Q29` | `SPEC-RESOLVED` | | **`R4-05`** | **PQ Common Coin & `Mahi-Mahi` Waves** | **Broken `char 2` / `mod q` `Module-SIS RLC` Coin + `5x` Wave Rate:** (1) `GF(2^256)` (`char 2`) Shamir shares and `R_q` (`mod 8,380,417`) commitments have incompatible characteristics; (2) `1,280 B` overflows `R_q` (`736 B`/elem); (3) `RBC` over `100 × 32 MiB` matrices = **`1,981 Mbps`**; (4) `Module-SIS` breaks `0x04` zero-lattice mode; (5) `period = 1` overlapping waves emit `5` coins/s (`15.63 Mbps`), not `1` in `5`! | Replaced `Module-SIS RLC` with **Pure-`SHA3-256` `HashRand-PQ`** (`M_coin = 256 = 3*85+1`, `c_i <= 13`, `2.03 MiB` matrix, `4`-row `2^-512` QROM degree check, column-major `AVID-FP` `0.69–1.34 Mbps` dealing, salt-free `1,638–2,785 B` reveal, `0` lattice assumptions + optional `HQC-192` KEM) and locked **`stride = 5` non-overlapping waves (`1.0 Hz` coin = `5.32–6.37 Mbps` TX)** ([System Model §1–4](https://0x3639.com/zenon-phase-1/docs/consensus/system-model-and-pq-crypto), [Meta-DAG §1–2](https://0x3639.com/zenon-phase-1/docs/consensus/uncertified-meta-dag)). | `G4, ZP-Q28` | `SPEC-RESOLVED` | | **`R4-06`** | **Quantum Threat Math (`MAXDEPTH`)** | **Zalka Parallel Grover Formula Error:** `v3` wrote `2^152 / 2^64 = 2^88` *parallel depth-`2^64` runs* (which equals `2^152` classical work!). Under Zalka `[E6]`, `K = 2^(64-d)` iterations cover `K^2` states, so `M = 2^152 / K^2 = 2^(24 + 2d)` processors and `W = M * K = 2^(88 + d)` total calls. | Corrected Zalka formula across [Quantum Threat §1](https://0x3639.com/zenon-phase-1/docs/research/quantum-threat-and-industry-survey) and [Addresses §2.2](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation) (`M = 2^48` processors & `W = 2^100` calls at `d = 12`; `M = 2^24`, `W = 2^88` at `d = 0`). | `G1` | `SPEC-RESOLVED` | | **`R4-07`** | **`smt-v1` & `AccountBlock v2` Storage** | **`smt-v1` Leaf/Internal Collision & `14d` Witness Pruning vs `ChangesHash`:** Hashing `path[32] \|\| value[32]` (`64 B`) without node-type prefix collides in length with `left[32] \|\| right[32]` (`64 B`); storing raw `ProofWitness` inside `[0x02]` breaks `30d` `Momentum.ChangesHash` replay when `ProofWitness` compacts at `14d`! | Added RFC-6962 **`[0x00]` leaf / `[0x01]` internal** domain tags + `32B` sibling bitmap to `smt-v1`, and moved raw `ProofWitness` to Pebble sidecar **`[0x11] \|\| blockHash[32]`** outside `MomentumChanges` while keeping `32B` `WitnessCommitment` in `[0x02]` ([Proof-First §2](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/proof-first-architecture), [AccountBlocks §4](https://0x3639.com/zenon-phase-1/docs/post-quantum/account-blocks-and-pk-caching)). | `ZP-Q29` | `SPEC-RESOLVED` | | **`R4-08`** | **`ChannelContract (#15)`** | **Invalid Bech32 Checksum + HTLC Dispute Lockout & Hostage Freeze:** `z1qxemdeddedxchannelxxxxxxxxxxxxxx9n4k2p` failed BIP-173 polymod; blocking `ClaimHTLC` until `H_inc >= finalizeAtHeight` let an attacker steal in-flight HTLCs via `expiryTs < finalizeAtHeight`; requiring `remaining_htlc_sum == 0` in `FinalizeClose` froze `balance_a, balance_b`! | Fixed address to verified **`z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2`**, enabled **immediate in-`CLOSING` `ClaimHTLC(channelId, preimage32)`** (`RevealedPreimage` survives `ChallengeHigherNonce`), and split **`FinalizeBasePayouts`** from **`SettleHTLC`** ([Edge Channels §3](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/unbounded-edge-channels)). | `ZP-Q21, ZP-Q30` | `SPEC-RESOLVED` | | **`R4-09`** | **`FN-DSA-512` Signer & BTC Sunset Seal** | **`fn-dsa v0.3` `32B` Seed + Signer Gap & Post-CRQC BTC `OP_RETURN` Spoofing:** `fn-dsa v0.3` `KeyPairGenerator::keygen` takes a `32B` seed (not `64B`), `fndsa512_v03_ntt.go` omitted keygen/signing for `CGO_ENABLED=0` Pillars, and post-CRQC stolen BTC `secp256k1` keys could post fake `99B` `OP_RETURN`s at new BTC heights! | Specified `32-byte` `SHA3-256("zenon-fndsa512-keygen:v1" \|\| key)` seed + full pure-Go `fndsa512_v03.go` keygen/sign/verify (`0x05` reserved for final fixed-point FIPS 206), and enforced **`BitcoinAnchorHeight <= MaxPreCRQCBitcoinHeight`** on `SunsetAnchorCheckpoint` ([Addresses §4](https://0x3639.com/zenon-phase-1/docs/post-quantum/addresses-and-key-derivation), [BTC Bridge](https://0x3639.com/zenon-phase-1/docs/proof-first-and-btc/trust-minimized-btc-bridge)). | `G9, ZP-Q25, ZP-Q30` | `SPEC-RESOLVED` | --- ## 3. Reproducible `ZNN-SPEC-PHASE1-v4` Verification Script (`zp1_v4_checks.py`) ```python #!/usr/bin/env python3 """Reproducible verification of ZNN-SPEC-PHASE1-v4 (Round-4 Cryptographic & Source Audit).""" import hashlib import math import struct CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" def bech32_polymod(values): gen = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3] chk = 1 for v in values: b = chk >> 25 chk = ((chk & 0x1ffffff) << 5) ^ v for i in range(5): chk ^= gen[i] if ((b >> i) & 1) else 0 return chk def bech32_hrp_expand(hrp): return [ord(x) >> 5 for x in hrp] + [0] + [ord(x) & 31 for x in hrp] def bech32_decode(bech): pos = bech.rfind("1") hrp, data = bech[:pos], [CHARSET.find(x) for x in bech[pos + 1:]] if -1 in data or bech32_polymod(bech32_hrp_expand(hrp) + data) != 1: return None, None acc, bits, out = 0, 0, [] for v in data[:-6]: acc = (acc << 5) | v bits += 5 while bits >= 8: bits -= 8 out.append((acc >> bits) & 0xff) return hrp, bytes(out) # 1. R4-01: BoundSigningDigest KAT (matches live go1.27 crypto/mldsa KAT!) msg32 = hashlib.sha3_256(b"zenon-v4-bound-ab-kat").digest() assert msg32.hex() == "1591190820438da9c24ee0023a212da0fdd2a4c0e9fc917d57ecaf5dc148db50" pub_wire_hash = bytes.fromhex("fb485d059edaaf43b19b3ae0fcfd0d22109098bf2f3ee796288a077370a4ee04") bound_preimage = b"zenon-ab:v2" + bytes([0x00, 0x01]) + pub_wire_hash + msg32 assert len(bound_preimage) == 77 bound_digest = hashlib.sha3_256(bound_preimage).digest() assert bound_digest.hex() == "f79b6f58918590a542c285d49fec08cde4ca1abc4d47ccb77b78b078569e542f" assert hashlib.sha3_256(b"zenon-ab:v2" + bytes([0x00, 0x81]) + pub_wire_hash + msg32).digest() != bound_digest # 2. R4-04: WHIR-SHA3-v1 CMS19 QROM Soundness (256 classical bits -> 128 QROM bits) & Cortex-A76 Timing grind_bits = 32 rhos = [2**-4, 2**-7, 2**-10] q_cap, q_john = [56, 32, 23], [112, 64, 45] for r, qc, qj in zip(rhos, q_cap, q_john): assert (-qc * math.log2(r) + grind_bits) / 2.0 >= 128.0 assert (-qj * math.log2(math.sqrt(r)) + grind_bits) / 2.0 >= 128.0 assert sum(q_cap) == 111 and sum(q_john) == 221 <= 256 assert 8_000 * 380e-6 <= 3.5 # 3. R4-05: Pure-SHA3-256 HashRand-PQ Coin (M_coin = 256) & stride = 5 Bandwidth M_shares, F_Q, Q_vote = 4096, 1365, 2731 assert 3 * F_Q + 1 == M_shares and 2 * Q_vote - M_shares == 1366 M_coin, F_coin, Q_coin, T_coin = 256, 85, 171, 86 assert 3 * F_coin + 1 == M_coin and 2 * Q_coin - M_coin == T_coin assert abs((260 * M_coin * 32) / (1024**2) - 2.03125) < 1e-6 assert (4 * 256) // 2 == 512 base_5hz_tx = 99 * 5 * 840 * 8 * 1.15 / 1e6 coin_1hz_low = 99 * 1.0 * (20 * 2.56 * 32) * 8 * 1.15 / 1e6 coin_1hz_high = 99 * 1.0 * (34 * 2.56 * 32 + 11) * 8 * 1.15 / 1e6 assert 5.30 <= base_5hz_tx + coin_1hz_low <= 5.35 assert 6.35 <= base_5hz_tx + coin_1hz_high <= 6.38 assert 99 * 1.0 * (34 * 13 * 32) * 8 * 1.15 / 1e6 < 13.0 # 4. R4-06: Zalka MAXDEPTH = 2^64 Parallel Grover Law (M = 2^152 / K^2, W = M * K) for d in [0, 12]: k_bits = 64 - d assert 152 - 2 * k_bits == 24 + 2 * d assert 152 - k_bits == 88 + d # 5. R4-07: Domain-Separated smt-v1 ([0x00] leaf vs [0x01] internal) & LP Framing assert hashlib.sha3_256(b"\x00" + b"\xaa" * 32 + b"\xbb" * 32).digest() != hashlib.sha3_256(b"\x01" + b"\xaa" * 32 + b"\xbb" * 32).digest() assert struct.pack(">I", 3) + b"abc" + struct.pack(">I", 2) + b"de" != struct.pack(">I", 2) + b"ab" + struct.pack(">I", 3) + b"cde" # 6. R4-08: ChannelContract (#15) Valid BIP-173 Bech32 Checksum vs Invalid v3 String assert bech32_decode("z1qxemdeddedxchannelxxxxxxxxxxxxxx9n4k2p")[0] is None ok_hrp, raw20 = bech32_decode("z1qxemdeddedxchannelxxxxxxxxxxxxxxr7xsx2") assert ok_hrp == "z" and raw20.hex() == "01b3b6e5adcb4d8bf673cfcc6318c6318c6318c6" print("ALL ZNN-SPEC-PHASE1-v4 ROUND-4 VERIFICATION CHECKS PASSED!") ```