Skip to main content

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!)

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:
    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:

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)!