arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
davinci-paper/v3-pq/spec.md
v3-pq/spec.mdRaw
   1# DAVINCI v3-PQ — Post-Quantum Protocol Specification
   2
   3**Status:** draft v1.3 · 2026-10-23 · **unified Blake3 profile** + the **weak-point
   4improvement round**: per-warden column views (§8.7), ceremony v2 with sender authentication
   5and margin rosters (§10.3–10.4), early complaints with voter recovery (§9.2), salt-bound
   6nullifiers (§5.3), and a corrected transport roadmap (ML-KEM-768 only; multi-recipient Kyber
   7tracked; Classic McEliece withdrawn). v2 remains the deployed protocol. Reviewed: three
   8adversarial soundness rounds + two improvement design rounds (protocol reviewer) +
   9audience-representative sign-off + one external design review + one adversarial synthesis
  10review + two literature surveys; a final consolidated review gates implementation (Phase 0
  11of the migration plan).
  12**Audience:** engineers who already know [DAVINCI v2](https://spec.davinci.vote). This document only
  13specifies what *changes*. Everything not mentioned here (settlement flow, grace window, blob
  14verification via the point-evaluation precompile, census origins, sequencer lifecycle, process
  15registry mechanics) works exactly as in v2 [DAV2].
  16
  17---
  18
  19## 1. Why v3, in one paragraph
  20
  21Every ballot DAVINCI v2 publishes in Ethereum blobs [EIP4844] is an ElGamal ciphertext over
  22BabyJubjub. Published blob data can be archived by anyone indefinitely, and ElGamal falls to
  23Shor's algorithm — so a future quantum computer decrypts **past elections retroactively**
  24("harvest now, decrypt later"). Integrity is less urgent (a settled chain cannot be rewritten
  25under Ethereum's finality assumptions), but **ballot privacy must be post-quantum today**.
  26v3-PQ removes the quantum-vulnerable primitives from the ballot *confidentiality* path: no
  27shared-key homomorphic encryption, no pairings, no DKG, no Groth16. Ballot secrecy rests on
  28polynomial secret sharing, hashes, STARKs, and one NIST-standardized KEM (a post-quantum
  29"public-key lockbox" — all such terms are defined plainly in §2.4). The KEM is never
  30proven inside the voter's circuit (the batch guest performs encapsulations, and rare complaint
  31proofs perform decapsulations; see §8.5, §9.2). During the hybrid period voter authentication
  32still *also* uses ECDSA (§11), and the settlement wrapper and KZG blob commitments remain
  33inherited non-PQ dependencies (§12.5).
  34
  35### Changes at a glance
  36
  37| Component | v2 | v3-PQ |
  38|---|---|---|
  39| Ballot confidentiality | ElGamal over BabyJubjub (threshold key) | Shamir shares + PRF masks over KEM transport (§3) |
  40| Ballot proof | Groth16 over BN254 (circom, trusted setup) | Plonky3 STARK over Goldilocks, browser WASM (§6) |
  41| Election key | DKG / council ceremony (BabyJubjub) | **None.** Wardens register ML-KEM keys (§4) |
  42| Tally | Threshold decryption + BSGS search | Lagrange interpolation of θ proven warden sums (§10) |
  43| Running tally | Homomorphic ciphertext accumulator | Padded plain-sum accumulator over Goldilocks (§8.4) |
  44| Silent revoting | Re-encryption of stored ciphertexts | Hash-chained opaque slot leaves (§7) + padded accumulator |
  45| Revotes | Slot overwrite + ciphertext subtraction | One-live-chain packages + revocation nullifiers (§5.3) |
  46| Voter authentication | ECDSA (secp256k1) | Hash-preimage proof in-STARK; `hybrid` verifies **both**; `hybrid-legacy` admits unenrolled voters on ECDSA (§11) |
  47| CSP credentials | ECDSA | SLH-DSA (SPHINCS+) [FIPS 205] |
  48| Batch proof | ZisK, verifies Groth16 (BN254 precompiles) | ZisK [ZISK], verifies ballot STARKs (Blake3 precompile) |
  49| Protocol hash | Poseidon (circuits) + SHA-256 (state) + Keccak (Ethereum) | **Blake3 everywhere the protocol chooses** (§2); keccak/SHAKE/SHA-2 survive only as fixed islands |
  50| Tally bound | maxValue·maxVoters ≤ 10^12 (BSGS limit) | ≤ 2^61 (field headroom; no search) |
  51
  52![What changes from v2 to v3-PQ](figures/architecture-delta.svg)
  53
  54---
  55
  56## Protocol intuition — read this first
  57
  58*A plain-English walkthrough of a v3 election, phase by phase, mapped onto the v2 flow you
  59already know. Every term used loosely here gets a precise definition from §2 onward; the
  60jargon cheat-sheet is §2.4.*
  61
  62**Setup.** The organizer creates the election exactly as in v2 — census, ballot rules,
  63duration. One thing changed: instead of waiting for a key ceremony, the organizer points at a
  64committee of ν key wardens (say 5, or 16), each of which has already published a post-quantum
  65"lockbox" public key: anyone can lock a small secret so that only that warden can open it.
  66There is **no election encryption key** — nothing is generated jointly, and v2's whole DKG
  67phase is simply gone.
  68
  69**Casting.** The voter's browser takes each ballot value and splits it into ν puzzle pieces,
  70one per warden, using the Shamir trick: any θ pieces (the *threshold* — e.g. 3 of 5) fit
  71together to reconstruct the value, while θ−1 or fewer are pure noise that says nothing at
  72all. The browser then hides each piece under a one-time mask (a random-looking number added
  73to it), locks each mask key into the matching warden's lockbox, and attaches a STARK proof —
  74generated right there in the browser — that the whole construction is consistent: the pieces
  75encode one valid ballot that follows the election rules, the masks match their commitments,
  76and the voter is who they claim to be. The published vote (a *package*) is just masked
  77pieces + locked boxes + commitments. Everything visible is noise; nothing about the choice
  78can be read from it, now or ever, by anything short of θ wardens cooperating.
  79
  80**Voting period.** Sequencers collect packages and settle batches with a zkVM proof, as in
  81v2. The chain maintains one new object: a public **running total** — for each warden, the sum
  82of all masked pieces addressed to it. Adding masked numbers keeps them masked, so the running
  83total is public yet unreadable. A revote cancels the voter's previous package through an
  84unlinkable **nullifier** (same idea as Tornado/Semaphore nullifiers), and the batch proof
  85subtracts the old package's pieces from the running total. Meanwhile, refreshes keep
  86re-hashing slot entries so an outside observer still cannot tell who revoted — v2's "silent
  87revoting", achieved by different means.
  88
  89**End of election.** After the grace window come two short new phases: first the
  90**complaint deadline** — any warden that finds a broken package (a lockbox that doesn't open
  91to what was promised) can prove that on-chain and have the package excluded, **at any time
  92from the moment the package settles** (so a voter with a buggy client finds out early and
  93simply revotes); the deadline is the last moment to do it — then the exclusion list freezes.
  94
  95![Election timeline: the two new phases before results](figures/timeline.svg)
  96
  97**Results.** Any θ wardens now each do one job: open all their lockboxes, strip their own
  98masks off their column of the frozen running total, and publish the resulting **partial
  99sum** — with a proof that they did exactly that and nothing else. The punchline: those θ
 100partial sums are θ points on a single polynomial, and that polynomial's value at zero *is*
 101the exact election result. The smart contract draws the unique curve through the θ points and
 102reads it at zero — ordinary integer math, done on-chain. No shared-key decryption ever
 103happens — there is no shared key to decrypt with (each warden only ever opens its own
 104lockboxes).
 105
 106![How the tally emerges from θ partial sums](figures/tally-algebra.svg)
 107
 108What this buys you:
 109- **There is no *shared* election decryption key.** (Threshold-shared *batch-payload* keys do exist and are reconstructed at tally — §8.5/§10.4 — but no key ever decrypts the ballot aggregate.) Not distributed as an election key, that is —
 110  it does not exist, and neither does the key-generation ceremony that managed it in v2
 111  (wardens keep ordinary per-warden lockbox keys, and tally time still has its own
 112  coordinated ceremony — §10).
 113- **Harvest-now-decrypt-later is dead below θ wardens.** The published pieces are
 114  information-theoretic noise; the only cryptography protecting them is the lockboxes
 115  (ML-KEM) and hashes — both post-quantum.
 116- **Every step is proof-checked** — browser proof, batch proof, warden proofs — so voters,
 117  sequencers and wardens are checked, not trusted, for correctness.
 118- **The tally is exact integer arithmetic.** No decryption failures, no noise budgets, no
 119  brute-force search at the end.
 120
 121---
 122
 123## 2. Notation, parameters and encodings
 124
 125- $\mathbb{F}$ — the **Goldilocks field**, $p = 2^{64} - 2^{32} + 1$ (the Plonky3 [P3] and ZisK
 126  native field). All shares, masks and tally arithmetic live here. Canonical encoding of an
 127  element: 8 bytes little-endian, value < $p$.
 128- $\nu$ — number of **key wardens**; $\theta$ — tally threshold. **v3.0 supports
 129  $1 \le \theta \le \nu \le 8$**, enforced at creation and in the pinned profile (DA and
 130  in-circuit cost are linear in ν — ν=8 halves both vs 16; the protocol structures support
 131  up to 16, which returns as a future profile once DA/verification optimizations land;
 132  committee size is unrelated to the 16 *ballot fields*, which stay). Size rosters with the
 133  availability margin in mind: tolerating $f$ unavailable or faulty wardens through the
 134  complaint deadline and tally ceremony needs $f < \theta \le \nu - f$ — an 8-of-8 election
 135  tolerates none — and the ceremony absorbs individual failures by roster margin (§10.4),
 136  with blinding still requiring ≥ 1 honest *accepted dealer*. The complaint-capacity bound (§9.2) depends
 137  on admitted casts, not ν: fewer wardens means less aggregate proving/archival redundancy,
 138  so deadlines and hardware budgets must be revalidated per roster size.
 139- `nf` — active ballot fields, 1..16, as in v2. A ballot is a vector $b_1..b_{16}$; fields
 140  beyond `nf` are **inactive and MUST be 0** (enforced by the ballot proof; their shares are
 141  shares of 0).
 142- **KEM** — **ML-KEM-768 [FIPS 203] (ct 1088 B), the only allowed profile** (v1.2's
 143  ML-KEM-512 option is withdrawn: BSI recommends only the 768/1024 sets, and 512 saved just
 144  ~2.5 KB per ballot at ν=8; the DA-reduction path is multi-recipient Kyber, §15.5). Browser
 145  implementations must be pinned and vetted [KEMB]. One *encapsulation* yields `(ct, K)` with
 146  a 32-byte shared secret `K`; arbitrary payloads are carried KEM-DEM style (encapsulate,
 147  derive a wrapping key from `K`, then DEM-encrypt — §2.1). **Normative decapsulation rule
 148  (all paths — warden recovery §10.1, complaint guests §9.2, ceremony recipients §10.4):
 149  the FO re-encryption check MUST compare the full re-encrypted ciphertext in constant time;
 150  partial or early-exit comparison enables ML-KEM key recovery [FOCT].**
 151- **Blake3** — standard Blake3 [B3] is **the protocol hash, everywhere the protocol gets to
 152  choose**: the ballot STARK's Merkle trees and Fiat–Shamir challenger; all in-circuit
 153  hashing (PRF masks, commitments, voteID, nullifiers — via a re-laid Blake3 AIR section,
 154  §6); the census tree; the state SMT and the nullifier SMT; `pkgDigest`/`ctsDigest`; and
 155  every DEM/PRF/key-derivation role through Blake3's standard *keyed*, *derive_key* and
 156  *XOF* modes (§2.1). Digests are 32 bytes. Rationale: fastest software hash in the browser
 157  (~1.4 GB/s in WASM; measured on the prototype: proving 3.24 s → 0.69 s, proofs
 158  544 → 324 KB), a standard-conformant ZisK precompile (`blake3f`) for every guest
 159  recomputation, and a conservative, long-studied ARX design (§12.4). One hash = one
 160  implementation to audit on each platform (AIR, guest, browser, warden).
 161- **Hash islands the protocol cannot choose**, stated plainly: **keccak256** for values
 162  Solidity contracts must compute (blob evaluation points $z_b$, the v2 processID prefix,
 163  the origin-3 running registration commitment of §8.2) and for hybrid-mode Ethereum
 164  addresses; **SHAKE** inside ML-KEM and **SHA-2** inside SLH-DSA (FIPS-fixed internals of
 165  black-box primitives); **Poseidon2** inside ZisK's own prover (an inherited proof-system
 166  dependency — framing in §12.4; [POS2]). Poseidon2 and SHA-256 hold **no
 167  application-level role** in v3-PQ.
 168- **256-bit values in circuits** (DEM keys, Blake3 digests crossing into Goldilocks
 169  arithmetic): encoded as **eight 32-bit limbs**, each range-checked < 2^32. Never as four
 170  64-bit limbs (not injective: $p^4 < 2^{256}$), and never reduced mod $p$.
 171
 172### 2.1 DEM (authenticated encryption for warden payloads)
 173
 174Built from Blake3's standard modes, normative for **every protocol payload** (voter→warden is
 175pure KEM+PRF and needs no DEM; this DEM covers batch payloads, batch-key share wrapping, and
 176ceremony deliveries):
 177- **Key separation**: `k_enc = Blake3.derive_key("davinci v3-pq DEM enc key", K)` and
 178  `k_mac = Blake3.derive_key("davinci v3-pq DEM mac key", K)` — fixed application context
 179  strings, exactly the standard derive_key mode. `derive_key` creates *separation, not
 180  entropy*: `K` must be a ≥256-bit KEM secret or CSPRNG secret.
 181- **Keystream**: keyed-Blake3 **XOF** — `keystream = Blake3.keyed(k_enc, nonce ‖ AAD).xof()`,
 182  with the counter being the XOF output offset (bounded: payloads < 2^32 blocks, no offset
 183  wraparound); ciphertext = plaintext ⊕ keystream. An XOF is a seekable output stream, not
 184  repeated hashing of previous output.
 185- **Authentication**: encrypt-then-MAC — `tag = Blake3.keyed(k_mac, nonce ‖ AAD ‖ ciphertext)`;
 186  receivers verify the **full 32-byte tag before releasing any plaintext**.
 187- **Uniqueness**: `nonce = Blake3(AAD)`; the AAD is the canonical, length-unambiguous
 188  serialization of a **DEM context** that always includes a purpose tag, the election
 189  context, the **batch number or ceremony (session, attempt) identifier**, sender and
 190  recipient — unique per encryption *including retries* (a ceremony restart is a new attempt
 191  id ⇒ fresh masks, keys and nonces; the same derived key and nonce never encrypt two
 192  different plaintexts).
 193
 194Honest label: these are standard Blake3 modes, but their composition is a
 195**protocol-specific authenticated-encryption construction — not a standardized AEAD**; the
 196needed assumption is keyed-Blake3's PRF security (§12.4). A short security-argument appendix
 197(encrypt-then-MAC composition per Bellare–Namprempre over keyed-Blake3-as-PRF, with the
 198deterministic AAD-derived nonce justified by the AAD-uniqueness rule above) is a Phase-0
 199publication gate (§15). AES-256-GCM may be used by clients
 200for unrelated local storage/transport, never as a substitute encoding of protocol payloads.
 201
 202### 2.2 Domain-separated contexts
 203
 204Every derived value uses a purpose-tagged context; nothing is derived without one. Purpose
 205tags map to Blake3 `derive_key` context strings; the tuple itself is serialized canonically
 206(fixed order, length-prefixed variable fields).
 207
 208| Purpose | Context contents |
 209|---|---|
 210| `pkgCtx` — the package context tuple | `(protocolVersion, chainID, registry, processID, wardenEpoch, voteID)` — the common prefix below |
 211| `streamCtx(i)` — mask stream for masked shares | `("v3/mask", pkgCtx, recipient i)` — **one keyed XOF stream per (package, warden)**, no field index: `stream_i = Blake3.keyed(K_i, streamCtx(i)).xof()`, 256 bytes of output; field $f$ uses bytes $[16(f{-}1), 16f)$ via the LE128-mod-$p$ rule below. This is a **normative masking definition** — browser, ballot AIR, batch guest and warden implementations must match it bit-exactly (test vectors required) |
 212| `hCtx(i)` — share/pad commitment | `("v3/hcommit", pkgCtx, recipient i)` |
 213| `commitCtx` — package commitment | `("v3/pkgcommit", pkgCtx)` — the `ctx` argument of `pkgCommit` (§5.1) |
 214| `nullCtx` — revocation nullifier | `("v3/null/2", protocolVersion, chainID, registry, processID)` — **predecessor-only and salt-bound**: `NULL = Blake3(nullCtx ‖ sk ‖ prevPkgDigest ‖ prevSalt)` with `sk` the voter's census-bound secret or `sk_pkg` (§11), and `prevSalt` **the same variable that opens the predecessor's `pkgCommit`** (never a fresh unconstrained input). Never depends on the successor package, batch, or recipients. The derivation is pinned per election and never switches mid-election. Why the salt: see §5.3/§12.3. |
 215| `viewCtx` — per-warden column views | `("v3/view/rows", …)`, `("v3/view/payload", …)`, `("v3/view/acc", …)`, `("v3/view/root", …)` — the four §8.7 commitments; each context binds `(protocolVersion, chainID, registry, processID, wardenEpoch, wardenSetHash)` plus the batch number and (where applicable) the recipient index |
 216| `cerCtx` — ceremony envelopes | `("v3/ceremony/<phase>", pkgCtx-style election tuple, session, attempt, sender, roster hash, dealer-set hash where applicable)` — the signed-envelope context of §10.4; every ceremony signature and DEM context derives from it |
 217| `slotCtx` / `refreshCtx` — slot leaves | `"davinci-slot-v3"` / `"davinci-refresh-v3"` (§7) |
 218
 219The package's mask nonce is its **voteID** — public, unique per package, authenticated, and
 220independent of the masked values (it derives from the secret `k`, §5.2, before any masking),
 221so wardens can recompute every `streamCtx` from public data with no circularity. (Earlier
 222drafts derived one PRF output per *field*; that definition contradicted the in-AIR cost
 223estimates — ≥16 final keyed computations per warden, 256 at ν=16 — and was replaced by the
 224single per-warden stream above, which needs only one context block plus four 64-byte XOF
 225output blocks per warden.)
 226
 227**Byte→field mapping (normative).** Blake3 outputs bytes; masks and other derived field
 228elements are obtained as **LE128 of 16 XOF bytes, reduced mod $p$** — statistical distance
 229from uniform ≈ $2^{-96}$ *per element* (pseudorandom/nearly uniform — not exact uniformity, and not a whole-election bound). Never `LE64(8 bytes) mod p`: its distance is
 230≈ $2^{-32}$, which is not.
 231
 232### 2.3 Protocol parameters
 233
 234| Parameter | Value | Why |
 235|---|---|---|
 236| Share/tally field | Goldilocks $p$ | native in the ballot AIR and ~native u64 in ZisK guests |
 237| Registry tally cap | `maxValue · maxVoters ≤ 2^61` | per-field tally stays below $p$ with headroom (weights don't change this: each field is individually bounded by `maxValue`) |
 238| **Integer-cost profile (enforced)** | `nf · maxValue^costExponent < 2^61`, checked by the registry at creation **and** recomputed overflow-safe in the ballot proof | the cost sum must not wrap mod $p$ (e.g. `costExponent=192` would give $2^{192} \equiv 1$); v2 only *advised* this profile — v3 enforces it |
 239| Warden evaluation points | $x_i = i$, $i \in 1..\nu$ | Shamir positions, pairwise distinct, nonzero |
 240| Max votes per batch | profile-dependent (§8.6) | in-guest verification cost + the 32-blob batch cap inherited from v2's batch program (see §8.6) |
 241| Max refreshed slots per batch | 2048, rule as v2 | unchanged |
 242| `maxRevotesPerVoter` | immutable election parameter | **per-voter revote bound, enforced in-proof** via the private chain counter (§5.3); prevents any single voter from consuming other voters' casting capacity |
 243| Global admitted-cast capacity | `N = maxVoters × (1 + maxRevotesPerVoter)` | sizes the complaint budget (§9.2); the `+1` is the initial vote — a revote bound alone is not a cast bound. `maxRevotesPerVoter` may be generous, but only where the configured worst-case capacity has been validated (§9.2) |
 244| Accepted-batch bound | `M ≤ admitted casts + 1` | every transition other than the single initialization-only transition of §7.4 must admit ≥ 1 package (registry-enforced on the batch statement's counters); refresh-only batches are not accepted. Bounds the per-warden batch-envelope work (§8.5, §10.1) |
 245| High-stakes FRI profile (named) | blowup 32, **27 queries + 20-bit grinding** ≈ 155 conjectured bits | the pinned "raise the dial" option of §12.4 (~1.5× in-guest verification cost vs the default profile); selecting it is a profile choice, not an ad-hoc edit |
 246| Nullifier tree | Blake3 SMT, depth 256 | full-width nullifiers (no truncation into the 64-bit key space) |
 247| Ballot STARK profile | Goldilocks, **blowup 32, 18 FRI queries + 16-bit query grinding**, hiding PCS, **Blake3 everywhere** (Merkle/challenger AND the in-AIR hashing section) | ≈106-bit conjectured FRI soundness (§12.4, same heuristic dial as before); chosen verifier-side: −35% in-guest steps and −39% proof size vs blowup-8/34-queries, for ~2.7× prover cost — measured (§8.1). Fallback if browser benchmarks disappoint: blowup 16 / 26 queries. Profile pinned in full by `ballotVKHash`; grinding makes the wasm32 challenger fix (§6) strictly mandatory |
 248| Commitments | **salted unkeyed Blake3**, domain-separated | hiding from an independent 256-bit CSPRNG salt (or the secret inputs); binding from collision resistance. Keyed-Blake3 is reserved for MACs/PRFs — a MAC is not automatically a hiding/binding commitment |
 249
 250### 2.4 Terminology for software engineers
 251
 252Plain definitions, anchored in things an Ethereum engineer already knows. Skim once; the rest
 253of the document assumes them.
 254
 255- **KEM** (Key Encapsulation Mechanism; here **ML-KEM**, the standardized Kyber) — a
 256  public-key *lockbox*: anyone can "encapsulate" against your public key and obtain a fresh
 257  32-byte shared secret plus a ciphertext; only you (with the private key) can recover that
 258  secret from the ciphertext. Think of it as the post-quantum replacement for ECDH key
 259  exchange — except there is no shared-curve math and the two parties never need to be online
 260  together.
 261- **PRF** (pseudorandom function) — a keyed hash used as a deterministic random-number
 262  generator: same key + input ⇒ same output, and without the key the outputs are
 263  indistinguishable from random. Mentally: `keccak256(key, input)` used the way you'd use a
 264  seeded RNG. Here PRFs expand a KEM secret into the masks that hide shares.
 265- **Shamir secret sharing** — split a value into ν pieces by choosing a random polynomial of
 266  degree θ−1 whose value at x=0 is the secret, and handing out its values at x=1..ν. Any θ
 267  pieces determine the polynomial (and hence the secret); any θ−1 pieces are statistically
 268  independent of it — noise, not "hard to crack".
 269- **Threshold θ-of-ν** — ν parties hold pieces; any θ of them suffice to act (here: tally);
 270  fewer than θ learn nothing and can block nothing except by being too few.
 271- **Lagrange interpolation** — given θ points, there is exactly one polynomial of degree
 272  ≤ θ−1 through them; evaluating it at x=0 recovers a Shamir secret. "Draw the unique curve
 273  through the points, read it at zero." A few multiplications and additions — cheap even in
 274  Solidity.
 275- **STARK** — a zero-knowledge proof system built only from hashes (no trusted setup, no
 276  elliptic curves, post-quantum). Bigger proofs than Groth16 (hundreds of KB), but
 277  browser-provable and cheap to verify.
 278- **AIR** — the constraint system of a STARK: its "circuit".
 279- **FRI** — the polynomial-checking engine inside a STARK; the reason STARK verification is
 280  mostly hashing.
 281- **Hiding PCS** — the polynomial commitment inside the STARK is randomized so the proof
 282  leaks nothing about private inputs; this is what makes the proof *zero-knowledge* rather
 283  than merely succinct.
 284- **Witness** — the prover's private inputs (the ballot, the shares, the keys). Never leaves
 285  the prover.
 286- **Nullifier** — a one-way tag published to mark something as spent without revealing what;
 287  exactly the Tornado Cash / Semaphore pattern. Here: marks a vote package as replaced.
 288- **Accumulator** (as used here) — just a running sum vector of field elements maintained by
 289  the batch program. *Not* an RSA or Merkle accumulator.
 290- **Blake3** — a modern general-purpose hash: ARX design (add–rotate–xor, the ChaCha/BLAKE/
 291  BLAKE2 lineage; BLAKE was a SHA-3 finalist), extremely fast in software, with standard
 292  built-in modes for keyed hashing (MAC), key derivation (`derive_key`) and arbitrary-length
 293  output (XOF). v3's single protocol hash.
 294- **DEM / AEAD** — symmetric authenticated encryption (ciphertext + tamper-proof tag), the
 295  AES-GCM role; v3 instantiates it from Blake3's keyed + XOF modes so one hash covers it and
 296  zk-proofs about it stay cheap (§2.1).
 297- **Domain separation** — namespacing every hash/PRF input with a purpose tag and context so
 298  a value from one context can never be replayed in another — the same reason EIP-712 typed
 299  signing exists (§2.2).
 300- **Dealer** — a party that generates a secret and distributes shares of it (used in the
 301  tally ceremony, §10.3).
 302- **CSPRNG** — a cryptographically secure random generator (`crypto.getRandomValues`,
 303  `/dev/urandom`); "fresh CSPRNG randomness" means sampled from this, never derived.
 304
 305---
 306
 307## 3. The core idea: tally without a shared decryption key
 308
 309v2 hides a ballot inside a ciphertext and adds ciphertexts homomorphically. v3 hides a ballot
 310inside **polynomials** and adds polynomials. If you know Lagrange interpolation, you know the
 311whole trick:
 312
 3131. For each ballot field value $b$, the voter picks a random polynomial $f$ of degree
 314   $\theta-1$ with $f(0) = b$, and computes one **share** per warden: $s_i = f(i)$. Any
 315   $\theta$ shares reconstruct $b$; any $\theta-1$ shares are statistically independent of
 316   $b$. Plain Shamir [Sha79]: no curves, just polynomial evaluation in $\mathbb{F}$.
 3172. Shares are never published in the clear. The voter publishes **masked shares**
 318   $e_i = s_i + \mathrm{mask}_i$, where the masks are sliced from one keyed Blake3 XOF
 319   stream per warden (§2.2) and the stream key $K_i$ travels to warden $i$ inside an ML-KEM
 320   ciphertext. To everyone except warden $i$, $e_i$ is a uniformly random field element.
 3213. Polynomials add: the per-field sum of every active voter's polynomial is itself a
 322   degree-$(\theta-1)$ polynomial whose value at 0 is the **tally**. So the protocol only
 323   ever needs to add public field elements. The batch program maintains a public
 324   **accumulator** $A \in \mathbb{F}^{\nu \times 16}$: coordinate $(i, f)$ is the running
 325   sum of the masked shares addressed to warden $i$ for field $f$ (plus batch pads, §8.4).
 3264. At the end, each participating warden decapsulates its KEM ciphertexts, subtracts its pads
 327   from its row, and publishes its **sum-share** $S_i$ — with a ZisK proof that it did exactly
 328   that against on-chain-committed data. Lagrange interpolation of any $\theta$ published
 329   sum-shares at $x=0$ **is** the tally. Exact field arithmetic: no decryption of any
 330   aggregate, no noise, no discrete-log search.
 331
 332![How the tally emerges without a shared decryption key](figures/tally-algebra.svg)
 333
 334(*This section is the intuition; the full computation also handles the exclusion set, batch
 335pads, and a blinding term — §9–§10.*)
 336
 337The ballot STARK (§6) makes steps 1–2 trustworthy, the batch proof (§8) step 3, the warden
 338proofs (§10) step 4. **The zkVM proof chain replaces the homomorphic algebra** — the
 339structural difference from academic PQ voting designs ([TEV], [PQK]), which obtain the same
 340guarantee from lattice commitments. (Some public-key encryption is unavoidable for ballots
 341addressed to offline wardens [IR89]; v3 confines it to KEM transport. Threshold *lattice*
 342decryption — the known hard part of lattice voting [NOAH] — is avoided entirely: the
 343threshold lives at the plaintext layer.)
 344
 345Privacy in one sentence: below $\theta$ colluding wardens, shares are information-theoretically
 346useless in isolation, and the computational assumptions protecting ballots are ML-KEM, the
 347PRF/hash, and the zero-knowledge of the STARKs — all post-quantum (full leakage model: §12).
 348
 349---
 350
 351## 4. Roles: what changed
 352
 353- **Organizer, sequencers, provers, observers** — unchanged from v2.
 354- **Key wardens** no longer run a DKG or hold shares of a secret key. Per *epoch*, each warden
 355  generates an ML-KEM keypair **and an SLH-DSA-SHA2-128s signing keypair [FIPS 205]** and
 356  calls the **WardenRegistry** contract with: `H(pk)`, **`H(pk_sig)`**, a URI where the full
 357  public keys are served (IPFS or HTTPS), and a ZisK **well-formedness proof** (the ML-KEM
 358  key pair derives from a committed seed and passes an encaps/decaps self-test). The registry
 359  verifies the proof on-chain. The signing key authenticates the warden's rare protocol
 360  messages (ceremony envelopes, §10.4); signatures are ~7.9 KB and verification is pure
 361  hashing — acceptable for per-election-scale message counts. An election pins its committee
 362  in `wardenSetHash` (config leaf `0x3`, §7): `(ν, θ, epoch, the ν registered (H(pk),
 363  H(pk_sig)) pairs)`. A voter's client fetches the ν public keys (from their URIs or any
 364  sequencer), recomputes each hash and the set hash, and verifies it against the on-chain
 365  value before casting; it refuses to cast otherwise. The registry refuses to create an
 366  election whose warden set is not fully registered.
 367  **Archival is a permissionless, untrusted role, not a per-warden duty.** EIP-4844 blobs are
 368  pruned after ≈18 days, so for any longer election the history must be captured while it is
 369  live — in native blob mode from **registration/publication time**, not settlement time
 370  (§8.6). Any party may serve as an archive provider with no registration: all served data is
 371  authenticated by consumers against the accepted chain commitments (the registry's
 372  `archiveAcc` manifest chain plus each blob's full commitment/versioned-hash binding —
 373  recomputing the manifest fold alone does not authenticate returned bytes). The liveness
 374  assumption is **at least one complete, available archive** spanning the casting period,
 375  the complaint window, every tally attempt, and the declared retention period — including
 376  ceremony and complaint publications, not only batch blobs. Wardens SHOULD still retain
 377  their own column view (§8.7) as resilience, and a deployment profile SHOULD name at least
 378  one accountable archiver (organizer or warden set) even though providers are untrusted.
 379  Wardens MAY process incrementally during the voting period (decapsulation and share
 380  recovery don't need to wait for the end); complaints may also be filed as soon as a package
 381  settles (§9.2), and at the end the participants run one tally ceremony (§9–§10).
 382- **Key modes.** *Committee* (lottery over registered operators) and *council*
 383  (organizer-invited set) map 1:1 from v2 — they only select *which* registered warden keys
 384  form the set. *Sequencer mode* is the degenerate $\nu = \theta = 1$ case (the sequencer is
 385  the only warden; ~1 KB per ballot — cheaper than v2). **Locked mode is deferred**: it
 386  requires an organizer-side share column and a separately reviewed extension of the tally
 387  equations; it is not part of v3.0.
 388
 389---
 390
 391## 5. The ballot package
 392
 393A vote is one **package**. Its public part goes into blobs; its private part exists only in
 394the voter's browser — except the *revote metadata* the chosen sequencer needs (§5.4).
 395
 396![Building a ballot package in the browser](figures/ballot-package.svg)
 397
 398### 5.1 Public package contents and CanonicalPackage
 399
 400| # | Field | Size (ν=16, ML-KEM-768) | Description |
 401|---|---|---|---|
 402| 1 | `version` | 1 B (`0x03`) | package format version |
 403| 2 | `processID` | 31 B | as v2 |
 404| 3 | `voteID` | 8 B LE | §5.2; also the package's mask nonce (§2.2) |
 405| 4 | `E` | ν·16·8 B = 2,048 B | masked shares, row-major (warden-major, field-minor), canonical LE |
 406| 5 | `cts` | ν·1,088 B = 17,408 B | ML-KEM ciphertexts, warden order 1..ν |
 407| 6 | `h` | ν·32 B = 512 B | commitments $h_i = \mathrm{Blake3}(hCtx(i) \,\|\, s_{i,1..16} \,\|\, K_i)$ — salted unkeyed Blake3 per §2.3 (the secret $K_i$ and shares are the hiding material here) |
 408| 7 | `pkgCommit` | 32 B | $\mathrm{Blake3}(\mathrm{commitCtx} \,\|\, slot \,\|\, pk_{\text{voter}} \,\|\, \mathrm{prevPkgDigest} \,\|\, \mathrm{sharesDigest} \,\|\, t \,\|\, \mathrm{salt})$ — hiding comes from `salt`, an independent **256-bit CSPRNG commitment salt** kept in the package opening (share entropy alone is NOT enough: given θ−1 shares and a candidate ballot, the whole polynomial is determined); `prevPkgDigest = 0^{32}` for a first vote; `t` is the **private chain counter** (§5.3) |
 409| 8 | `hybridSig` | 65 B or absent | hybrid mode only: ECDSA over `pkgDigest`, Ethereum personal-message format (§11); travels voter→sequencer→batch guest only — **never published** (§5.4) |
 410
 411`CanonicalPackage` = the concatenation of fields 1–7 exactly as listed (fixed order, fixed
 412sizes, no framing). **`pkgDigest = Blake3(CanonicalPackage)`** is the package's chain
 413identity: it is the value stored at the vote-ID leaf, the input to revocation nullifiers, and
 414what complaints reference. **`sharesDigest = Blake3(h_1 ‖ … ‖ h_ν)`** — despite the name it
 415binds the shares *through* the per-warden commitments $h_i$ (each AIR-bound to the exact
 416$(s_i, K_i)$ used in masking, fixed order and count), which is equivalent binding at an
 417eighth of the in-circuit hashing cost. The ballot STARK (~195 KB at the pinned profile) accompanies the package to
 418the sequencer but is **not** published in blobs.
 419
 420### 5.2 Construction (browser, pseudocode)
 421
 422```text
 423k         = fresh random scalar (or PRF(sk, "v3/k", processID, counter) in recovery mode)
 424voteID    = N + trunc63(Blake3("v3/voteid" || processID || address || k))
 425                                                                 # trunc63 = lowest 63 bits;
 426                                                                 # N = 2^63 (v2's namespace offset)
 427for f in 1..nf:
 428    poly_f = random polynomial, degree θ-1, poly_f(0) = ballot[f]
 429for f in nf+1..16:  poly_f = random polynomial with poly_f(0) = 0  # inactive fields: shares of 0
 430s[i][f]   = poly_f(i)                                            # ν shares per field
 431for i in 1..ν:
 432    (ct[i], K[i]) = MLKEM.Encaps(pk_warden[i])                   # fresh randomness per package, NEVER reused
 433    stream = Blake3.keyed(K[i], streamCtx(i)).xof(256 bytes)     # ONE mask stream per warden (§2.2)
 434    for f in 1..16: e[i][f] = s[i][f] + LE128(stream[16(f-1)..16f]) mod p
 435    h[i]  = Blake3(hCtx(i) || s[i][1..16] || K[i])
 436t           = 0 for a first vote; prev.t + 1 for a revote       # private chain counter, ≤ maxRevotesPerVoter
 437salt        = fresh 256-bit CSPRNG value                         # hiding salt, kept in the opening
 438sharesDigest = Blake3(h[1] || .. || h[ν])
 439pkgCommit   = Blake3(commitCtx || slot || pk_voter || prevPkgDigest || sharesDigest || t || salt)
 440ctsDigest   = Blake3(ct[1] || .. || ct[ν])                       # binds the ciphertext bytes (§6)
 441proof       = BallotSTARK.prove(...)                             # §6
 442```
 443
 444ML-KEM encapsulation costs ~1–2 ms per warden in browser WASM [KEMB]; the dominant client
 445cost is the STARK (§6). **Freshness warning:** encapsulations are fresh per package and per
 446attempt — including candidate packages that are never admitted. Reused KEM randomness yields
 447identical ciphertexts (publicly linkable); actual *pad* reuse (same key AND same stream
 448context) would publish the difference of two sharings, which interpolates to the ballot
 449difference. Distinct voteIDs give distinct stream contexts for admitted packages, but
 450clients must keep freshness across retries and rejected submissions too.
 451
 452**Client state — what losing it costs.** Default: `k`, the polynomials and the KEM
 453randomness are **independent CSPRNG randomness**, and the client stores the package opening —
 454including the commitment salt — (needed to revote). Losing the opening loses only the
 455*ability to revote*: the cast ballot still counts; a voter on a new device without recovery
 456mode simply cannot replace it. Optional *recovery mode* derives everything **including the
 457salt** as `PRF(sk_voter, purpose, processID, counter)` with distinct purpose tags (salt
 458included: `"v3/salt"`). Any device holding `sk` can then reconstruct past packages. The
 459documented trade-offs: whoever later obtains `sk` can also reconstruct that voter's own
 460historical ballots, can enumerate the voter's voteIDs (§12.3 channel 3), and can re-derive
 461the salt — which **voids the §5.3 salt-bound nullifier protection** for these clients.
 462Recovery mode is therefore a **deployment-profile choice**, not a universal default:
 463recommended ON for ordinary low-stakes elections (device loss is far more common than
 464targeted key extraction), and OFF (CSPRNG mode mandated as client-conformance policy — the
 465protocol cannot distinguish the two derivations) for coercion-sensitive deployments. Counter recovery, in the only order that actually works (`pkgDigest` depends on
 466ballot-dependent data, so it cannot be derived from `sk` and a counter alone): the client
 467trial-derives `k` and hence `voteID` for counters 0, 1, 2, …; looks each `voteID` up
 468on-chain (the vote-ID leaf yields the admitted `pkgDigest`); fetches that package's bytes
 469from the blob archive; re-derives the salt and KEM randomness from the counter's seeds, and
 470recovers the shares by unmasking the fetched package's public E with the re-derived pad
 471keys (shares are not derivable from seeds alone); checks the result against the package's
 472commitments; and checks the nullifier tree to find which package is still live. Gaps from
 473collision-resamples (§14) are skipped naturally.
 474
 475### 5.3 Revoting: the one-live-chain rule
 476
 477v2 overwrote the voter's slot and subtracted the stored ciphertext. v3 has no stored
 478ciphertext, so the *voter's proof* identifies what to remove:
 479
 480![Revote lifecycle: the one-live-chain rule](figures/revote-lifecycle.svg)
 481
 482- Each voter has, per election, a chain of packages $P_0 \to P_1 \to \dots$; exactly one is
 483  **live**. A revote package $P_{t+1}$ consumes $P_t$: the STARK proves knowledge of $P_t$'s
 484  opening (same slot, same key) and the nullifier derivation
 485  $\mathrm{NULL}_t = \mathrm{Blake3}(\mathrm{nullCtx} \,\|\, sk \,\|\, \mathrm{pkgDigest}_t \,\|\, \mathrm{salt}_t)$,
 486  where `sk` is the voter's census-bound secret (or the self-chosen `sk_pkg` for unenrolled
 487  hybrid voters — §11) and $\mathrm{salt}_t$ is **the predecessor's commitment salt — the
 488  same witness variable that opens $P_t$'s `pkgCommit`**, never an independent input. Binding
 489  the salt means an adversary who extracts only the identity key `sk` cannot compute the
 490  voter's revocation tokens (the salt lives in the package opening, a separate secret). This
 491  is **key-compromise compartmentalization, not coercion resistance** — the exact claim and
 492  its limits (captured tokens, derivation-proof demands, recovery-mode and hybrid-legacy
 493  clients, where it is void) are in §12.3. The derivation is pinned per election and never
 494  switches mid-election.
 495- The batch program checks $P_t$ **was admitted and is settled**: an inclusion proof of
 496  `voteID_t → pkgDigest_t` under the current root (consequently, a predecessor cast in the
 497  *same* batch cannot be consumed yet — §14). It inserts $\mathrm{NULL}_t$ into the nullifier
 498  tree (insert-once: double consumption is impossible), subtracts $P_t$'s public `E` from the
 499  accumulator, and adds $P_{t+1}$'s.
 500- Invariants enforced by the batch program: an **empty slot admits exactly one initial
 501  package**; a package for an **occupied slot must consume exactly one admitted, unconsumed
 502  predecessor of the same owner and slot**; refreshes never create occupancy.
 503- **Per-voter cast budget (the chain counter).** Each package opening carries a private
 504  counter `t`, bound inside `pkgCommit` (§5.1): a first package proves `t = 0`; a revote
 505  proves `t_new = t_prev + 1` against the predecessor's opening and
 506  `t_new ≤ maxRevotesPerVoter` (an immutable election parameter, §2.3). The counter is
 507  **private** — publishing it would leak revote patterns — and the ballot STARK enforces it,
 508  with `maxRevotesPerVoter` authenticated from the immutable election parameters and all
 509  counter/capacity arithmetic in bounded integers (no wraparound). `t` is distinct from the
 510  recovery-mode randomness counter (§5.2): a voteID-collision retry advances randomness
 511  allocation, not the number of admitted predecessors.
 512  Why it exists: with only a global cast capacity, one eligible voter could legally consume
 513  it all (e.g. a 100-slot election with a 200-cast budget: one voter casts once, then revotes
 514  199 times, each with a valid proof and fresh nullifier — and no other voter can cast a
 515  first ballot). The per-voter bound makes that impossible, and the global capacity
 516  `maxVoters × (1 + maxRevotesPerVoter)` then holds by construction rather than by racing.
 517
 518Nullifiers are unlinkable to packages for third parties (they depend on `sk`). The coercion
 519consequences are stated in §12.3.
 520
 521### 5.4 Submission interface (voter → sequencer)
 522
 523The voter submits to one sequencer, over an encrypted channel as in v2:
 524`{CanonicalPackage, hybridSig?, ballotProof, censusProof?, and — for a revote — the
 525predecessor reference (voteID_t, pkgDigest_t) with its inclusion path}`. The sequencer (and
 526its prover) therefore **learns revote events and predecessor linkage for the votes it seals —
 527the same boundary as v2**, where the sealing sequencer learns which updates are overwrites.
 528It never learns ballots, shares, pads, or `sk`: those stay inside the STARK witness. The
 529batch program receives the predecessor's public data as ordinary host input; the STARK is
 530what makes it *authorized* (nullifier + ownership), and the chain is what makes it
 531*authentic* (vote-ID leaf).
 532
 533**What never enters public data availability:** `hybridSig` (a recoverable signature would
 534link the package to its Ethereum address), the ballot proof, the inner proof's public
 535vector, and the predecessor/revote metadata all stop at the voter→sequencer→guest boundary.
 536Blobs carry only `CanonicalPackage` and the batch-level data of §8.6.
 537
 538---
 539
 540## 6. The ballot proof (Plonky3 STARK)
 541
 542The Groth16 circuit is replaced by a STARK over Goldilocks, proven in the browser via WASM —
 543the production descendant of the davinci-stark prototype [DST], minus its elliptic-curve
 544section. No trusted setup.
 545
 546**Public inputs: the raw public vector.** There is no binding hash (v1.0's `inputsHash` is
 547removed): the proof exposes the public statement **directly as a pinned, ordered vector of
 548Goldilocks elements/limbs** — at least: `version` · `processID` · `packedBallotMode` ·
 549`voteID` · the identity binding (`address` limbs and `pk_PQ` or the legacy branch's
 550`H(sk_pkg)`) · `slot` · `authMode` · `isRevote` · `weight` · all `E` coordinates (ν·16
 551elements) · all `h_i` (ν × 8×32-bit limbs) · `pkgCommit` limbs · `ctsDigest` limbs ·
 552`prevPkgDigest` limbs · `NULL` limbs — **≈ 420+ elements at ν=16**. The vector layout is
 553length-prefixed per ν and never truncates. `ctsDigest = Blake3(cts)` is computed *outside*
 554the circuit and enters as opaque limbs — this **binds** the ciphertext bytes without proving
 555anything about ML-KEM.
 556
 557**Statement contract (normative).** The batch program **constructs the expected public
 558vector itself** — from the canonical package it admits, the authenticated election
 559parameters, the authenticated census data (§8.2), and the predecessor metadata — and
 560verifies the proof against *that* vector. It never verifies a supplied vector and then
 561processes different package data. Inside the AIR, every value used by ballot validation,
 562share generation, masking, commitments and nullifier derivation is constrained equal to
 563these publics, so an admitted package is byte-for-byte the one the voter's proof authorized.
 564`censusRoot` is **not** a ballot public input: membership is the batch program's job (§8.2).
 565Privacy note: the inner proof's public inputs live at the voter→sequencer/guest boundary —
 566they are **not** published in blobs beyond what the package itself already publishes.
 567
 568**The proof shows:**
 5691. **Ballot validity** — v2's ballot protocol (ranges, uniqueness, cost sum vs
 570   `maxValueSum`/weight, `ballotMode` unpacking), with three normative strengthenings over
 571   the v2-era prototype: the weight bound is enforced when `maxValueSum = 0`; all comparisons
 572   use sound borrow-checked integer gadgets (no Goldilocks wraparound); and the cost sum is
 573   computed overflow-safe under the enforced integer-cost profile (§2.3).
 5742. **Share consistency** — for every field (including inactive ones, with constant term 0),
 575   the ν shares lie on one polynomial of degree ≤ θ−1 whose constant term is the ballot
 576   value. Cost: ν·16·(θ−1) ≈ 1.8k multiplications at ν=16, θ=8 — trivial for the AIR.
 5773. **Mask consistency** — $e_{i,f} = s_{i,f} + \mathrm{mask}_{i,f}$ where the 16 masks of
 578   warden $i$ are the LE128-mod-$p$ slices of the single keyed XOF stream
 579   $\mathrm{Blake3.keyed}(K_i, \mathrm{streamCtx}(i))$ (§2.2), with the same $(s_i, K_i)$
 580   committed in $h_i$.
 5814. **voteID derivation** from `(processID, address, k)` (Blake3, §5.2), with all of these
 582   bound in the public vector.
 5835. **Authentication** (§11): knowledge of `sk` with `H(sk) = pk_PQ`, where `pk_PQ` is a
 584   public input that the **batch program** binds to the authenticated census leaf (§8.2) —
 585   census membership itself is *not* proven in the ballot AIR. For an unenrolled hybrid
 586   voter (census `pk_PQ = 0` means "no enrolled key" — the proof never requires
 587   `H(sk_pkg) = 0`): knowledge of the self-chosen `sk_pkg` bound in the chain's first
 588   `pkgCommit` (§11), with identity resting on `hybridSig`. For a revote, additionally the
 589   predecessor opening (same slot, same key), the `NULL` derivation of §5.3, and the chain
 590   counter rule `t_new = t_prev + 1 ≤ maxRevotesPerVoter` (§5.3). Authentication relies on
 591   the proof system's **knowledge soundness**: the proof must establish that the prover
 592   *knows* the preimage/witness (bound to this entire authorized package), not merely that
 593   one exists.
 594
 595**The in-AIR Blake3 section.** All in-circuit hashing runs in a **re-laid Blake3 section**
 596(~25–32 rows per compression at the circuit's width). Honest compression budget under the
 597§2.2 stream-masking definition: per warden ≈ 1 context block + 4 XOF output blocks for the
 598masks + ≥ 4 for $h_i$ (its input is ≥ 219 bytes: processID, registry, voteID, 16 shares,
 599$K_i$, before context fields); plus ≈ 12 for `pkgCommit`, `sharesDigest`, voteID, `NULL`
 600and the counter — **provisionally ≈ 57 compressions at ν=5, ≈ 156 at ν=16**, to be fixed by
 601instrumented counts of the exact canonical encodings for both admission paths (first vote
 602and revote). Earlier drafts said ~45/~110 against a per-field masking rule that would
 603actually have needed ≥ 80/256; the stream rule above is what makes counts this low possible.
 604It MUST constrain full standard-Blake3 semantics, not merely a compression gadget:
 605canonical input bytes, exact lengths and zero padding; correct IV / keyed / `derive_key`
 606initialization per mode; the full 7-round schedule with both feed-forward halves; the
 60764-byte-block and 1024-byte-chunk structure with correct counters and
 608`CHUNK_START`/`CHUNK_END`/`ROOT` flags; correct chaining between compressions; XOF
 609output-block counters (an XOF is a seekable stream, not repeated hashing); outputs
 610constrained equal to the values consumed elsewhere in the AIR; and selector/phase
 611constraints that cannot skip or disconnect any check. (The salt-extended `NULL` input of
 612§5.3 adds ~1 compression on the revote path; the instrumented-count gate of §15 re-counts
 613the budget.) Negative test vectors regenerate
 614otherwise-correct traces with wrong flags, counters, lengths or chaining values.
 615
 616What the proof deliberately does **not** show: that `ct_i` decapsulates to the committed
 617$K_i$. Proving ML-KEM in-circuit would drag SHAKE through the AIR. Instead, mismatched
 618transport is *harmless to integrity* (no tally proof ever runs Decaps — §10.2) and *publicly
 619excludable* (complaints — §9.2). Proving the encapsulation **in-AIR** (§15.1) removes this
 620trade-off entirely and is the main tracked upgrade.
 621
 622**Indicative numbers.** Measured on the prototype [DST]: the Blake3 Merkle/challenger profile
 623proves in **0.69 s native** (vs 3.2 s for the old Poseidon2 profile) with **~324 KB proofs**;
 624a standalone Blake3 compression AIR costs ≈3.4 ms/compression at its wide layout. The
 625full-Blake3 ballot (re-laid in-AIR section) is a **projection, not a measurement**:
 626**~2–4 s native (ν-dependent; the blowup-32 profile costs ~2.7× the old blowup-8 prover time, bought back for the batch guest — §8.1)**, ~195 KB proofs — to be re-benchmarked once the
 627re-laid AIR exists (equal cell counts do not guarantee equal proving cost; the degree and
 628quotient profile must be recomputed). Browser proving is expected at a few × native (mobile
 629slower — to be benchmarked; the proof uploads once to one sequencer and is never stored
 630on-chain). Benchmark provenance: all prototype figures in this document come from internal
 631prototype commits; exact commits, hardware, compiler flags and proof settings will be
 632published with the reference implementation. Standing adoption gates (from review): fix the
 633vendored challenger's wasm32 query-sampler bug; production hiding CSPRNG; implement full
 634Blake3 chunk/tree semantics over the `blake3f` precompile with boundary-length test vectors
 635(0/63/64/65/1023/1024/1025 B); measure real browser and whole-batch guest costs before
 636deployment guarantees. Before `ballotVKHash` is pinned, the **complete proof profile** must
 637be fixed and published: the challenge extension field and its defining polynomial; trace
 638shapes, maximum constraint degree and quotient construction; FRI folding and final-polynomial
 639parameters; hiding dimensions and the blinding-randomness source; the complete Fiat–Shamir
 640transcript (observe/sample schedule, domain-separated initialization, the Merkle-commitment (MMCS) matrix layout and shape
 641checks, serialization); and the knowledge-soundness assumptions with the claimed quantum
 642security model.
 643
 644---
 645
 646## 7. State tree changes
 647
 648Same sparse-Merkle-tree structure, depth 64, same namespaces as v2 — now hashed with
 649**Blake3** (leaf: `Blake3(key_LE8 ‖ value_32 ‖ 0x01)`, node: `Blake3(left ‖ right)`), plus
 650four changes:
 651
 652![State tree v3 layout](figures/state-tree-v3.svg)
 653
 6541. **Vote-ID leaves carry the package digest**: `voteID → pkgDigest` (v2 stored 0). This lets
 655   revotes and complaints authenticate a package *body* against the chain.
 6562. **Slot leaves are chained opaque digests** (no ballot data):
 657   - first vote / overwrite: `leaf = Blake3("davinci-slot-v3" ‖ pkgDigest ‖ s_batch)`
 658   - refresh: `leaf' = Blake3("davinci-refresh-v3" ‖ leaf ‖ s_batch)`
 659   with `s_batch` the sequencer's secret batch seed (proven in-guest, never published — the
 660   same trust class as v2's re-encryption seed). A refresh needs only the **public current
 661   leaf** plus the refresher's own secret, so **any sequencer can refresh any occupied slot**
 662   — permissionless sequencing is preserved and a vanished sequencer blocks nothing. Both
 663   update types produce fresh-looking 32-byte values; this plus the padded accumulator is
 664   what replaced re-encryption-based silent revoting.
 6653. **Config namespace**: `0x3` = `wardenSetHash` (§4) instead of an encryption key; `0x4` =
 666   `Blake3(A)` (the accumulator value itself is published in every batch's blobs); `0x5`
 667   (reserved in v2) = the root of the **nullifier tree**, a dedicated Blake3 SMT of depth
 668   256. A nullifier is a 32-byte Blake3 digest used directly as the 256-bit key; leaf
 669   value = 1. **`0x8` (reserved in v2) = `viewsRoot`, the per-warden column-view commitment
 670   of §8.7**, updated by every transition (`0x6` is `censusOrigin`, inherited from v2 — not
 671   reusable).
 6724. **Genesis predicate replaces on-chain genesis computation.** The EVM has no Blake3
 673   precompile, so the registry no longer computes the genesis root itself. Instead it stores
 674   the election parameters and an **initialization flag**, and the **first transition's batch
 675   proof constructs the genesis tree deterministically in-guest** from the registry-supplied
 676   parameters — the canonical empty tree plus *exactly* the prescribed config leaves, the
 677   zero accumulator in its prescribed encoding, an empty nullifier tree, **the pinned
 678   empty-view encoding of leaf `0x8` (per-warden `viewAcc[i, genesis]` over canonical
 679   empty-batch `rowsDigest`/`payloadDigest` encodings — §8.7)**, no slots, no
 680   packages, correct initial counters — and proves `oldRoot` equals that construction.
 681   Membership proofs under a prover-chosen root are **never** accepted as a substitute (they
 682   show presence, not absence of extra state). Registry rules: the genesis branch is
 683   selected by the stored initialization flag (never caller input); parameters come from
 684   registry storage, not calldata; the first transition and initialization are recorded
 685   atomically; thereafter `oldRoot == storedRoot` always, and re-initialization is
 686   impossible; the outer proof binds the full `(chainID, registry, processID)` (not just
 687   v2's 4-byte prefix); and an **initialization-only transition** (zero ballots) is an
 688   explicit path so empty elections can still finalize.
 689
 690---
 691
 692## 8. The batch program (ZisK guest)
 693
 694In one line: the batch program is the referee — it re-checks every vote package, applies the
 695state updates, and maintains the masked running total.
 696
 697Same role, same settlement flow, same public-output pattern (`ok`/`failMask`, old/new roots,
 698counters, census root, blobs digest) as v2. The constraint groups change as follows.
 699
 700![Batch program v3 dataflow](figures/batch-flow.svg)
 701
 702### 8.1 Ballot proof verification — measured cost, honest sizing
 703Verifies the n ballot STARKs **in-guest**. This cost has now been **measured on the real
 704emulator** (a ZisK guest running the Plonky3 verifier on an actual ballot proof; internal
 705prototype — exact commits/hardware/flags to be published with the reference
 706implementation, §6), and it is
 707the dominant cost of the v3 batch program — far above the earlier modeled figure, because
 708hashing turns out to be a minor component: at the pinned profile (§2.3) one verification
 709costs **≈14.5M guest steps** (22.1M at the former blowup-8/34-query profile), of which
 710hashing via the `blake3f` precompile is only ~1.5M (4,681 compressions); the rest is FRI
 711field arithmetic, Merkle path bookkeeping, the symbolic constraint rebuild (1.49M,
 712**amortized once per batch** since all proofs share one AIR), and proof deserialization.
 713Two further optimizations are **normative implementation requirements**: Goldilocks
 714inversions use ZisK `fcall` hints (hint + multiply check, replacing ~1.4k-step software
 715inversions — the mechanism ZisK already uses for secp256k1/BN254 inverses), and opened rows
 716are hashed as words, not per-byte streams. **GPU-measured** (RTX 5090,
 717cargo-zisk 1.3.0-alpha, this exact profile, after a reviewed no-precompile optimization
 718pass — per-batch setup hoisting, the existing `uint256_inv_mod` fcall as the Goldilocks
 719inverse hint, word-level hashing, and a differentially-tested fork of the FRI verifier
 720factoring query-independent sums): per-proof cost fell from 14.45M to **2.62M steps**
 721(−82%), and proving the verification of 1 / 8 / 32 proofs takes **10.4 / 12.5 / 19.8 s** —
 722a ≈10 s fixed pipeline plus **≈0.30 s marginal per verification**, i.e. ≈1.6
 723verifications/s at K=32 and a projected ≈2.7/s at K=128 per GPU. A 256-ballot batch's
 724verification layer proves in ≈1.5–2 minutes; the fixed pipeline cost, not per-ballot work,
 725now dominates.
 726With the amortization and inverse hints above (and a proposed upstream Goldilocks-ext²
 727precompile), ~1 verification/s/GPU is the modeled target. Practical batch sizes today:
 72832–128 ballots for v2-like latency, 256 where ~8-minute batches are acceptable; throughput
 729scales across provers as in v2 — the price of post-quantum ballots is paid in parallelizable
 730sequencer GPU time, not voter experience. The guest implements Blake3's chunk/tree layout
 731over the compression syscall; Merkle parents are `BLAKE3(left ‖ right)`. The ballot verifier
 732configuration (AIR identity, FRI profile, transcript and hash profile) is pinned via
 733`ballotVKHash` at config leaf `0x7`, as in v2, and the guest constructs each proof's expected
 734public vector per the §6 statement contract.
 735
 736### 8.2 Census, authentication, binding
 737Census membership is verified **here**, as in v2 (not in the ballot AIR): the program
 738authenticates the census leaf `Blake3(address ‖ weight ‖ pk_PQ)` with a Merkle path under an
 739accepted root, derives the slot by the census-origin rule, and proves the **join equality**:
 740
 741$$\text{ballot publics } (\text{identity key},\, weight,\, slot,\, authMode) \;=\; \text{authenticated census values and policy}$$
 742
 743The census root it checks is bound in the **batch statement** and must be accepted under the
 744election's origin-specific registry policy — never chosen freely by the prover. `authMode` is
 745derived from the immutable election auth policy plus the creation-time enrollment snapshot
 746(§11) and compared against the proof's public input — never prover-chosen. Authentication
 747then follows the policy: `pq-only` relies on the in-STARK preimage proof alone; `hybrid`
 748*additionally* verifies `hybridSig` (ECDSA over `pkgDigest`, secp256k1 precompile, recovered
 749address = census address) for every package; `hybrid-legacy` dispatches per census leaf as
 750specified in §11. The program recomputes `ctsDigest` and `pkgDigest` from the package body
 751and constructs the proof's full expected public vector from that body (§6 statement
 752contract) — so an admitted package is byte-for-byte the one the voter's proof authorized.
 753
 754**On-chain censuses and the PQKeyRegistry (origin 3).** Contracts cannot hash Blake3
 755cheaply, so on-chain censuses maintain an incremental **keccak256 running commitment** of
 756their authorized registrations (one `keccak256(prev, entry)` per registration — Solidity-
 757native). A permissionless **census-root conversion proof** — a small ZisK guest — attests
 758"running commitment `c` corresponds to Blake3 lean-IMT root `r`"; the registry verifies it
 759and stores the accepted `(c, r)` pair, and batches then use `r` under the origin-3 root
 760policy. No unauthenticated off-chain root ever enters the system.
 761
 762### 8.3 State transitions
 763In fixed order, each proven against the previous root, as v2: (1) insert
 764`voteID → pkgDigest`; (2) insert revocation nullifiers with the one-live-chain checks of
 765§5.3 (predecessors must be settled under the starting root); (3) write slot leaves (votes +
 766overwrites), then refresh the sample $\mathcal{R}$ (§7.2; sample-size rule as v2); (4) update
 767`0x4` with the new accumulator digest, `0x5` with the new nullifier root, **and `0x8` with
 768the new `viewsRoot` (§8.7) — atomically with the rest of the batch state. Zero-ballot and
 769initialization-only transitions update `0x8` like any other batch.**
 770
 771### 8.4 Accumulator update and the batch pad
 772$$A' = A + \sum_{\text{new pkgs}} E \; - \sum_{\text{consumed pkgs}} E \; + \; B$$
 773
 774In words: the new accumulator is the old one, plus the masked shares of every package this
 775batch adds, minus the masked shares of every package it revokes, plus a fresh secret pad $B$
 776whose only job is to hide *which* rows were subtracted.
 777
 778Here $B \in \mathbb{F}^{\nu \times 16}$ is a fresh **uniform** batch pad derived in-guest
 779from the secret batch seed. Without $B$, the public batch delta minus the (public) new-package
 780sums would equal $-\sum_{\text{consumed}} E$, letting anyone identify revoked packages by
 781matching public `E` rows. $B$ is deliberately *unstructured* — a Shamir-codeword-shaped pad
 782would vanish under the code's public parity checks and leak the same information.
 783
 784### 8.5 The warden payload (KEM-DEM, proven)
 785Per batch, the guest: derives a 256-bit batch key $k_b$ and the ML-KEM encapsulation
 786randomness from the secret batch seed (guest-internal derivation under the pinned program, so
 787it is as trustworthy as the proof itself); DEM-encrypts (§2.1)
 788`payload = (B ‖ consumed pkgDigests ‖ context)` under $k_b$; Shamir-shares $k_b$
 789**coordinate-wise over its 32-bit limbs** θ-of-ν; and for each warden $i$: one in-guest
 790ML-KEM encapsulation to $pk_i$ → wrapping secret → DEM-encrypts share $i$, and publishes a
 791salted Blake3 **commitment to each recipient's share** (opening salts travel inside the
 792respective DEM ciphertexts; these commitments are what lets tally participants validate
 793forwarded shares in §10.4 without decapsulating each other's ciphertexts). The proof binds
 794$B$ to the accumulator update, the consumed list to the nullifier insertions, every
 795ciphertext to its registered recipient key and context, and the share commitments to the
 796shared $k_b$. **Unlike voter transport, a malformed
 797batch payload is unprovable, not merely complainable** — it would hide an accepted
 798transition's revocations and pads from the tally. All of it is published in the batch's blobs.
 799
 800### 8.6 Blob layout v3 and honest DA numbers
 801Blob cells carry 31 payload bytes each (a v3 codec choice — v2 packed typed values; v3 packs
 802an opaque byte stream per section), 4096 cells per blob ⇒ 126,976 B per blob. Sections, in
 803order: header · new packages (CanonicalPackage bytes) · slot-update list
 804(slot index 8 B + new leaf 32 B — so a refresh costs 40 B framed, vs ~1–2 KB in v2) ·
 805nullifiers (32 B each) · accumulator value $A'$ (ν·16·8 B) · warden payload (§8.5).
 806Byte-exact cell maps live in the davinci-zkvm normative docs, as in v2. One divergence from
 807v2's blob flow: the evaluation point becomes
 808$z_b = \mathrm{keccak256}(\text{processID} \,\|\, \text{stateRoot}^{old} \,\|\, \text{blobCommitment}_b) \bmod q_{BLS}$
 809— keccak because the **registry contract** computes it (Solidity-native; the guest recomputes
 810it via the keccak precompile, one call per blob — a §2 island).
 811
 812Per-package size: `72 + ν·(160 + ct_len)` bytes (72 B fixed fields; per warden: 128 B of
 813masked shares + 32 B commitment + one ciphertext) ⇒ **20,040 B** at ν=16/ML-KEM-768;
 8146,312 B at ν=5; 1,320 B at ν=1 (all ML-KEM-768 — the only allowed transport, §2).
 815
 816| Profile (256 votes + 256 refreshes) | batch bytes | blobs (126,976 B each) | vs v2 (~5 blobs) |
 817|---|---|---|---|
 818| **ν=8, ML-KEM-768 (v3.0 max)** | ≈ 2.6 MB | **≈ 21** | ~4× |
 819| ν=5, ML-KEM-768 | ≈ 1.7 MB | ≈ 14 | ~2.7× |
 820| ν=1 (sequencer mode) | ≈ 0.35 MB | ≈ 3 | ~0.7× — *cheaper than v2* |
 821| ν=16, ML-KEM-768 (future profile) | ≈ 5.2 MB | ≈ 41 — exceeds the 32-blob cap ⇒ ~195 votes/batch, or the tracked multi-recipient-Kyber transport (§15.5: package 72 + 16·160 + 960 + 16·128 = 5,640 B ⇒ ≈ 12 blobs) | ~8× |
 822
 823**The two settlement modes reach the same 32-blob cap — by different mechanisms.**
 824**L1-blob mode** posts blobs across multiple Ethereum transactions and proves their chain
 825inclusion on the rollup, as v2's OP-Stack path. **Native blob mode** is no longer limited
 826to one blob-carrying transaction (EIP-7594's 6 blobs): a state transition may be published
 827as a **sequence of blob transactions followed by the settlement call**. Each blob
 828transaction calls `registerBlobs(processID, batchSeq, index)` on the registry, which reads
 829its own transaction's versioned hashes via the `blobhash` opcode — the only trustworthy
 830on-chain binding between a versioned hash and an actually-published blob — and records them
 831— with the registration **block number** — keyed by `(processID, msg.sender, batchSeq,
 832index)` (never a caller-supplied identity). Rules, all reverting on violation (reviewed;
 833conditions incorporated):
 834- **Freshness.** A registration set snapshots the current state root; a root change
 835  invalidates it immediately (a lost race kills the set, not merely the next
 836  registration). Settlement must land within a **maximum registration age** safely inside
 837  the DA-retention window — stored hashes prove *historical publication*, not *present
 838  availability* — and wardens/observers collect pre-published blobs from registration
 839  time, not settlement time.
 840- **Exact manifest.** Indices are batch-global (0..nBlobs−1, ≤ 32), slots immutable and
 841  non-overlapping once written, `blobhash` values nonzero; the settlement transaction's
 842  own blobs fill the remaining indices in ascending order (one deterministic merge rule);
 843  every position the proof's blob count requires must be present in the exact proof-bound
 844  order — gaps, overlaps, reordering and partial settlement revert. `batchSeq` is per
 845  `(processID, sender)`, monotonic and non-wrapping; consumed sequence numbers are never
 846  reusable. Verification, root update and consumption are atomic.
 847- **Storage lifecycle.** One bounded active manifest per (sender, process); slots are
 848  reused or explicitly deleted; expired records are permissionlessly cleanable in bounded
 849  batches; registrants pay registration gas (≈640k gas of fresh SSTOREs for a full
 850  32-slot manifest), cleanup is deposit/bounty-funded, and no settlement or lifecycle
 851  path ever iterates over all registrants.
 852Per-sender keying prevents another sender from occupying this sender's registration slots
 853— it is not a general anti-griefing claim. For every manifest position the registry
 854preserves the full binding chain: stored versioned hash → commitment via the
 855point-evaluation precompile → `z_b = keccak(processID ‖ stateRoot_old ‖ commitment)` with
 856`stateRoot_old` required to equal the current root → the proof-bound ordered blob digest.
 857Cross-transaction publication therefore adds **no new KZG assumption**. The first 6 blobs
 858may still ride the settlement transaction itself; native mode supports every v3.0
 859profile, and small batches settle exactly as in v2 with zero extra transactions.
 860
 861**The archive manifest chain.** On every accepted transition the registry folds the batch
 862into a contract-side running accumulator,
 863`archiveAcc' = keccak256(archiveAcc ‖ batchNumber ‖ stateRoot_new ‖ blobsDigest)` (keccak: it
 864is contract-computed — the island rule), and stores `(archiveAcc, batchNumber)`. At the
 865exclusion freeze this pair is frozen with the tally snapshot. It authenticates the ordered
 866batch **manifest**; actual blob bytes are authenticated by their commitment/versioned-hash
 867bindings (§4), and the §8.7 views are bound transitively through each `stateRoot`.
 868
 869DA is v3's main cost regression and is linear in ν: size committees to the election's
 870stakes. The tracked reduction path is **multi-recipient Kyber** (§15.5): one shared 960 B
 871component plus 128 B per warden ⇒ transport 1,984 B at ν=8 (vs 8,704 B), package
 87210,056 → 3,336 B — a ~3× DA cut with ML-KEM security assumptions. (v1.2 tracked Classic
 873McEliece here; withdrawn — BSI's 2026-09 guidance advises against it in new developments and
 8742026 cryptanalysis reduced its margins, while its 0.26–1 MB public keys were a poor browser
 875fit anyway.)
 876
 877### 8.7 Per-warden column views (normative)
 878
 879The batch guest already touches every admitted package; this section makes that work
 880reusable so warden tally proofs never re-hash full `CanonicalPackage` bytes and never re-fold
 881the full blob archive (it replaces the per-warden archive re-fold of earlier drafts and
 882satisfies what v1.2 tracked as upgrade 7). For each admitted package $v$ and warden $i$ the
 883guest emits, in canonical admission order, the 232-byte
 884
 885```text
 886ColumnRecord(v, i) = voteID (8 B) ‖ pkgDigest (32 B) ‖ E[i][1..16] (128 B, canonical LE)
 887                     ‖ h[i] (32 B) ‖ Blake3(ct[i]) (32 B)
 888```
 889
 890(`pkgDigest` is load-bearing: the exclusion set $X$ and consumed set $R$ identify packages by
 891digest, so the record certifies the join between identity and row.) Per batch $b$ it computes
 892the domain-separated commitments of §2.2's `viewCtx` family:
 893
 894- `rowsDigest[b,i]` — hash of the ordered ColumnRecords of batch $b$ for warden $i$;
 895- `payloadDigest[b]` — hash of the batch's **complete encrypted §8.5 payload envelope**
 896  (ciphertext, tag, context, per-share commitments, wrapping material). **Never a digest of
 897  plaintext consumed IDs — a deterministic plaintext fold is enumerable (one consumption
 898  among $n$ candidates ≈ $n$ trials) and would leak the revoked set;**
 899- `viewAcc[i,b] = Blake3(viewCtx_acc ‖ i ‖ b ‖ viewAcc[i,b−1] ‖ admittedCount[b] ‖
 900  rowsDigest[b,i] ‖ payloadDigest[b])`;
 901- `viewsRoot[b] = Blake3(viewCtx_root ‖ batchCount ‖ totalAdmitted ‖ ν ‖ ordered
 902  (i, viewAcc[i,b]))` — stored at config leaf `0x8` (§7).
 903
 904Guest obligations: every projected value is derived from the **same** `CanonicalPackage` the
 905guest admits and publishes; it computes `pkgDigest` and each ciphertext digest itself; every
 906admitted package appears exactly once, in published order; every accepted batch — including
 907zero-ballot and initialization-only transitions — folds its (possibly empty, canonically
 908encoded) `rowsDigest`/`payloadDigest`; the `0x8` update is atomic with the rest of the batch
 909state. Cost: ≈ ν·(18 + 3.9) Blake3 compressions per admitted package (~110 at ν=5, ~175 at
 910ν=8) plus bounded per-batch work — the ciphertext digests (18 compressions each) dominate.
 911
 912No new blob bytes are required: observers and archive providers reconstruct every
 913`ColumnRecord` deterministically from the published `CanonicalPackage` bytes, so views are a
 914*commitment layout*, not extra published data. The registry retains the per-batch
 915`(batchNumber, viewsRoot)` checkpoints it has accepted — bounded storage, one slot per batch,
 916retained until election finalization plus the complaint window, then permissionlessly
 917cleanable (same lifecycle standard as the §8.6 manifests) — because early complaints (§9.2)
 918prove against historical accepted checkpoints, not the moving current root.
 919
 920Regression tests (normative, from review): omit/duplicate/reorder/substitute one record or
 921batch; change `pkgDigest` keeping the row; substitute another warden's row or ciphertext
 922digest; replay a view across elections/epochs/profiles/recipient indices; omit a payload
 923(incl. a zero-ballot batch's); derive $R$ differently from the authenticated payloads; verify
 924no plaintext consumed-list digest appears in any public transcript or continuation state; and
 925check the §10.1 formula equivalence (accumulator-subtraction form vs direct active-share
 926summation).
 927
 928---
 929
 930## 9. End of election: freeze, complaints, exclusions
 931
 932The v2 timeline (end → grace window) gains two phases before results:
 933
 934![Election timeline v3](figures/timeline.svg)
 935
 936### 9.1 Casting freeze
 937When the grace window closes the registry stops accepting transitions (as v2) and the
 938accumulator freezes as $A_{\text{cast}}$, bound to the frozen final root.
 939
 940### 9.2 Complaints and the exclusion set X — open from admission
 941**Complaints may be filed from the moment a package settles**, throughout the voting period
 942and until the complaint deadline after the casting freeze (the deadline remains an election
 943parameter). This is safe because $X$ is **idempotent and append-only** and complaints
 944**never touch the accumulator** — no complaint needs to know whether its package was already
 945consumed, and ordering cannot matter. The payoff is voter recovery: an honest voter whose
 946package carried broken transport (a buggy client) learns while casting is still open and
 947simply **revotes** — the replacement consumes the excluded-but-admitted predecessor exactly
 948like any revote (the predecessor ends in $X \cap R$, which §10.1's $X \setminus R$ term
 949handles with no double subtraction — verified algebraically). In v1.2 the same voter
 950discovered the exclusion only after casting closed, unrecoverable.
 951
 952Mechanics: **registered wardens of the election** submit
 953`submitComplaint(processID, pkgDigest, publicValues, proof)` where the ZisK proof shows
 954`Decaps(sk_i, ct_i)` yields a key inconsistent with the package's admitted $h_i$ (witness:
 955the warden's registered key seed; statement bound to the admitted `pkgDigest` and a
 956**registry-retained accepted checkpoint** — §8.7 — never the moving current root, so settled
 957batches cannot invalidate a complaint in flight). The decapsulation is fully constrained
 958in-guest, including implicit rejection and the full-ciphertext constant-time FO comparison
 959(§2); host-provided hints are not acceptable. A complaint proof MAY cover **many packages at
 960once** (chunkable, with the full continuation state authenticated between chunks); it proves
 961that **every reported package is malformed toward the complaining warden — never that
 962unreported transports are valid** (that would force decapsulation proofs over honest
 963packages; the final contribution proof independently requires valid openings for everything
 964it counts). The submitter pays gas.
 965
 966Normative exclusion semantics: **exclusion never resets slot occupancy, never restores an
 967earlier package, never refunds the chain counter, and never modifies the casting
 968accumulator.** A voter whose *live* package ends up in $X$ after casting closes is not
 969counted (their earlier packages stay consumed) — a deliberately malformed revote is a
 970provable self-abstention, and a voter+warden coalition retains a bounded post-close
 971withdrawal option for that voter's own ballot. A package malformed toward warden $i$ that is
 972*not* excluded still tallies correctly from wardens that can open it (§10.2) — a voter may
 973even re-supply the opening out-of-band; warden $i$ either complains in time or sits out.
 974
 975Honest framing of the timing channel: early complaints **improve recoverability without
 976creating any false-exclusion capability** (a complaint against well-formed transport cannot
 977be proven), but they add observable signals — complaint timing and the voter's reaction are
 978public, and a malicious warden can deliberately delay a valid complaint past the point of
 979recovery or use its timing as a side channel. This is documented leakage, not an integrity
 980risk (§12.3).
 981
 982**Capacity is sized to the workload, not an arbitrary cap**: with
 983$N = \texttt{maxVoters} × (1 + \texttt{maxRevotesPerVoter})$ (§2.3, enforced in-proof) and
 984$M ≤ N + 1$ accepted batches (§2.3), the budget per participating warden is: one
 985scan/decapsulation pass over up to $N$ packages, column-view authentication, **a proven
 986decapsulation per reported fault** (worst case $q_i = N$, and up to $νN$ reported faults
 987across wardens — batching removes per-complaint transaction and verification overhead, NOT
 988the decapsulations), plus proof generation, publication and settlement. The complaint
 989deadline must cover the worst-case residual scan + proving + publication + inclusion with
 990margin — it is not a fixed "one proof" delay. This remains an explicit liveness assumption
 991(§9.3), not an exceptional path. At the deadline $X$ freezes on-chain; every tally proof
 992binds the frozen $(\text{root}, A_{\text{cast}}, X)$ snapshot.
 993
 994### 9.3 Liveness
 995The tally needs at least θ wardens (the tally threshold) that complete the scan (and any
 996complaints) inside the window, complete the ceremony (§10.3–10.4), and publish proven
 997contributions — plus, as in v2, timely inclusion of their transactions, **plus complaint
 998capacity (proving + fees + deadline length) provisioned for the election's admitted-cast
 999bound in the worst case (§9.2)**, **plus at least one complete, available archive of the
1000election's published history** (§4): blobs prune after ≈18 days, so the history must be
1001captured live (native-mode blobs from registration time); providers are untrusted — all data
1002is authenticated against the chain commitments — but a sole provider can halt progress by
1003withholding, so redundancy is operational prudence. Availability must span the casting
1004period, the complaint deadline, **every** tally attempt, and the declared retention period,
1005and must include ceremony and complaint publications; reorganizations and archive catch-up
1006time eat into deadlines and must be budgeted. Missing payload history means the tally cannot
1007complete. Honest v2 comparison: v2 also requires post-pruning archival for anyone replaying
1008the election, but v2 wardens tally from one authenticated final accumulator — **v3's
1009dependence of tally completion on the complete history is strictly stronger**.
1010Fewer ⇒ results are lost, exactly as v2's "θ of ν wardens take part in decryption".
1011
1012---
1013
1014## 10. Tally: warden sums and Lagrange
1015
1016In one line: this is where the masked running total becomes the election result — in public,
1017with proofs, and without any decryption key.
1018
1019### 10.1 What each participating warden computes
1020After the exclusion freeze, each participating warden $i$:
10211. holds its complete **column view** (§8.7) and the batch payload history — fetched from any
1022   untrusted archive provider and authenticated against the chain commitments, or retained
1023   locally (§4; work is linear in *total casts*, not final voters, and decapsulation/share
1024   recovery MAY run incrementally during the voting period);
10252. decapsulates its per-package ciphertexts (full-ciphertext constant-time FO comparison,
1026   §2), regenerates each package's mask stream
1027   ($\mathrm{Blake3.keyed}(K_{v,i}, \mathrm{streamCtx}(i))$, §2.2), recovers shares
1028   $s_{v,i,f} = e_{v,i,f} - \mathrm{mask}_{v,i,f}$, and checks each against
1029   the admitted $h_{v,i}$;
10303. joins the **tally ceremony**: the participants exchange batch-payload-key shares via
1031   **signed, encrypted bundles on the public DA path — plaintext shares never public**
1032   (§10.4), reconstruct the per-batch payload
1033   keys (θ shares each), decrypt the payloads — obtaining every batch pad $B$ and the full
1034   consumed set $R$, verified against the batch proofs that committed them — and run the
1035   zero-blinding round producing $G_f$ (§10.3);
10364. computes, over $\mathrm{Active} = \mathrm{Admitted} \setminus (R \cup X)$:
1037
1038$$S_{i,f} = A_{\text{cast},i,f} - \sum_{v \in X \setminus R} e_{v,i,f} - \sum_{v \in \mathrm{Active}} \mathrm{mask}_{v,i,f} - \sum_{b} B_{b,i,f} + G_f(i)$$
1039
1040In words: start from the frozen running total; remove the rows of excluded-but-never-revoked
1041packages; strip your own masks for every counted package; strip the batch pads; add your
1042blinding share.
1043
1044One-line sanity check: $A_{\text{cast}}$ = (masked shares of all admitted-minus-consumed
1045packages) + (all batch pads); removing the still-present excluded rows, all pads, and all
1046batch pads leaves exactly $\sum_{\mathrm{Active}} s_{v,i,f}$; adding $G_f(i)$ with
1047$G_f(0)=0$ doesn't change the interpolation at 0.
1048
10495. publishes $S_i$ with a **ZisK proof** whose statement binds: the election, the frozen
1050   $(\text{root}, A_{\text{cast}}, X)$ snapshot, **the frozen terminal view checkpoint
1051   `(batchCount, viewsRoot)` of §8.7** — registry-selected, never warden-supplied
1052   (consistency with a chosen list is not completeness) — its recipient index, and the
1053   accepted ceremony transcript (§10.3–§10.4); and whose witness contains its KEM key seed
1054   (authenticating it as warden $i$ against the registered commitment), the per-package
1055   $(s, K)$ openings **for every counted active package** (each checked against its admitted
1056   $h_{v,i}$), the reconstructed payload keys and payload openings, and its blinding
1057   evaluations. The program processes warden $i$'s **column records and the authenticated
1058   batch payloads** — never full `CanonicalPackage` bytes, and never a re-fold of the blob
1059   archive (the chain of accepted batch proofs already certifies column completeness; the
1060   registry's `archiveAcc` binds the views transitively through each `stateRoot`) — and
1061   enforces **complete, exactly-once processing** of every admitted package (counted,
1062   consumed, or excluded — nothing skipped), reaching the frozen terminal `viewsRoot` and
1063   counts. Payload keys are authenticated by reconstruction from **θ distinct original
1064   committed share openings** (§8.5) followed by DEM verification — successful decryption
1065   under an arbitrary supplied key proves nothing; recovered key limbs must satisfy the
1066   32-bit limb encoding; and $R$ is derived from **all** authenticated payloads, never from
1067   host-supplied flags. (A tally proof opens $h_{v,i}$ — it never hashes actual ciphertext
1068   bytes; only complaint proofs do.) For scale, chunked proving authenticates its
1069   **continuation state** — progress ordinal, the running `viewAcc` AND the partial sums —
1070   between segments; carrying a hash alone does not certify earlier computation, and no
1071   continuation state may contain a plaintext consumed-list digest (§8.7).
10726. `submitTallyShare(processID, i, S_i, publicValues, proof)`; after θ verified shares,
1073   anyone calls `finalizeResults(processID)`: **the registry performs the Lagrange
1074   interpolation on-chain** (θ ≤ 16 points over Goldilocks — a few u64 mulmods per field),
1075   records the per-field results, and emits `ProcessResultsSet`.
1076
1077Wardens run their **own provers**: the witness contains their secrets, and a shared proving
1078service used by θ wardens would itself hold reconstruction capability. Untrusted public
1079*preparation* is fine — anyone may pre-build columns, manifests and lookup structures, since
1080the proof authenticates their use against the frozen commitments — but nothing holding secret
1081witnesses may be outsourced. Proving cost scales with total casts. With the §8.7 column
1082views, the per-package work is ≈3.9 compressions of public view authentication plus **≈9–13
1083private compressions** (mask-stream regeneration + the $h_{v,i}$ opening; provisional until
1084serialization is pinned) — a million-cast tally job is on the order of **13–17M compressions
1085plus payload/ceremony verification and bookkeeping**, versus the >10^8 of v1.2's
1086full-package re-hashing: **≈6–8× fewer compressions (compression counts, not end-to-end
1087runtime — an unvalidated projection to be benchmarked before warden hardware guidance is
1088given)**.
1089
1090### 10.2 Why malformed voter transport cannot corrupt anything
1091**Decapsulation never appears in any tally proof** — contributions open the admitted
1092commitments $h$ instead, and under commitment binding every accepted $S_i$ lies on the same
1093aggregate polynomial. A voter publishing a bad `ct_i` only deprives warden $i$ of its opening
1094witness (warden $i$ complains or sits out; the voter could even re-supply the opening
1095out-of-band, which is safe — correctness is tied to $h$, not to the transport). Every clean
1096θ-subset interpolates the same tally, because the ballot STARK proved all ν shares lie on one
1097valid polynomial. Malformed transport is an availability lever against one warden, never an
1098integrity lever against the election.
1099
1100### 10.3 The zero-blinding ceremony
1101In plain terms: before publishing their partial sums, the participating wardens jointly add
1102noise that cancels out exactly at the finish line (x = 0), so the published sums reveal the
1103result and nothing else. Why it's needed: published raw, θ sum-shares determine the aggregate
1104polynomial $F$; any single warden — participant or not — could evaluate it at its own index,
1105compare with the sum of its decoded per-package shares, and fingerprint the revoked set. The
1106ceremony prevents that:
1107
11081. A `tallySession` is recorded on-chain: session id = `H(processID ‖ root ‖ X ‖ roster ‖ attempt)`, where `attempt` is a **registry-controlled monotonic nonce** incremented on every restart (the id must change even with an identical roster and snapshot); the registry tracks exactly one active attempt and rejects messages and contributions bound to stale attempts. Three sets are distinguished (§10.4): the **roster $P$** (all eligible wardens that join by the roster deadline, $|P| \ge \theta$ — it MAY exceed θ, and should: extra members are failure margin), the **accepted dealer set $D \subseteq P$** (frozen at the dealer deadline, $|D| \ge \theta$ required so at least one accepted dealer is honest under the $f < \theta$ corruption bound), and the **contributor subset $C$** (any θ roster members with valid contributions). Candidate dealers are the roster; blinding evaluations are delivered **only to the frozen roster — never pre-dealt to all ν wardens or to future replacement candidates** (pre-dealing would hand every warden its $G(i)$, letting any single non-participant strip the blinding at its own index and fingerprint the revoked set — a confirmed attack).
11092. Each dealer $k$ samples a seed and derives, per field, blinding coefficients
1110   $c_{k,f,1..\theta-1}$, defining $g_{k,f}(x) = \sum_j c_{k,f,j} x^j$ — **the constant term
1111   is structurally absent, so $g_{k,f}(0) = 0$ by construction** (this is the
1112   "zero-certificate": the committed coefficient vector simply has no degree-0 entry).
11133. Dealer $k$ publishes (in a session blob): a hiding commitment to its coefficients
1114   (salted unkeyed Blake3, §2.3); **per-recipient hiding evaluation commitments**
1115   $cm_{k,i} = \mathrm{Blake3}(g_{k,1..16}(i) \,\|\, r_{k,i})$; the KEM-DEM ciphertexts to each
1116   co-participant $i$ encrypting $(g_{k,1..16}(i), r_{k,i})$; and a **ZisK dealer proof**
1117   that the committed coefficients, the evaluation commitments, and the ciphertexts are all
1118   consistent, under the recipients' **ephemeral session keys** (§10.4) and this session's
1119   context.
11204. Contributions use $G_f(i) = \sum_{k \in D} g_{k,f}(i)$ over the **accepted dealer set
1121   $D$** — fixed on-chain after the dealer deadline and **immutable thereafter: a dealer
1122   whose publication is missing or invalid before the deadline simply doesn't enter $D$
1123   (margin), and once $D$ is frozen, a member's later unresponsiveness never removes its
1124   polynomial** (removing it would put contributions on different blinded polynomials and
1125   corrupt the interpolation); every contribution proof binds the same $D$ and session id,
1126   and **opens the evaluation commitments $cm_{k,i}$** (the recipient learned the opening by
1127   decapsulating off-circuit — decapsulation still never enters any tally proof). Only if
1128   $|D| < \theta$ at the deadline does the session restart with fresh masks.
1129
1130As long as one accepted dealer is honest, no one outside the ceremony — and no
1131non-participating warden — learns anything about $F$ beyond what the public tally
1132$F(0)$ itself reveals. Participants do jointly learn the
1133revoked set $R$; that is the documented θ-gated metadata leakage (§12.2).
1134
1135### 10.4 The batch-key exchange and the session state machine
1136
1137The batch-payload keys $k_b$ (§8.5) are θ-of-ν shared; **reconstructing them must not leak
1138them**: publicly releasing enough shares of any $k_b$ reveals $B_b$ and the consumed-package
1139list — exactly the revocation metadata the batch pads exist to conceal. The ceremony is
1140**four one-shot signed publications** — no pairwise request/response on the success path:
1141
11421. **Join.** Each participating warden joins the session, publishing a **fresh ephemeral
1143   ceremony ML-KEM keypair for this attempt**, signed with its registered SLH-DSA key (§4).
1144   **Long-term warden keys MUST NOT be the recipients of ceremony ciphertexts**, and the
1145   ephemeral secret MUST be destroyed once the tally finalizes (§15's key-destruction
1146   guidance applies to ceremony keys with highest priority). Why: the bundles below are
1147   published on a DA path and archived forever — if they were encrypted to lifetime keys, a
1148   *single* participant's later key compromise would reveal ≥θ shares of every $k_b$, i.e.
1149   every pad $B$ and the full consumed set $R$, from the public archive alone (§12.2).
1150   Ephemeral keys restore "steal a key later ⇒ learn nothing" for honest-deleting
1151   participants. Roster $P$ freezes at the join deadline ($|P| \ge \theta$).
11522. **Dealer bundles** (§10.3), $D$ frozen at their deadline.
11533. **Share bundles.** Each participant publishes ONE signed, authenticated logical bundle
1154   (envelope context `cerCtx`, §2.2) containing, per co-participant and per batch, the
1155   KEM-DEM encryption (to the recipient's *ephemeral* key) of its §8.5 share of $k_b$ plus
1156   that share's commitment salt. Publication is on a **publicly verifiable DA path** so
1157   missing-message timeouts are objective ("I sent it privately" proves nothing); one
1158   logical bundle may span multiple transactions/blobs. A recipient **validates every
1159   received share against the batch's published per-share commitments** (§8.5) before use —
1160   an invalid opening is simply ignored; any θ valid distinct shares reconstruct each $k_b$
1161   (recipient decapsulations follow the §2 full-ciphertext constant-time FO rule).
1162   Signatures give authorship attribution; the protocol still does **not** claim publicly
1163   verifiable fault attribution for encrypted contents (a signature proves who sent a
1164   ciphertext, not what it decrypts to; confidential ZK fault proofs are a tracked
1165   hardening, §15) — faults are absorbed by **margin**, and fault adjudication is never on
1166   the successful tally's critical path.
11674. **Contributions** (§10.1 step 5): any θ valid contributions from roster members, all
1168   bound to the same snapshot, attempt, and frozen $D$.
1169
1170Plaintext key shares and reconstructed keys never appear on-chain or in blobs; contribution
1171proofs reference the payload *openings* (witness), not the keys.
1172
1173**Session state machine** (contract-side): any registered warden of the election may open a
1174`tallySession` after the exclusion freeze; roster accepted at the join deadline with
1175$|P| \ge \theta$; dealer deadline freezes $D$ ($|D| \ge \theta$, immutable — §10.3);
1176share-bundle deadline; contribution deadline. **A missing or invalid participant at any
1177stage reduces margin, never forces a restart**; `finalizeResults` accepts θ distinct
1178roster members' contributions **bound to one accepted session and its frozen dealer set**.
1179**Restart** — new session id and attempt, fresh blinding and transport randomness (settled
1180batch keys and pads never change), automatic invalidation of stale-session contributions —
1181occurs only by **objective deadline rules when θ valid contributions have become
1182impossible**; no caller may trigger an arbitrary reset. Honest framing: **removing the
1183election-key DKG does not remove coordinated cryptographic ceremonies — v3 replaces it with
1184different (smaller, tally-time-only) coordination work**, and the exchange stays interactive
1185in substance (no PQ primitive lets θ parties privately reconstruct without communicating —
1186there is no silent-threshold shortcut; the four stages are the minimum).
1187
1188---
1189
1190## 11. Census and authentication
1191
1192- **Census trees** migrate from Poseidon-BN254 to **Blake3** (a breaking format change; same
1193  lean-IMT structure; membership verified by the batch program, §8.2). Leaf encoding:
1194  `leaf = Blake3(address ‖ weight ‖ pk_PQ)` with `pk_PQ = H(sk)` for a CSPRNG-generated
1195  secret, or `pk_PQ = 0` for a not-yet-enrolled voter (hybrid-legacy censuses only).
1196- **PQ-key enrollment.** The Ethereum wallet signs an enrollment message binding
1197  `address ↔ pk_PQ`; the signature *authorizes* the binding and is never key entropy (a
1198  future ECDSA break must not reveal PQ secrets). Enrollment paths per census origin:
1199  off-chain censuses collect `pk_PQ` at census construction; on-chain/token censuses read a
1200  global **PQKeyRegistry** contract where voters register once (one transaction, reusable
1201  across all elections); CSP censuses include `pk_PQ` in the credential.
1202- **Election auth policy** (immutable registry parameter, fixed at creation):
1203  - `pq-only`: every leaf must carry `pk_PQ`; authentication is the in-STARK preimage proof
1204    alone; no ECDSA anywhere in the ballot path.
1205  - `hybrid`: every leaf must carry `pk_PQ`, and every package is verified on **both**
1206    authenticators — the in-STARK preimage proof *and* `hybridSig` (ECDSA over `pkgDigest`,
1207    verified by the batch program). No OR-downgrade exists in this mode.
1208  - `hybrid-legacy`: like `hybrid`, but leaves with `pk_PQ = 0` are admitted with identity
1209    resting on ECDSA alone; the STARK's auth clause (§6.5) switches to a **self-chosen
1210    package key**: the voter generates `sk_pkg` (CSPRNG; kept with the package opening). The
1211    first package binds `H(sk_pkg)` inside `pkgCommit`. Every later package in the chain
1212    proves knowledge of the *same* `sk_pkg` (predecessor opening) and derives its nullifier
1213    as `NULL = Blake3(nullCtx ‖ sk_pkg ‖ prevPkgDigest ‖ prevSalt)` — the derivation changes
1214    uniformly with §5.3 (one rule, one domain tag, one AIR path). Honest note: for these
1215    voters `sk_pkg` and the salt live in the *same* client store, so §5.3's key-compromise
1216    compartmentalization claim is vacuous for them (as it is for recovery-mode clients,
1217    §5.2). The batch program dispatches per
1218    leaf: `pk_PQ ≠ 0` ⇒ both authenticators against the census key; `pk_PQ = 0` ⇒ mandatory
1219    `hybridSig` + the `sk_pkg` clause. Anyone can count the legacy-status census members
1220    (leaf contents are public census data) — though not, of course, which *final* packages
1221    are theirs beyond what slot-participation already reveals. Ballot *privacy* is fully PQ
1222    for these voters; the election's **integrity assumptions include ECDSA security for its
1223    legacy voters** (§12.1). This mode is what makes existing token censuses usable before
1224    universal enrollment.
1225- **Enrollment snapshot rule.** A voter's authentication status and key for an election are
1226  pinned at the election's **creation snapshot**: for on-chain/token censuses the registry
1227  records the PQKeyRegistry root at the creation block, and membership proofs must present
1228  the enrollment status under that snapshot regardless of which (newer) eligibility root the
1229  census contract later accepts. Enrolling *after* an election was created affects
1230  subsequent elections only — an existing package chain never changes keys mid-election.
1231- **CSP censuses**: credentials become SLH-DSA signatures [FIPS 205] over the v2 message
1232  format extended with `pk_PQ`; verification is pure hashing via the SHA-256 precompile
1233  (SLH-DSA's internal SHA-2 is a FIPS island, §2 — not an application-level hash choice).
1234- Slot derivation, participation visibility, census origins 1–4 mechanics: as v2, with the
1235  enrollment additions above. The v2 census invariants (slot uniqueness across the census;
1236  stable distinct CSP indexes) remain assumptions of integrity.
1237
1238---
1239
1240## 12. Security properties, stated plainly
1241
1242### 12.1 What holds, under what
1243
1244| Property | Holds if |
1245|---|---|
1246| **Tally integrity** | STARK/zkVM soundness (FRI + hashes), binding commitments, correct pinned programs, the settlement chain executes the registry, and the v2 census invariants (unique slots / stable CSP indexes). Then no coalition of voters, sequencers, provers or wardens can shift a tally — including via malformed KEM transport (§10.2). |
1247| **Ballot privacy** | fewer than θ warden keys compromised **over their whole lifetime** (not just the active epoch), ML-KEM IND-CCA, PRF/hash security, hiding STARKs, and honest voter devices. Below θ, shares in isolation are information-theoretically independent of the ballot. **Post-quantum computational privacy — not "everlasting"**: an unbounded adversary could attack archived KEM transcripts. |
1248| **Revote hiding (public data)** | hash security + the sealing sequencer/prover draws the batch seed *and the refresh set* from fresh randomness and keeps them secret (v2's exact trust statement). Public data reveals participation per slot, update counts/timing, `numOverwrites` — v2's leakage surface. |
1249| **Exact tally** | unconditional arithmetic (mod-$p$ sums, Lagrange). ML-KEM's residual decapsulation-failure probability (≈2^-164 at ML-KEM-768; election-wide union bound over *all* encapsulations: per-ballot, batch shares, ceremony deliveries) is not zero even for proven-correct encapsulations. Each failure degrades gracefully: a per-ballot failure becomes a complaint (filable immediately — §9.2 — so the voter can revote); a batch-key *share* failure is tolerated provided at least θ valid shares remain available (with ν=θ, or only θ responsive wardens, one failed share means that payload cannot be reconstructed and the tally cannot complete — size ν above θ accordingly); a ceremony delivery failure reduces margin, and only an unrecoverable shortfall restarts the session (§10.4). Deliberately malformed batch transport is a different thing entirely — it is unprovable (§8.5), so it cannot appear in an accepted batch. |
1250| **Liveness** | ≥1 honest sequencer with proving capacity and timely inclusion (as v2), plus ≥θ responsive honest roster members through the ceremony's deadlines with θ valid accessible original shares per batch (§10.4 — margins absorb individual failures), plus **≥1 complete available archive of the published history spanning casting, complaints, every tally attempt and the retention period** (blobs prune in ≈18 days; providers untrusted, data chain-authenticated; missing payload history prevents tally completion — §4, §9.3), plus complaint capacity sized to the admitted-cast bound (§9.2). |
1251
1252### 12.2 What wardens and insiders learn
1253θ colluding wardens can reconstruct **every package's ballot** — exactly v2's boundary, where
1254θ wardens can decrypt every ballot. New, and narrower: the parties that can learn the
1255revoked-package set $R$ (metadata, not contents) are defined **cumulatively**: for each
1256batch, anyone who obtains $k_b$, receives its plaintext onward, or **accumulates θ distinct
1257valid original shares of $k_b$ — including shares received across different session
1258attempts** (fresh blinding cannot revoke knowledge already obtained; two incomplete attempts
1259can cumulatively suffice). In a delivered share exchange to a roster of size $m$, **every
1260roster recipient** — not only the final θ contributors — gains reconstruction capability,
1261and any one of them can leak $R$ onward. Because share bundles are DA-published (§10.4),
1262compromise of a recipient's ceremony decryption key would reveal $R$ and every pad $B$ from
1263the permanent public archive — which is why ceremony keys are **ephemeral per attempt and
1264destroyed after finalization** (§10.4): for honest-deleting participants, a later key theft
1265reveals nothing. Non-participating wardens and the public learn nothing about $R$ (batch
1266pads §8.4 + blinding §10.3 close those channels, given ≥1 honest accepted dealer and
1267blinding delivered only to the frozen roster — §10.3). The sequencer/prover that seals a
1268vote learns its revote linkage (§5.4) — as in v2.
1269
1270### 12.3 The honest coercion statement
1271v3 keeps v2's informal posture (no formal receipt-freeness; revotes hidden among refreshes),
1272with the residuals stated openly and precisely. The root issue: v3 has **public,
1273deterministic revocation state**; v2's re-encryption gave a key-holding coercer zero
1274distinguishing power on public data (testing re-encryptions is a DDH-type problem), and no
1275post-quantum equivalent of that exact property is used in v3.0.
1276
1277**The three coercion channels** (all require per-voter secrets or tokens; none is available
1278to a pure public observer):
12791. **The nullifier tree.** A coercer holding a package's revocation token — captured
1280   directly, via a demanded ZK derivation proof, or via a valid unsubmitted revote
1281   authorization — can watch the tree and detect whether that package was later consumed.
1282   With the voter's secrets (see classes below), *all* of the voter's tokens are computable.
12832. **Rejection as a test.** A coercer holding enough material to submit a revote of the
1284   coerced package can observe whether admission rejects it (nullifier already present) —
1285   detection by attempted double-consumption, independent of channel 1.
12863. **Recovery-mode enumeration.** For recovery-mode clients (§5.2), `voteID`s derive from
1287   `sk`, so an `sk` holder can enumerate every package the voter ever cast — independent of
1288   the nullifier tree.
1289
1290**Adversary classes and exact claims** (KTV-style stratification):
1291- *Token holder* (has a token or authorization, not the voter's keys): channels 1–2 work.
1292  **v3.0 makes no coercion-resistance claim against this class** — this is the main
1293  documented residual vs v2.
1294- *Key extractor* (obtains the identity `sk`, not the package openings): the §5.3
1295  **salt-bound nullifier** denies this class token computation — **provided** the client is
1296  CSPRNG-mode (not recovery-mode, where the salt re-derives from `sk`; not hybrid-legacy,
1297  where `sk_pkg` and the salt share one store — §11), no token was captured earlier, and the
1298  voter does not comply with derivation-proof demands. Key-compromise compartmentalization,
1299  not coercion resistance.
1300- *Full extraction* (everything the voter holds): **unfixable by any protocol** — if the
1301  coercer has all the voter's secrets, the best achievable outcome is vote *cancellation*,
1302  not a hidden revote (the Hirt–Sako axiom). Track-2 items (§15) target the first two
1303  classes and cancellation-failsafes for this one.
1304- *Forced abstention*: unaddressed while per-slot participation is public — in v2 and v3
1305  alike.
1306
1307Additional documented leakage: the §12.2 participant metadata, and complaint timing (§9.2 —
1308a malicious warden can time a valid complaint as a signal or delay it past recovery).
1309
1310**Operational requirements for clients and deployments** (adopt regardless of profile):
1311independent CSPRNG package randomness in the coercion-sensitive profile (§5.2); explicit
1312warnings before exporting identity keys or package openings; **no UI or API claim that
1313token-derivation proofs are harmless**; private authenticated submission to a sequencer the
1314voter trusts; honest "included" vs "finally counted" status indication (a vote-ID receipt
1315proves inclusion, not final counting).
1316
1317**Mitigation roadmap** (§15 Track-2): blinded slot state (removes public revocation state
1318entirely — the structural fix for the token-holder class), Merkle cast tickets (quota
1319without a voter-key-derived public tag), and nullification failsafes for the full-extraction
1320class. The literature's dichotomy, recorded here: any fix must either key the public tag
1321inside the batch program (sealing-sequencer trust — the same trust v2 already places there
1322for overwrites) or move duplicate resolution to the θ-warden tally; no known primitive gives
1323both public exactly-once enforcement and untestability by the token holder. Any formal claim against the token-holder class is **conditional on adopting those
1324designs** — v3.0 itself claims none. Deployments for coercion-sensitive elections should
1325weigh all of this explicitly.
1326
1327### 12.4 Proof-system notes
1328The pinned ballot STARK profile targets **≈106-bit** *conjectured* FRI soundness (18 queries × log₂32 + 16 grinding bits; ethSTARK heuristic
1329[ETHS]) — an explicit engineering dial (queries × log-blowup + grinding), to be raised for
1330high-stakes deployments, and **not** claimed as 128-bit PQ security. The Blake3
1331Merkle/challenger layer uses **full** Blake3 (7 rounds is the standard, not a reduction) with
1332256-bit digests: ~128-bit classical collision resistance — adequate for the classical target
1333above — while generic *quantum* collision bounds on any 256-bit hash are ~2^85 query bounds
1334(BHT is the generic quantum collision-search algorithm — a query-count bound under heavy memory assumptions, not a practical attack cost); the profile is therefore justified against the
1335classical conjectured target, not claimed as ≥102-bit end-to-end quantum security (the same
1336caveat applies to a Poseidon2 profile). The ~2^85 figure concerns **collision resistance —
1337commitments and binding**; it does not mean 256-bit *keys* have 85-bit confidentiality
1338(generic quantum key search is the Grover ~2^128 regime). The v2-era prototype's
1339three known defects (weight-bound bypass at `maxValueSum=0`; wraparound-prone comparators;
1340weak hiding-PCS blinding RNG with a constant fallback seed) are normatively fixed in v3
1341(§6.1; 256-bit CSPRNG blinding seed, fail-closed).
1342
1343**Where Poseidon2 still lives, honestly.** Blake3 replaces Poseidon2 in application hashing
1344and the ballot proof system. Poseidon2 remains an **inherited ZisK proof-system dependency**:
1345a break there may compromise accepted state transitions and tally integrity, and can thereby
1346compromise privacy *during protocol execution* (e.g. forged transitions could mark packages
1347consumed without authorization and mislead honest wardens into revealing a skewed aggregate).
1348Passive confidentiality of archived ballot transport and masking no longer relies on
1349application-level Poseidon2. "Repairable" means future executions can migrate to a repaired
1350verifier — not that past disclosures or finalized decisions can be undone. Why the move: the
1351Poseidon2 cryptanalysis landscape is young and moving — round-estimate revisions [TOSC25],
1352the EF Poseidon attack-reward program [PINIT], and the FreeLunch family of algebraic attacks
1353on arithmetization-oriented primitives [FL24] — while Blake3 carries long-standing ARX
1354analysis. This is a conservatism call, not a response to any full-round break.
1355
1356**Every published proof must be hiding, not merely sound.** The ballot STARK is not the only
1357proof carrying secrets: batch proofs (batch seeds, pads, revocation data), complaint proofs —
1358**including chunked complaint proofs and their authenticated continuation states** (warden
1359key seeds, decapsulation outputs), dealer proofs (blinding coefficients), warden
1360contributions **and their chunk continuations** (KEM seeds, shares, payload keys) and
1361key-registration proofs all have sensitive witnesses. Each proof
1362profile must therefore be verified to be **zero-knowledge/hiding**, not only sound. Known
1363status: the BN254 PlonK wrapper applies explicit blinding; the hiding of ZisK's *native*
1364VADCOP-final STARK path (ZisK's last recursion stage, the proof the wrapper wraps) is **unverified** — which makes "drop the wrapper for direct STARK
1365verification" (§15) a **privacy question, not only a cost change**.
1366
1367### 12.5 Out of scope / inherited
1368EIP-4844 KZG commitments (Ethereum's own PQ roadmap), organizer/sequencer Ethereum accounts,
1369hybrid-mode ECDSA (by construction), and the BN254 PlonK wrapper around ZisK proofs. These
1370classical dependencies are **integrity-critical — and an integrity failure during execution
1371can compromise privacy (§12.4)**; what they cannot do — provided the published proof paths
1372retain their required hiding and the KEM/PRF assumptions hold — is retroactively decrypt
1373archived ballots (breaking a proof system's *soundness* does not by itself recover
1374witnesses). The wrapper is replaceable by direct on-chain STARK verification (indicative public
1375data point: ~5–6 MGas for a WHIR/FRI verifier on the EVM [WHIR]; not a measured cost for ZisK
1376proofs; and a privacy-gated change, §12.4) — tracked as the final migration phase.
1377
1378---
1379
1380## 13. Cost summary
1381
1382| Metric | v2 | v3-PQ (estimates unless marked measured) |
1383|---|---|---|
1384| Browser proving | seconds (Groth16, 35.5 MiB key download) | projected ~2–4 s native (ν-dependent, re-laid full-Blake3 AIR at the blowup-32 profile, §6 — needs recalculation/benchmark against the §2.2 stream-masking counts; no key download; the Blake3-trees prototype measured 0.69 s native at blowup 8) |
1385| Ballot upload to sequencer | ~2 KB | ~20 KB package + ~195 KB proof (proof not stored on-chain) |
1386| DA per ballot | ~2 KB | ≈1.3–20 KB depending on ν (§8.6 table; ML-KEM-768 only) |
1387| DA per refresh | ~1–2 KB | 40 B (framed) |
1388| Batch proving | 2.3–4.0×10^8 steps | **+ ≈0.30 s GPU per ballot for in-guest STARK verification (measured on RTX 5090 after the optimization pass: 32 verifications proven in 19.8 s; 2.62M steps each, §8.1)** — 256-ballot batches ≈ 2–3 min total; state-tree hashing −30%/byte vs v2's SHA-256; commitment recomputations +13% vs a Poseidon2 precompile |
1389| Tally | θ partial decryptions of one accumulator + BSGS | cast-linear warden jobs over column views (§8.7/§10.1: ~13–17M compressions per 1M casts, ≈6–8× fewer than full-package re-hashing; unvalidated projection) + one ceremony + on-chain Lagrange |
1390| Ceremony DA | — (DKG runs pre-election) | 4 signed publications per participant (~157/251 KB of SLH-DSA signatures at m=5/8) + share bundles ≈ m(m−1)·(1120 + 96·M) B — ≈7.5/21.1 MB at m=5/8 for 1M casts in 256-cast batches |
1391| Registry tally cap | 10^12 | 2^61 |
1392
1393---
1394
1395## 14. Errors and edge cases (normative)
1396
1397- **voteID collision** (admission finds the leaf occupied): resample `k` (recovery mode:
1398  bump the counter) and re-cast — as v2. Skipped counters are harmless (§5.2 recovery scan).
1399- **Unsettled predecessor**: a revote consuming a predecessor not yet settled under the
1400  batch's starting root is rejected at admission and retried by the sequencer in a later
1401  batch automatically; clients should submit revotes to the sequencer that holds their
1402  pending vote, as in v2.
1403- **Duplicate revocation race** (two sequencers hold revotes of the same package): the first
1404  settles; the loser's re-validation drops the vote at admission (nullifier present) and
1405  notifies the voter — the v2 "voteID already in state" pattern.
1406- **Live package excluded** ($P_t \in X$): the client detects it (public $X$, watchable from
1407  the moment of casting — §9.2) and informs the voter. **While casting is open, recovery is
1408  an ordinary revote** consuming the excluded predecessor (it remains admitted; §9.2
1409  semantics). After the casting freeze, no recovery within the election.
1410- **Warden key unavailable at cast time**: the client refuses to cast (it cannot build a
1411  complete package); election creation already requires all ν keys registered (§4).
1412- **Ceremony participant failure**: absorbed by margin — a missing/invalid dealer before the
1413  dealer deadline simply doesn't enter $D$; after $D$ freezes, failures reduce the
1414  contributor margin (§10.4). Restart (fresh masks, new attempt) only when θ valid
1415  contributions become impossible; if no attempt can reach θ, the tally is lost — counted
1416  under liveness (§9.3).
1417
1418---
1419
1420## 15. Tracked upgrades
1421
14221. **In-AIR verifiable encapsulation** — prove **FIPS 203 ML-KEM-768 `Encaps` inside the
1423   ballot STARK**, retiring the complaint mechanism entirely (transport correctness becomes
1424   part of admission). Estimated [est]: FIPS-exact ≈ +4M trace cells, +1.5–4 s native prover;
1425   fallback: K-PKE-768 with Blake3-derived coins (≈ +1.2M cells, +0.5–1 s) **plus a written
1426   IND-CCA argument** (FIPS 203 §3.3 forbids bare K-PKE; the FO-binding lemma of
1427   Takahashi–Zaverucha supplies the key step). **Never prove encryption with non-FO-derived
1428   coins** (decryption-failure oracles). Batch-guest verification deltas must be recomputed
1429   against the measured 2.62M-step baseline (§8.1) before choosing the variant. (v1.2
1430   tracked "RLWE-LPR" here — withdrawn: Ring-LWE over Goldilocks needs n ≥ 4096 and ≥6 KB
1431   ciphertexts; dedicated lattice-VE schemes carry 19 KB proofs or relaxed decryption.)
14322. **PQ coercion-hardening ladder** (§12.3) — in order of reach:
1433   a. **Blinded Shamir slot state**: replace opaque slot digests with public masked Shamir
1434      vectors updated uniformly by refreshes and overwrites (batch-amortized mask-seed
1435      delivery over §8.5 transport; hidden operation log in the batch payload; removes
1436      nullifiers, predecessor consumption and pad B). *Candidate* restoration of v2-style
1437      revote hiding against token-holders, key-extractors and full-opening coercers
1438      including adaptive proof demands — an architectural claim with a stated assumption
1439      list, **not formally proven**, and blocked on the cast-quota redesign (next item).
1440   b. **Merkle cast tickets** as the quota for (a): Q = maxRevotes+1 independent secret
1441      tickets under one immutable per-voter anchor; each cast spends one
1442      (`N_j = H(ticketCtx ‖ slot ‖ r_j)`, insert-once). A ticket announces *use of a posting
1443      right*, not *replacement of a known package* — a coercer holding one ticket learns
1444      nothing about later spends; protection requires the remaining ticket secrets to stay
1445      undisclosed and underivable from `sk` (full device-state extraction still exposes
1446      future admissions — see d).
1447   c. **Trapdoor-chain depth precedence** (deepest-position-wins at tally): adds
1448      last-minute-coercion resistance but admits a "cast at maximum depth" adaptive demand,
1449      presumes a protected credential store, and forces tally-time winner selection —
1450      separate, deeper research.
1451   d. **Nullification failsafe** (VoteXX-style Shamir-shared flags): converts full key
1452      extraction from total loss into vote cancellation — the best achievable outcome for
1453      that class (Hirt–Sako).
1454   e. **Fake credentials** (JCJ lineage) with warden-held rosters: strongest target,
1455      heaviest machinery (deniable enrollment + a reviewed filtering trust model: insider
1456      secrecy, a PQ verifiable mix, or malicious-secure MPC — a zkVM proof alone does not
1457      hide filtering from its prover).
14583. **Locked mode** as a separately specified and reviewed extension (§4).
14594. Direct on-chain STARK verification (drop the PlonK wrapper) once rollup gas permits —
1460   **gated on establishing the native proof path's hiding, not only its cost** (§12.4).
14615. **Multi-recipient Kyber transport** (KKPP20-style FO-mKEM [MMK]): one shared 960 B
1462   component + 128 B per warden ⇒ package 10,056 → 3,336 B at ν=8 (~3× DA cut) and 5,640 B
1463   at ν=16 (making the 16-warden profile fit the 32-blob cap at ≈12 blobs, §8.6); also the cheapest
1464   in-AIR circuit for item 1. **Gated on**: (i) warden-key well-formedness/distinctness
1465   proofs covering the pinned scheme's honest-key requirements (malicious keys break lattice
1466   multi-recipient schemes; a 2025 proof-free fix was broken within a year; §4's
1467   seed-derived keygen proof is the intended vehicle), and (ii) verified **per-recipient
1468   shared-secret independence** (a common secret across wardens would let a single warden
1469   unmask every column — fatal). (v1.2 tracked Classic McEliece here — withdrawn, §8.6.)
14706. **Proof-certified per-warden exclusion bitsets** for adversarial-extreme elections: each
1471   admission carries a public immutable **ordinal** — position = (settled batch number,
1472   in-batch admission index), assigned at settlement, bound to `pkgDigest` identically in
1473   every §8.7 column view (a bit never denotes different packages in different bitsets);
1474   per-warden bitset commitments $X_i$ updated only by their own warden's complaint proofs
1475   (monotone: set bits are preserved; every new bit justified), published as authenticated
1476   delta bitmaps; the election's $X$ = the union. Collapses 1M exclusions from a 32 MB
1477   digest list (≈512M gas of calldata) to a 125 KB bitmap. Deferred from v3.0: typical
1478   elections see ~0 exclusions, the per-package and chunked-batch complaint paths (§9.2)
1479   already exist, and item 1 retires the whole mechanism; adopt only if the Phase-0
1480   prototype shows complaint gas/DA is binding.
14817. **Confidential ceremony fault proofs**: ZK proofs binding a signed ceremony ciphertext,
1482   the recipient's ephemeral key, correct decapsulation/DEM processing and the §8.5 share
1483   commitment, outputting *which envelope entry is faulty* without revealing plaintext —
1484   publicly attributable misbehavior for slashing/eligibility policy. Deferred from v3.0:
1485   margin (§10.4) already keeps faults off the tally's critical path; this is
1486   accountability, not liveness.
14878. **Per-election warden keys** as an operational-lifecycle option: the §12.1 *lifetime*
1488   key-compromise assumption means rotating epochs does not protect old ballots if old
1489   secrets survive; per-election keys plus specified destruction (including backups) make the
1490   retention story auditable. (Ceremony keys are already ephemeral per attempt — §10.4.)
1491
1492### Phase-0 gates (normative — pass before `ballotVKHash` is pinned)
1493
14941. Re-laid full-Blake3 ballot AIR: instrumented compression counts for both admission paths
1495   (including the salt-extended `NULL`, §5.3); measured native + browser proving (desktop and
1496   a 2023 mid-range phone; pass: browser p50 ≤ 10 s, else adopt the fallback FRI profile).
14972. wasm32 challenger query-sampler fix + production hiding CSPRNG, with negative tests.
14983. **Byte-exact pinned encodings + negative test vectors** for every new structure:
1499   ColumnRecord, `viewAcc`/`viewsRoot`, payload envelope, ceremony bundle envelope, chunk
1500   continuation states (the §8.7, §9.2 and §10.4 test lists are normative), **and the
1501   salt-bound nullifier vectors**: correct opening accepted; substituted salt rejected; two
1502   successors of one predecessor collide (insert-once); distinct salts ⇒ distinct
1503   derivations; cross-domain substitution rejected.
15044. **Hiding/zero-knowledge verification for every new published proof path**: chunked
1505   complaint proofs and warden-contribution chunks added to the §12.4 list; the VADCOP-final
1506   hiding question filed upstream with ZisK (feeds item 4 above).
15075. DEM security-argument appendix published (§2.1).
15086. The named high-stakes FRI profile (§2.3) documented alongside the default.
15097. **ePrint submission of the MSA construction** (masked-share accumulator + padded
1510   accumulator + zero-blinding tally) for public peer review — the protocol's main novelty
1511   debt.
15128. Prototype-derived deployment limits: full batch proving cost, warden tally throughput,
1513   complaint throughput under adversarial all-malformed load (worst case remains linear in
1514   reported faults — §9.2), ceremony wall-clock, electorate/committee/deadline/hardware
1515   envelopes — measured, not modeled.
1516
1517**First implementation target (from the external design review).** A complete, reproducible
1518**3-of-5, ML-KEM-768 end-to-end election prototype** — browser casting through settlement,
1519complaints, exclusions, the ceremony, warden proofs, and on-chain finalization —
1520with these measured gates: the complete 16-field ballot relation including the revote path,
1521production hiding randomness, the exact pinned proof profile verified inside ZisK, full
1522batch proving cost, complaint throughput under adversarial load, and the complete warden
1523tally job (archive authentication included). Browser latency/memory and deployment limits
1524(electorate sizes, committee sizes, deadlines, hardware) are derived from those measurements
1525— not from component benchmarks.
1526
1527---
1528
1529## 16. References
1530
1531- [DAV2] Vocdoni, *DAVINCI protocol specification v2*. https://spec.davinci.vote
1532- [FIPS 203] NIST, *Module-Lattice-Based Key-Encapsulation Mechanism Standard (ML-KEM)*, 2024. https://doi.org/10.6028/NIST.FIPS.203
1533- [FIPS 205] NIST, *Stateless Hash-Based Digital Signature Standard (SLH-DSA)*, 2024. https://doi.org/10.6028/NIST.FIPS.205
1534- [Sha79] A. Shamir, *How to Share a Secret*, CACM 22(11), 1979.
1535- [DST] Vocdoni, *davinci-stark: Plonky3 ballot proof prototype*. https://github.com/vocdoni/davinci-stark
1536- [P3] Polygon Zero, *Plonky3*. https://github.com/Plonky3/Plonky3
1537- [ZISK] Polygon, *ZisK zkVM*. https://github.com/0xPolygonHermez/zisk
1538- [POS2] L. Grassi et al., *Poseidon2: A Faster Version of the Poseidon Hash Function*, ePrint 2023/323.
1539- [TOSC25] *Poseidon and Neptune: Gröbner Basis Cryptanalysis Exploiting Subspace Trails*, IACR ToSC. https://tosc.iacr.org/index.php/ToSC/article/view/12244
1540- [FL24] A. Bariant et al., *The Algebraic FreeLunch: Efficient Gröbner Basis Attacks Against Arithmetization-Oriented Primitives*, CRYPTO 2024 (ePrint 2024/347).
1541- [PINIT] Ethereum Foundation, *Poseidon Initiative — cryptanalysis attack reward program*. https://www.poseidon-initiative.info
1542- [B3] J. O'Connor, J.-P. Aumasson, S. Neves, Z. Wilcox-O'Hearn, *BLAKE3: one function, fast everywhere*. https://blake3.io
1543- [ETHS] StarkWare, *ethSTARK Documentation*, ePrint 2021/582.
1544- [EIP4844] V. Buterin et al., *EIP-4844: Shard Blob Transactions*, 2022.
1545- [IR89] R. Impagliazzo, S. Rudich, *Limits on the Provable Consequences of One-Way Permutations*, STOC 1989.
1546- [NOAH] M. Dahl et al., *Noah's Ark: Efficient Threshold-FHE Using Noise Flooding*, WAHC/CCS 2023.
1547- [TEV] J. Alizadeh, *Threshold Post-Quantum E-Voting from Lattice Commitments*, ePrint 2026/2500.
1548- [PQK] N. Huber et al., *PQKryvos: Post-Quantum Secure E-Voting With Flexible Ballot Formats and Public Tally-Hiding*, PoPETs 2026.
1549- [MMK] J. Katsumata, K. Kwiatkowski, F. Pintore, T. Prest, *Scalable Ciphertext Compression Techniques for Post-Quantum KEMs and their Applications* (multi-recipient Kyber), ePrint 2020/1107; and *mKyber* follow-ups, ePrint 2022/1046.
1550- [FOCT] *Careless to Compare: ML-KEM Key Recovery from Partial Fujisaki–Okamoto Re-encryption Comparison*, ePrint 2026/1682.
1551- [TZ21] A. Takahashi, G. Zaverucha, *Verifiable Encryption from MPC-in-the-Head*, ePrint 2021/1704 (App. B: FO binding).
1552- [HS00] M. Hirt, K. Sako, *Efficient Receipt-Free Voting Based on Homomorphic Encryption*, EUROCRYPT 2000 (the cancellation axiom for full extraction).
1553- [JCJ] A. Juels, D. Catalano, M. Jakobsson, *Coercion-Resistant Electronic Elections*, WPES 2005.
1554- [VXX] D. Chaum et al., *VoteXX: Extreme Coercion Resistance*, ePrint 2022/1212 (nullification).
1555- [TDC] J. Erdmanis, *Trapdoor-Chain Vote Precedence*, E-Vote-ID 2026 (depth-based precedence; smartcard-assisted).
1556- [KTV] R. Küsters, T. Truderung, A. Vogt, *A Game-Based Definition of Coercion-Resistance and its Applications*, CSF 2010 (the δ-CR framework used in §12.3).
1557- [KEMB] *ML-KEM WebAssembly implementations and benchmarks*. https://github.com/dchest/mlkem-wasm
1558- [WHIR] *EVM Verification of WHIR over a 31-bit Field*, ethresear.ch, 2025.