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.0 · 2026-10-20 · v2 remains the deployed protocol. Reviewed: three
  4adversarial soundness rounds (protocol reviewer) + audience-representative sign-off; a final
  5consolidated review gates implementation (Phase 0 of the migration plan).
  6**Audience:** engineers who already know [DAVINCI v2](https://spec.davinci.vote). This document only
  7specifies what *changes*. Everything not mentioned here (settlement flow, grace window, blob
  8verification via the point-evaluation precompile, census origins, sequencer lifecycle, process
  9registry mechanics) works exactly as in v2 [DAV2].
 10
 11---
 12
 13## 1. Why v3, in one paragraph
 14
 15Every ballot DAVINCI v2 publishes in Ethereum blobs [EIP4844] is an ElGamal ciphertext over
 16BabyJubjub. Published blob data can be archived by anyone indefinitely, and ElGamal falls to
 17Shor's algorithm — so a future quantum computer decrypts **past elections retroactively**
 18("harvest now, decrypt later"). Integrity is less urgent (a settled chain cannot be rewritten
 19under Ethereum's finality assumptions), but **ballot privacy must be post-quantum today**.
 20v3-PQ removes the quantum-vulnerable primitives from the ballot *confidentiality* path: no
 21shared-key homomorphic encryption, no pairings, no DKG, no Groth16. Ballot secrecy rests on
 22polynomial secret sharing, hashes, STARKs, and one NIST-standardized KEM — the KEM is never
 23proven inside the voter's circuit (the batch guest performs encapsulations, and rare complaint
 24proofs perform decapsulations; see §8.5, §9.2). During the hybrid period voter authentication
 25still *also* uses ECDSA (§11), and the settlement wrapper and KZG blob commitments remain
 26inherited non-PQ dependencies (§12.5).
 27
 28### Changes at a glance
 29
 30| Component | v2 | v3-PQ |
 31|---|---|---|
 32| Ballot confidentiality | ElGamal over BabyJubjub (threshold key) | Shamir shares + PRF masks over KEM transport (§3) |
 33| Ballot proof | Groth16 over BN254 (circom, trusted setup) | Plonky3 STARK over Goldilocks, browser WASM (§6) |
 34| Election key | DKG / council ceremony (BabyJubjub) | **None.** Wardens register ML-KEM keys (§4) |
 35| Tally | Threshold decryption + BSGS search | Lagrange interpolation of θ proven warden sums (§10) |
 36| Running tally | Homomorphic ciphertext accumulator | Padded plain-sum accumulator over Goldilocks (§8.4) |
 37| Silent revoting | Re-encryption of stored ciphertexts | Hash-chained opaque slot leaves (§7) + padded accumulator |
 38| Revotes | Slot overwrite + ciphertext subtraction | One-live-chain packages + revocation nullifiers (§5.3) |
 39| Voter authentication | ECDSA (secp256k1) | Hash-preimage proof in-STARK; `hybrid` verifies **both**; `hybrid-legacy` admits unenrolled voters on ECDSA (§11) |
 40| CSP credentials | ECDSA | SLH-DSA (SPHINCS+) [FIPS 205] |
 41| Batch proof | ZisK, verifies Groth16 (BN254 precompiles) | ZisK [ZISK], verifies ballot STARKs (Poseidon2 precompile) |
 42| Tally bound | maxValue·maxVoters ≤ 10^12 (BSGS limit) | ≤ 2^61 (field headroom; no search) |
 43
 44![What changes from v2 to v3-PQ](figures/architecture-delta.svg)
 45
 46---
 47
 48## 2. Notation, parameters and encodings
 49
 50- $\mathbb{F}$ — the **Goldilocks field**, $p = 2^{64} - 2^{32} + 1$ (the Plonky3 [P3] and ZisK
 51  native field). All shares, masks and tally arithmetic live here. Canonical encoding of an
 52  element: 8 bytes little-endian, value < $p$.
 53- $\nu$ — number of **key wardens**; $\theta$ — tally threshold ($1 \le \theta \le \nu \le 16$;
 54  the cap matches v2 committee/council sizes, and data availability cost is linear in ν).
 55- `nf` — active ballot fields, 1..16, as in v2. A ballot is a vector $b_1..b_{16}$; fields
 56  beyond `nf` are **inactive and MUST be 0** (enforced by the ballot proof; their shares are
 57  shares of 0).
 58- **KEM** — ML-KEM-768 [FIPS 203] (ct 1088 B) by default; ML-KEM-512 (ct 768 B) is an allowed
 59  profile for DA-sensitive deployments. One *encapsulation* yields `(ct, K)` with a 32-byte
 60  shared secret `K`; arbitrary payloads are carried KEM-DEM style (encapsulate, derive a
 61  wrapping key from `K`, then DEM-encrypt — §2.1).
 62- **Poseidon2** — Poseidon2 over Goldilocks, width 16, ZisK-precompile-compatible constants
 63  [POS2]. Used for all in-circuit hashing (commitments, PRFs, binding hashes). A Poseidon2
 64  digest is 4 field elements, serialized as 4×8 B LE (32 bytes).
 65- **SHA-256** — unchanged: the state SMT, package digests, and everything contracts check.
 66- **256-bit values in circuits** (DEM keys, SHA-256 digests crossing into Goldilocks
 67  arithmetic): encoded as **eight 32-bit limbs**, each range-checked < 2^32. Never as four
 68  64-bit limbs (not injective: $p^4 < 2^{256}$), and never reduced mod $p$.
 69
 70### 2.1 DEM (authenticated encryption for warden payloads)
 71
 72Hash-based, precompile-friendly, normative for **every protocol payload** (voter→warden is
 73pure KEM+PRF and needs no DEM; this DEM covers batch payloads, batch-key share wrapping, and
 74ceremony deliveries):
 75`keystream block j = HMAC-SHA-256(k, nonce ‖ LE64(j))` (HMAC, not raw hashing — the needed
 76assumption is that HMAC-SHA-256 is a PRF, a conservative standard one); ciphertext =
 77plaintext ⊕ keystream; `tag = HMAC-SHA-256(k_mac, nonce ‖ AAD ‖ ciphertext)`;
 78`(k, k_mac) = HKDF-SHA-256(K, "enc"/"mac")` from the KEM/batch secret. `nonce = SHA-256(AAD)`.
 79The AAD is the canonical serialization of a **DEM context** that always includes a purpose
 80tag, the election context, the **batch number or ceremony (session, attempt) identifier**,
 81sender and recipient — unique per encryption *including retries* (a ceremony restart is a new
 82attempt id ⇒ fresh masks, keys and nonces; the same derived key and nonce never encrypt two
 83different plaintexts). Payloads are bounded below 2^32 blocks; receivers verify the full tag
 84before releasing any plaintext. AES-256-GCM may be used by clients for unrelated local
 85storage/transport, never as a substitute encoding of protocol payloads.
 86
 87### 2.2 Domain-separated contexts
 88
 89Every derived value uses a purpose-tagged context; nothing is derived without one.
 90
 91| Purpose | Context contents |
 92|---|---|
 93| `pkgCtx` — the package context tuple | `(protocolVersion, chainID, registry, processID, wardenEpoch, voteID)` — the common prefix below |
 94| `maskCtx(i, f)` — PRF pad for masked shares | `("v3/mask", pkgCtx, recipient i, field f)` |
 95| `hCtx(i)` — share/pad commitment | `("v3/hcommit", pkgCtx, recipient i)` |
 96| `commitCtx` — package commitment | `("v3/pkgcommit", pkgCtx)` — the `ctx` argument of `pkgCommit` (§5.1) |
 97| `nullCtx` — revocation nullifier | `("v3/null", protocolVersion, chainID, registry, processID)` — **predecessor-only**: `NULL = Poseidon2(nullCtx, sk, prevPkgDigest)` with `sk` the voter's census-bound secret or `sk_pkg` (§11). Never depends on the successor package, batch, or recipients. |
 98| `slotCtx` / `refreshCtx` — slot leaves | `"davinci-slot-v3"` / `"davinci-refresh-v3"` (§7) |
 99
100The package's mask nonce is its **voteID** — public, unique per package, authenticated, and
101independent of the masked values (it derives from the secret `k`, §5.2, before any masking),
102so wardens can recompute every `maskCtx` from public data with no circularity.
103
104### 2.3 Protocol parameters
105
106| Parameter | Value | Why |
107|---|---|---|
108| Share/tally field | Goldilocks $p$ | native in the ballot AIR and ~native u64 in ZisK guests |
109| 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`) |
110| **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 |
111| Warden evaluation points | $x_i = i$, $i \in 1..\nu$ | Shamir positions, pairwise distinct, nonzero |
112| 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) |
113| Max refreshed slots per batch | 2048, rule as v2 | unchanged |
114| Nullifier tree | SHA-256 SMT, depth 256 | full-width nullifiers (no truncation into the 64-bit key space) |
115| Ballot STARK profile | Goldilocks, blowup 8, 34 FRI queries, hiding PCS | ≈102-bit conjectured FRI soundness (§12.4) |
116
117Mini-glossary for non-cryptographers: **AIR** = the constraint system of a STARK (its
118"circuit"); **hiding PCS** = the polynomial commitment is randomized so proofs leak nothing
119about private inputs (zero-knowledge); **witness** = the prover's private inputs; **dealer** =
120a party that distributes shares of a secret it generated.
121
122---
123
124## 3. The core idea: tally without a decryption key
125
126v2 hides a ballot inside a ciphertext and adds ciphertexts homomorphically. v3 hides a ballot
127inside **polynomials** and adds polynomials. If you know Lagrange interpolation, you know the
128whole trick:
129
1301. For each ballot field value $b$, the voter picks a random polynomial $f$ of degree
131   $\theta-1$ with $f(0) = b$, and computes one **share** per warden: $s_i = f(i)$. Any
132   $\theta$ shares reconstruct $b$; any $\theta-1$ shares are statistically independent of
133   $b$. Plain Shamir [Sha79]: no curves, just polynomial evaluation in $\mathbb{F}$.
1342. Shares are never published in the clear. The voter publishes **masked shares**
135   $e_i = s_i + \mathrm{PRF}(K_i, \mathrm{maskCtx})$, where the pad key $K_i$ travels to
136   warden $i$ inside an ML-KEM ciphertext. To everyone except warden $i$, $e_i$ is a
137   uniformly random field element.
1383. Polynomials add: the per-field sum of every active voter's polynomial is itself a
139   degree-$(\theta-1)$ polynomial whose value at 0 is the **tally**. So the protocol only
140   ever needs to add public field elements. The batch program maintains a public
141   **accumulator** $A \in \mathbb{F}^{\nu \times 16}$: coordinate $(i, f)$ is the running
142   sum of the masked shares addressed to warden $i$ for field $f$ (plus batch pads, §8.4).
1434. At the end, each participating warden decapsulates its KEM ciphertexts, subtracts its pads
144   from its row, and publishes its **sum-share** $S_i$ — with a ZisK proof that it did exactly
145   that against on-chain-committed data. Lagrange interpolation of any $\theta$ published
146   sum-shares at $x=0$ **is** the tally. Exact field arithmetic: no decryption of any
147   aggregate, no noise, no discrete-log search.
148
149![How the tally emerges without a decryption key](figures/tally-algebra.svg)
150
151(*This section is the intuition; the full computation also handles the exclusion set, batch
152pads, and a blinding term — §9–§10.*)
153
154The ballot STARK (§6) makes steps 1–2 trustworthy, the batch proof (§8) step 3, the warden
155proofs (§10) step 4. **The zkVM proof chain replaces the homomorphic algebra** — the
156structural difference from academic PQ voting designs ([TEV], [PQK]), which obtain the same
157guarantee from lattice commitments. (Some public-key encryption is unavoidable for ballots
158addressed to offline wardens [IR89]; v3 confines it to KEM transport. Threshold *lattice*
159decryption — the known hard part of lattice voting [NOAH] — is avoided entirely: the
160threshold lives at the plaintext layer.)
161
162Privacy in one sentence: below $\theta$ colluding wardens, shares are information-theoretically
163useless in isolation, and the computational assumptions protecting ballots are ML-KEM, the
164PRF/hash, and the zero-knowledge of the STARKs — all post-quantum (full leakage model: §12).
165
166---
167
168## 4. Roles: what changed
169
170- **Organizer, sequencers, provers, observers** — unchanged from v2.
171- **Key wardens** no longer run a DKG or hold shares of a secret key. Per *epoch*, each warden
172  generates an ML-KEM keypair and calls the **WardenRegistry** contract with: `H(pk)`, a URI
173  where the full public key is served (IPFS or HTTPS), and a ZisK **well-formedness proof**
174  (the key pair derives from a committed seed and passes an encaps/decaps self-test). The
175  registry verifies the proof on-chain. An election pins its committee in `wardenSetHash`
176  (config leaf `0x3`, §7): `(ν, θ, epoch, the ν registered H(pk) values)`. A voter's client
177  fetches the ν public keys (from their URIs or any sequencer), recomputes each `H(pk)` and
178  the set hash, and verifies it against the on-chain value before casting; it refuses to cast
179  otherwise. The registry refuses to create an election whose warden set is not fully
180  registered. During the election wardens do nothing; at the end they run one archive scan,
181  optional complaints, and one tally ceremony (§9–§10).
182- **Key modes.** *Committee* (lottery over registered operators) and *council*
183  (organizer-invited set) map 1:1 from v2 — they only select *which* registered warden keys
184  form the set. *Sequencer mode* is the degenerate $\nu = \theta = 1$ case (the sequencer is
185  the only warden; ~1 KB per ballot — cheaper than v2). **Locked mode is deferred**: it
186  requires an organizer-side share column and a separately reviewed extension of the tally
187  equations; it is not part of v3.0.
188
189---
190
191## 5. The ballot package
192
193A vote is one **package**. Its public part goes into blobs; its private part exists only in
194the voter's browser — except the *revote metadata* the chosen sequencer needs (§5.4).
195
196![Building a ballot package in the browser](figures/ballot-package.svg)
197
198### 5.1 Public package contents and CanonicalPackage
199
200| # | Field | Size (ν=16, ML-KEM-768) | Description |
201|---|---|---|---|
202| 1 | `version` | 1 B (`0x03`) | package format version |
203| 2 | `processID` | 31 B | as v2 |
204| 3 | `voteID` | 8 B LE | §5.2; also the package's mask nonce (§2.2) |
205| 4 | `E` | ν·16·8 B = 2,048 B | masked shares, row-major (warden-major, field-minor), canonical LE |
206| 5 | `cts` | ν·1,088 B = 17,408 B | ML-KEM ciphertexts, warden order 1..ν |
207| 6 | `h` | ν·32 B = 512 B | commitments $h_i = \mathrm{Poseidon2}(hCtx(i), s_{i,1..16}, K_i)$ ($K_i$ as 8×32-bit limbs) |
208| 7 | `pkgCommit` | 32 B | $\mathrm{Poseidon2}(slot, pk_{\text{voter}}, \mathrm{prevPkgDigest}, \mathrm{sharesDigest}, \mathrm{salt}, \mathrm{commitCtx})$ — 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 |
209| 8 | `hybridSig` | 65 B or absent | hybrid mode only: ECDSA over `pkgDigest`, Ethereum personal-message format (§11) |
210
211`CanonicalPackage` = the concatenation of fields 1–7 exactly as listed (fixed order, fixed
212sizes, no framing). **`pkgDigest = SHA-256(CanonicalPackage)`** is the package's chain
213identity: it is the value stored at the vote-ID leaf, the input to revocation nullifiers, and
214what complaints reference. `sharesDigest = Poseidon2` sponge over all $s_{i,f}$ in the same
215row-major order. The ballot STARK (~400 KB) accompanies the package to the sequencer but is
216**not** published in blobs.
217
218### 5.2 Construction (browser, pseudocode)
219
220```text
221k         = fresh random scalar (or PRF(sk, "v3/k", processID, counter) in recovery mode)
222voteID    = N + trunc63(Poseidon2(processID, address, k))        # trunc63 = lowest 63 bits;
223                                                                 # N = 2^63 (v2's namespace offset)
224for f in 1..nf:
225    poly_f = random polynomial, degree θ-1, poly_f(0) = ballot[f]
226for f in nf+1..16:  poly_f = random polynomial with poly_f(0) = 0  # inactive fields: shares of 0
227s[i][f]   = poly_f(i)                                            # ν shares per field
228for i in 1..ν:
229    (ct[i], K[i]) = MLKEM.Encaps(pk_warden[i])                   # fresh randomness per package, NEVER reused
230    for f in 1..16: e[i][f] = s[i][f] + PRF(K[i], maskCtx(i, f)) mod p
231    h[i]  = Poseidon2(hCtx(i), s[i][1..16], K[i])
232salt      = fresh 256-bit CSPRNG value                           # hiding salt, kept in the opening
233pkgCommit = Poseidon2(slot, pk_voter, prevPkgDigest, sharesDigest, salt, commitCtx)
234ctsDigest = SHA-256(ct[1] || .. || ct[ν])                        # binds the ciphertext bytes (§6)
235proof     = BallotSTARK.prove(...)                               # §6
236```
237
238ML-KEM encapsulation costs ~1–2 ms per warden in browser WASM [KEMB]; the dominant client
239cost is the STARK (§6). **Pad-reuse warning:** reusing KEM randomness across two packages
240would publish the *difference* of two sharings, which interpolates to the difference of the
241ballots — encapsulations are fresh per package, enforced by convention and by the fresh
242`voteID` in every `maskCtx`.
243
244**Client state.** Default: `k`, the polynomials and the KEM randomness are **independent
245CSPRNG randomness**, and the client stores the package opening — including the commitment
246salt — (needed to revote). Optional *recovery mode* derives them **and the salt** as
247`PRF(sk_voter, purpose, processID, counter)` with distinct purpose tags (salt included:
248`"v3/salt"`), so any device holding `sk` can reconstruct past packages — with the documented trade-off that whoever later
249obtains `sk` can also reconstruct that voter's own historical ballots. Counter recovery: the
250client trial-derives counters 0,1,2…, computes each candidate `pkgDigest`, and checks which
251are admitted (vote-ID leaves) and which are consumed (nullifier tree) to find its live
252package; gaps from collision-resamples (§14) are skipped naturally.
253
254### 5.3 Revoting: the one-live-chain rule
255
256v2 overwrote the voter's slot and subtracted the stored ciphertext. v3 has no stored
257ciphertext, so the *voter's proof* identifies what to remove:
258
259![Revote lifecycle: the one-live-chain rule](figures/revote-lifecycle.svg)
260
261- Each voter has, per election, a chain of packages $P_0 \to P_1 \to \dots$; exactly one is
262  **live**. A revote package $P_{t+1}$ consumes $P_t$: the STARK proves knowledge of $P_t$'s
263  opening (same slot, same key) and the nullifier derivation
264  $\mathrm{NULL}_t = \mathrm{Poseidon2}(\mathrm{nullCtx}, sk, \mathrm{pkgDigest}_t)$, where
265  `sk` is the voter's census-bound secret (or the self-chosen `sk_pkg` for unenrolled hybrid
266  voters — §11).
267- The batch program checks $P_t$ **was admitted and is settled**: an inclusion proof of
268  `voteID_t → pkgDigest_t` under the current root (consequently, a predecessor cast in the
269  *same* batch cannot be consumed yet — §14). It inserts $\mathrm{NULL}_t$ into the nullifier
270  tree (insert-once: double consumption is impossible), subtracts $P_t$'s public `E` from the
271  accumulator, and adds $P_{t+1}$'s.
272- Invariants enforced by the batch program: an **empty slot admits exactly one initial
273  package**; a package for an **occupied slot must consume exactly one admitted, unconsumed
274  predecessor of the same owner and slot**; refreshes never create occupancy.
275
276Nullifiers are unlinkable to packages for third parties (they depend on `sk`). The coercion
277consequences are stated in §12.3.
278
279### 5.4 Submission interface (voter → sequencer)
280
281The voter submits to one sequencer, over an encrypted channel as in v2:
282`{CanonicalPackage, hybridSig?, ballotProof, censusProof?, and — for a revote — the
283predecessor reference (voteID_t, pkgDigest_t) with its inclusion path}`. The sequencer (and
284its prover) therefore **learns revote events and predecessor linkage for the votes it seals —
285the same boundary as v2**, where the sealing sequencer learns which updates are overwrites.
286It never learns ballots, shares, pads, or `sk`: those stay inside the STARK witness. The
287batch program receives the predecessor's public data as ordinary host input; the STARK is
288what makes it *authorized* (nullifier + ownership), and the chain is what makes it
289*authentic* (vote-ID leaf).
290
291---
292
293## 6. The ballot proof (Plonky3 STARK)
294
295The Groth16 circuit is replaced by a STARK over Goldilocks, proven in the browser via WASM —
296the production descendant of the davinci-stark prototype [DST], minus its elliptic-curve
297section. No trusted setup.
298
299**Public inputs** (all as Goldilocks elements/limbs):
300`inputsHash` (4 limbs) · `voteID` · `slot` · `authMode` flag · `isRevote` flag ·
301`prevPkgDigest` (8×32-bit limbs; zero when `isRevote=0`) · `NULL` (4 limbs; zero when
302`isRevote=0`).
303
304**`inputsHash`** is the Poseidon2 binding of the **complete CanonicalPackage plus election
305context**, computed exactly as:
306`Poseidon2(version, processID, packedBallotMode, wardenSetHash, censusRoot, voteID, slot,
307authMode, weight, H2(E), ctsDigest, H2(h_1..h_ν), pkgCommit)` where `H2` is the Poseidon2
308sponge over the listed values in package order and **`ctsDigest = SHA-256(cts)`** enters as
3098×32-bit limbs. The voter computes `ctsDigest` *outside* the circuit (the circuit treats it
310as opaque limbs — this **binds** the ciphertext bytes without proving anything about ML-KEM);
311the batch program recomputes `SHA-256(cts)` and the full `inputsHash` from the package body
312and rejects on any mismatch. Nothing in the admitted package — including the ciphertexts —
313can differ from what the voter authorized. The `slot` public input (derived from the census
314identity per the census-origin rule, proven against the in-circuit census membership path)
315is what the batch program uses for the state transition, and `authMode` pins which §11
316authentication branch the proof took.
317
318**The proof shows:**
3191. **Ballot validity** — v2's ballot protocol (ranges, uniqueness, cost sum vs
320   `maxValueSum`/weight, `ballotMode` unpacking), with three normative strengthenings over
321   the v2-era prototype: the weight bound is enforced when `maxValueSum = 0`; all comparisons
322   use sound borrow-checked integer gadgets (no Goldilocks wraparound); and the cost sum is
323   computed overflow-safe under the enforced integer-cost profile (§2.3).
3242. **Share consistency** — for every field (including inactive ones, with constant term 0),
325   the ν shares lie on one polynomial of degree ≤ θ−1 whose constant term is the ballot
326   value. Cost: ν·16·(θ−1) ≈ 1.8k multiplications at ν=16, θ=8 — trivial for the AIR.
3273. **Mask consistency** — $e_{i,f} = s_{i,f} + \mathrm{PRF}(K_i, \mathrm{maskCtx}(i,f))$ with
328   the same $(s_i, K_i)$ committed in $h_i$.
3294. **voteID derivation** from `(processID, address, k)` and the `inputsHash` binding above.
3305. **Authentication** (§11): knowledge of `sk` with `H(sk)` bound in the census leaf — or,
331   for an unenrolled hybrid voter (`pk_PQ = 0`), knowledge of the self-chosen `sk_pkg` bound
332   in the chain's first `pkgCommit` (§11), with identity resting on `hybridSig`. For a
333   revote, additionally the predecessor opening (same slot, same key) and the `NULL`
334   derivation of §5.3.
335
336What the proof deliberately does **not** show: that `ct_i` decapsulates to the committed
337$K_i$. Proving ML-KEM in-circuit would drag SHAKE through the AIR. Instead, mismatched
338transport is *harmless to integrity* (no tally proof ever runs Decaps — §10.2) and *publicly
339excludable* (complaints — §9.2). A STARK-friendly verifiable encryption removing this
340trade-off is the main tracked upgrade (§15).
341
342**Indicative numbers** (estimates until the v3 circuit is benchmarked; the prototype [DST]
343measured 3.2 s native proving and ~12 ms verification for a *larger* trace): trace ≤ 2048 ×
344~200 columns, ~10–20 s desktop-browser proving (mobile will be slower — to be benchmarked;
345the ~400 KB proof uploads once to one sequencer and is never stored on-chain).
346
347---
348
349## 7. State tree changes
350
351Same SHA-256 sparse Merkle tree, depth 64, same namespaces as v2, three changes:
352
353![State tree v3 layout](figures/state-tree-v3.svg)
354
3551. **Vote-ID leaves carry the package digest**: `voteID → pkgDigest` (v2 stored 0). This lets
356   revotes and complaints authenticate a package *body* against the chain.
3572. **Slot leaves are chained opaque digests** (no ballot data):
358   - first vote / overwrite: `leaf = SHA-256("davinci-slot-v3" ‖ pkgDigest ‖ s_batch)`
359   - refresh: `leaf' = SHA-256("davinci-refresh-v3" ‖ leaf ‖ s_batch)`
360   with `s_batch` the sequencer's secret batch seed (proven in-guest, never published — the
361   same trust class as v2's re-encryption seed). A refresh needs only the **public current
362   leaf** plus the refresher's own secret, so **any sequencer can refresh any occupied slot**
363   — permissionless sequencing is preserved and a vanished sequencer blocks nothing. Both
364   update types produce fresh-looking 32-byte values; this plus the padded accumulator is
365   what replaced re-encryption-based silent revoting.
3663. **Config namespace**: `0x3` = `wardenSetHash` (§4) instead of an encryption key; `0x4` =
367   `SHA-256(A)` (the accumulator value itself is published in every batch's blobs); `0x5`
368   (reserved in v2) = the root of the **nullifier tree**, a dedicated SHA-256 SMT of depth
369   256. A nullifier is a Poseidon2 digest serialized to 32 bytes (4×8 B LE), used directly
370   as the 256-bit key; leaf value = 1.
371
372---
373
374## 8. The batch program (ZisK guest)
375
376Same role, same settlement flow, same public-output pattern (`ok`/`failMask`, old/new roots,
377counters, census root, blobs digest) as v2. The constraint groups change as follows.
378
379![Batch program v3 dataflow](figures/batch-flow.svg)
380
381### 8.1 Ballot proof verification
382Verifies the n ballot STARKs **in-guest**. FRI verification is hash-dominated and ZisK
383exposes a Poseidon2-Goldilocks precompile; the measured count on the prototype verifier is
384**7,515 permutations per proof**, giving a *modeled* in-guest cost of roughly 1M steps per
385ballot (to be benchmarked). The ballot verifier configuration (AIR identity, FRI profile,
386Poseidon2 constants) is pinned via `ballotVKHash` at config leaf `0x7`, as in v2.
387
388### 8.2 Census, authentication, binding
389As v2 for census membership and slot derivation. Authentication follows the election's
390**auth policy** (§11): `pq-only` relies on the in-STARK preimage proof alone; `hybrid`
391*additionally* verifies `hybridSig` (ECDSA over `pkgDigest`, secp256k1 precompile, recovered
392address = census address) for every package; `hybrid-legacy` dispatches per census leaf as
393specified in §11. The program recomputes `ctsDigest`, `inputsHash` and `pkgDigest` from the
394package body and matches them against the proof's public inputs and the inserted leaf value
395— so an admitted package is byte-for-byte the one the voter's proof authorized (§6).
396
397### 8.3 State transitions
398In fixed order, each proven against the previous root, as v2: (1) insert
399`voteID → pkgDigest`; (2) insert revocation nullifiers with the one-live-chain checks of
400§5.3 (predecessors must be settled under the starting root); (3) write slot leaves (votes +
401overwrites), then refresh the sample $\mathcal{R}$ (§7.2; sample-size rule as v2); (4) update
402`0x4` with the new accumulator digest and `0x5` with the new nullifier root.
403
404### 8.4 Accumulator update and the batch pad
405$$A' = A + \sum_{\text{new pkgs}} E \; - \sum_{\text{consumed pkgs}} E \; + \; B$$
406where $B \in \mathbb{F}^{\nu \times 16}$ is a fresh **uniform** batch pad derived in-guest
407from the secret batch seed. Without $B$, the public batch delta minus the (public) new-package
408sums would equal $-\sum_{\text{consumed}} E$, letting anyone identify revoked packages by
409matching public `E` rows. $B$ is deliberately *unstructured* — a Shamir-codeword-shaped pad
410would vanish under the code's public parity checks and leak the same information.
411
412### 8.5 The warden payload (KEM-DEM, proven)
413Per batch, the guest: derives a 256-bit batch key $k_b$ and the ML-KEM encapsulation
414randomness from the secret batch seed (guest-internal derivation under the pinned program, so
415it is as trustworthy as the proof itself); DEM-encrypts (§2.1)
416`payload = (B ‖ consumed pkgDigests ‖ context)` under $k_b$; Shamir-shares $k_b$
417**coordinate-wise over its 32-bit limbs** θ-of-ν; and for each warden $i$: one in-guest
418ML-KEM encapsulation to $pk_i$ → wrapping secret → DEM-encrypts share $i$. The proof binds
419$B$ to the accumulator update, the consumed list to the nullifier insertions, and every
420ciphertext to its registered recipient key and context. **Unlike voter transport, a malformed
421batch payload is unprovable, not merely complainable** — it would hide an accepted
422transition's revocations and pads from the tally. All of it is published in the batch's blobs.
423
424### 8.6 Blob layout v3 and honest DA numbers
425Blob cells carry 31 payload bytes each (a v3 codec choice — v2 packed typed values; v3 packs
426an opaque byte stream per section), 4096 cells per blob ⇒ 126,976 B per blob. Sections, in
427order: header · new packages (CanonicalPackage bytes) · slot-update list
428(slot index 8 B + new leaf 32 B — so a refresh costs 40 B framed, vs ~1–2 KB in v2) ·
429nullifiers (32 B each) · accumulator value $A'$ (ν·16·8 B) · warden payload (§8.5).
430Byte-exact cell maps live in the davinci-zkvm normative docs, as in v2.
431
432Per-package size: `72 + ν·(160 + ct_len)` bytes (72 B fixed fields; per warden: 128 B of
433masked shares + 32 B commitment + one ciphertext) ⇒ **20,040 B** at ν=16/ML-KEM-768;
43414,920 B at ν=16/ML-KEM-512; 6,312 B at ν=5/768; 1,320 B at ν=1.
435
436| Profile (256 votes + 256 refreshes) | batch bytes | blobs (126,976 B each) | vs v2 (~5 blobs) |
437|---|---|---|---|
438| ν=16, ML-KEM-768 | ≈ 5.2 MB | **≈ 41 — exceeds the 32-blob batch cap** ⇒ max ~195 votes/batch, or use ML-KEM-512 | ~8× |
439| ν=16, ML-KEM-512 | ≈ 3.9 MB | ≈ 31 | ~6× |
440| ν=5, ML-KEM-768 | ≈ 1.7 MB | ≈ 14 | ~2.7× |
441| ν=1 (sequencer mode) | ≈ 0.35 MB | ≈ 3 | ~0.7× — *cheaper than v2* |
442
443DA is v3's main cost regression and is linear in ν: size committees to the election's
444stakes. Classic McEliece transport (96–128 B ciphertexts ⇒ 4.2–4.7 KB/package at ν=16 by the
445same formula) is the tracked reduction path for large committees [MCE].
446
447---
448
449## 9. End of election: freeze, complaints, exclusions
450
451The v2 timeline (end → grace window) gains two phases before results:
452
453![Election timeline v3](figures/timeline.svg)
454
455### 9.1 Casting freeze
456When the grace window closes the registry stops accepting transitions (as v2) and the
457accumulator freezes as $A_{\text{cast}}$, bound to the frozen final root.
458
459### 9.2 Complaint window and the exclusion set X
460During a scheduled window (an election parameter, like the grace bounds), **registered
461wardens of the election** may submit complaints: `submitComplaint(processID, pkgDigest,
462publicValues, proof)` where the ZisK proof shows `Decaps(sk_i, ct_i)` yields a key
463inconsistent with the package's admitted $h_i$ (witness: the warden's registered key seed;
464statement bound to the admitted `pkgDigest` and the frozen root). The registry verifies the
465proof and appends the package to an **idempotent, append-only exclusion set $X$**. Complaints
466**never touch the accumulator** — so no complaint needs to know whether its package was
467already consumed, and ordering cannot matter. Submission is allow-listed to the election's ν
468wardens; the submitter pays gas. **Capacity is sized to the workload, not an arbitrary cap**:
469the registry bounds total admitted casts (`maxVoters × maxRevotes`, a new creation
470parameter), and the complaint window length and the wardens' proving/fee budget must cover
471that bound in the worst case (an adversary can make the complaint path linear in admitted
472casts — this is an explicit liveness assumption, §9.3, not an exceptional path). At the
473deadline $X$ freezes on-chain; every tally proof binds the frozen
474$(\text{root}, A_{\text{cast}}, X)$ snapshot.
475
476Semantics, stated plainly: a voter whose *live* package ends up in $X$ is not counted (their
477earlier packages stay consumed) — a deliberately malformed revote is a provable
478self-abstention, and a voter+warden coalition gains a bounded post-close withdrawal option
479for that voter's own ballot. A package malformed toward warden $i$ that is *not* excluded
480still tallies correctly from wardens that can open it (§10.2); warden $i$ either complains in
481the window or sits out.
482
483### 9.3 Liveness
484The tally needs ≥ θ wardens that complete the archive scan (and any complaints) inside the
485window, complete the ceremony (§10.3), and publish proven contributions — plus, as in v2,
486timely inclusion of their transactions, **plus complaint capacity (proving + fees + window
487length) provisioned for the election's admitted-cast bound in the worst case (§9.2)**.
488Fewer ⇒ results are lost, exactly as v2's "θ of ν wardens take part in decryption".
489
490---
491
492## 10. Tally: warden sums and Lagrange
493
494### 10.1 What each participating warden computes
495After the exclusion freeze, each participating warden $i$:
4961. downloads the complete blob archive (same DA story as any v2 observer; work is linear in
497   *total casts*, not final voters);
4982. decapsulates its per-package ciphertexts, recovers shares
499   $s_{v,i,f} = e_{v,i,f} - \mathrm{PRF}(K_{v,i}, \mathrm{maskCtx})$, and checks each against
500   the admitted $h_{v,i}$;
5013. joins the **tally ceremony** (§10.3): the participants reconstruct the per-batch payload
502   keys (θ shares each), decrypt the payloads — obtaining every batch pad $B$ and the full
503   consumed set $R$, verified against the batch proofs that committed them — and run the
504   zero-blinding round producing $G_f$;
5054. computes, over $\mathrm{Active} = \mathrm{Admitted} \setminus (R \cup X)$:
506
507$$S_{i,f} = A_{\text{cast},i,f} - \sum_{v \in X \setminus R} e_{v,i,f} - \sum_{v \in \mathrm{Active}} \mathrm{PRF}(K_{v,i}, \mathrm{maskCtx}) - \sum_{b} B_{b,i,f} + G_f(i)$$
508
509One-line sanity check: $A_{\text{cast}}$ = (masked shares of all admitted-minus-consumed
510packages) + (all batch pads); removing the still-present excluded rows, all pads, and all
511batch pads leaves exactly $\sum_{\mathrm{Active}} s_{v,i,f}$; adding $G_f(i)$ with
512$G_f(0)=0$ doesn't change the interpolation at 0.
513
5145. publishes $S_i$ with a **ZisK proof** whose statement binds: the election, the frozen
515   $(\text{root}, A_{\text{cast}}, X)$ snapshot, the complete archive commitment, its
516   recipient index, and the accepted ceremony transcript (§10.3) — and whose witness contains
517   its KEM key seed (authenticating it as warden $i$ against the registered commitment), the
518   per-package $(s, K)$ openings **for every counted active package** (each checked against
519   its admitted $h_{v,i}$), the reconstructed payload keys and payload openings, and its
520   blinding evaluations. The program enforces **complete, exactly-once processing** of every
521   admitted package in the archive (counted, consumed, or excluded — nothing skipped) and
522   that $R$ and $B$ are the values authenticated by the accepted batch payloads.
5236. `submitTallyShare(processID, i, S_i, publicValues, proof)`; after θ verified shares,
524   anyone calls `finalizeResults(processID)`: **the registry performs the Lagrange
525   interpolation on-chain** (θ ≤ 16 points over Goldilocks — a few u64 mulmods per field),
526   records the per-field results, and emits `ProcessResultsSet`.
527
528Wardens run their **own provers**: the witness contains their secrets, and a shared proving
529service used by θ wardens would itself hold reconstruction capability. Proving cost scales
530with total casts (a few Poseidon2 permutations per package; as an **unvalidated projection**
531— archive, payload and ceremony checks included — on the order of 10^8 guest steps for a
532million-cast election, to be benchmarked with the v3 implementation before warden hardware
533guidance is given).
534
535### 10.2 Why malformed voter transport cannot corrupt anything
536**Decapsulation never appears in any tally proof** — contributions open the admitted
537commitments $h$ instead, and under commitment binding every accepted $S_i$ lies on the same
538aggregate polynomial. A voter publishing a bad `ct_i` only deprives warden $i$ of its opening
539witness (warden $i$ complains or sits out; the voter could even re-supply the opening
540out-of-band, which is safe — correctness is tied to $h$, not to the transport). Every clean
541θ-subset interpolates the same tally, because the ballot STARK proved all ν shares lie on one
542valid polynomial. Malformed transport is an availability lever against one warden, never an
543integrity lever against the election.
544
545### 10.3 The zero-blinding ceremony
546Published raw, θ sum-shares determine the aggregate polynomial $F$; any single warden —
547participant or not — could evaluate it at its own index, compare with the sum of its decoded
548per-package shares, and fingerprint the revoked set. The ceremony prevents that:
549
5501. A `tallySession` is recorded on-chain: session id = `H(processID ‖ root ‖ X ‖ roster)`,
551   with the participant roster and dealer set fixed (dealers = the participants).
5522. Each dealer $k$ samples a seed and derives, per field, blinding coefficients
553   $c_{k,f,1..\theta-1}$, defining $g_{k,f}(x) = \sum_j c_{k,f,j} x^j$ — **the constant term
554   is structurally absent, so $g_{k,f}(0) = 0$ by construction** (this is the
555   "zero-certificate": the committed coefficient vector simply has no degree-0 entry).
5563. Dealer $k$ publishes (in a session blob): a hiding Poseidon2 commitment to its
557   coefficients; **per-recipient hiding evaluation commitments**
558   $cm_{k,i} = \mathrm{Poseidon2}(g_{k,1..16}(i), r_{k,i})$; the KEM-DEM ciphertexts to each
559   co-participant $i$ encrypting $(g_{k,1..16}(i), r_{k,i})$; and a **ZisK dealer proof**
560   that the committed coefficients, the evaluation commitments, and the ciphertexts are all
561   consistent, under the recipients' registered keys and this session's context.
5624. Contributions use $G_f(i) = \sum_{k \in D} g_{k,f}(i)$ over the **accepted dealer set
563   $D$** — fixed on-chain after the dealer deadline; every contribution proof binds the same
564   $D$ and session id, and **opens the evaluation commitments $cm_{k,i}$** (the recipient
565   learned the opening by decapsulating off-circuit — decapsulation still never enters any
566   tally proof). A dealer whose proof is missing or invalid is excluded and the session
567   restarts with fresh masks (roster must stay ≥ θ).
568
569As long as one accepted dealer is honest, no one outside the ceremony — and no
570non-participating warden — learns anything about $F$ beyond what the public tally
571$F(0)$ itself reveals. Participants do jointly learn the
572revoked set $R$; that is the documented θ-gated metadata leakage (§12.2).
573
574---
575
576## 11. Census and authentication
577
578- **Census trees** migrate from Poseidon-BN254 to Poseidon2-Goldilocks (a breaking format
579  change; same lean-IMT structure). Leaf encoding:
580  `leaf = Poseidon2(address, weight, pk_PQ)` with `pk_PQ = H(sk)` for a CSPRNG-generated
581  secret, or `pk_PQ = 0` for a not-yet-enrolled voter (hybrid censuses only).
582- **PQ-key enrollment.** The Ethereum wallet signs an enrollment message binding
583  `address ↔ pk_PQ`; the signature *authorizes* the binding and is never key entropy (a
584  future ECDSA break must not reveal PQ secrets). Enrollment paths per census origin:
585  off-chain censuses collect `pk_PQ` at census construction; on-chain/token censuses read a
586  global **PQKeyRegistry** contract where voters register once (one transaction, reusable
587  across all elections); CSP censuses include `pk_PQ` in the credential.
588- **Election auth policy** (immutable registry parameter, fixed at creation):
589  - `pq-only`: every leaf must carry `pk_PQ`; authentication is the in-STARK preimage proof
590    alone; no ECDSA anywhere in the ballot path.
591  - `hybrid`: every leaf must carry `pk_PQ`, and every package is verified on **both**
592    authenticators — the in-STARK preimage proof *and* `hybridSig` (ECDSA over `pkgDigest`,
593    verified by the batch program). No OR-downgrade exists in this mode.
594  - `hybrid-legacy`: like `hybrid`, but leaves with `pk_PQ = 0` are admitted with identity
595    resting on ECDSA alone; the STARK's auth clause (§6.5) switches to a **self-chosen
596    package key**: the voter generates `sk_pkg` (CSPRNG; kept with the package opening), the
597    first package binds `H(sk_pkg)` inside `pkgCommit`, and every later package in the chain
598    proves knowledge of the *same* `sk_pkg` (predecessor opening) and derives its nullifier
599    as `NULL = Poseidon2(nullCtx, sk_pkg, prevPkgDigest)`. The batch program dispatches per
600    leaf: `pk_PQ ≠ 0` ⇒ both authenticators against the census key; `pk_PQ = 0` ⇒ mandatory
601    `hybridSig` + the `sk_pkg` clause. Anyone can count the legacy-status census members
602    (leaf contents are public census data) — though not, of course, which *final* packages
603    are theirs beyond what slot-participation already reveals. Ballot *privacy* is fully PQ
604    for these voters; the election's **integrity assumptions include ECDSA security for its
605    legacy voters** (§12.1). This mode is what makes existing token censuses usable before
606    universal enrollment.
607- **Enrollment snapshot rule.** A voter's authentication status and key for an election are
608  pinned at the election's **creation snapshot**: for on-chain/token censuses the registry
609  records the PQKeyRegistry root at the creation block, and membership proofs must present
610  the enrollment status under that snapshot regardless of which (newer) eligibility root the
611  census contract later accepts. Enrolling *after* an election was created affects
612  subsequent elections only — an existing package chain never changes keys mid-election.
613- **CSP censuses**: credentials become SLH-DSA signatures [FIPS 205] over the v2 message
614  format extended with `pk_PQ`; verification is pure hashing via the SHA-256 precompile.
615- Slot derivation, participation visibility, census origins 1–4 mechanics: as v2, with the
616  enrollment additions above. The v2 census invariants (slot uniqueness across the census;
617  stable distinct CSP indexes) remain assumptions of integrity.
618
619---
620
621## 12. Security properties, stated plainly
622
623### 12.1 What holds, under what
624
625| Property | Holds if |
626|---|---|
627| **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). |
628| **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. |
629| **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. |
630| **Exact tally** | unconditional arithmetic (mod-$p$ sums, Lagrange). ML-KEM's residual decapsulation-failure probability (≈2^-139 per pair at ML-KEM-512, ≈2^-164 at -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; 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 excludes the dealer and restarts the session. Deliberately malformed batch transport is a different thing entirely — it is unprovable (§8.5), so it cannot appear in an accepted batch. |
631| **Liveness** | ≥1 honest sequencer with proving capacity and timely inclusion (as v2), plus ≥θ wardens through the scan window and ceremony (§9.3). |
632
633### 12.2 What wardens and insiders learn
634θ colluding wardens can reconstruct **every package's ballot** — exactly v2's boundary, where
635θ wardens can decrypt every ballot. New, and narrower: the **tally participants** (a θ-sized
636set) jointly learn the revoked-package set $R$ — metadata, not contents — and any one of them
637can leak it onward; non-participating wardens and the public learn nothing about $R$ (batch
638pads §8.4 + blinding §10.3 close those channels, given ≥1 honest accepted dealer). The
639sequencer/prover that seals a vote learns its revote linkage (§5.4) — as in v2.
640
641### 12.3 The honest coercion statement
642v3 keeps v2's informal posture (no formal receipt-freeness; revotes hidden among refreshes)
643with **one new residual, stated openly**: a coercer who obtains a package's *revocation
644token* — by extracting the voter's identity key, **or** by demanding a ZK proof of the
645token's derivation, **or** a valid unsubmitted revote authorization — can watch the public
646nullifier tree and detect whether that package was later consumed. v2's re-encryption resists
647even that (testing re-encryptions is a DDH-type problem). This is the main new
648coercion-relevant difference from v2 (alongside the §12.2 participant metadata); mitigations
649are Track-2 research (§15). Deployments for coercion-sensitive elections should weigh it.
650
651### 12.4 Proof-system notes
652The ballot STARK profile targets ~102-bit *conjectured* FRI soundness (ethSTARK heuristic
653[ETHS]) — an explicit engineering dial (queries × log-blowup + grinding), to be raised for
654high-stakes deployments, and **not** claimed as 128-bit PQ security. The v2-era prototype's
655three known defects (weight-bound bypass at `maxValueSum=0`; wraparound-prone comparators;
656weak hiding-PCS blinding RNG with a constant fallback seed) are normatively fixed in v3
657(§6.1; 256-bit CSPRNG blinding seed, fail-closed).
658
659### 12.5 Out of scope / inherited
660EIP-4844 KZG commitments (Ethereum's own PQ roadmap), organizer/sequencer Ethereum accounts,
661hybrid-mode ECDSA (by construction), and the BN254 PlonK wrapper around ZisK proofs —
662integrity-only, replaceable by direct on-chain STARK verification (indicative public data
663point: ~5–6 MGas for a WHIR/FRI verifier on the EVM [WHIR]; not a measured cost for ZisK
664proofs) — tracked as the final migration phase.
665
666---
667
668## 13. Cost summary
669
670| Metric | v2 | v3-PQ (estimates unless marked measured) |
671|---|---|---|
672| Browser proving | seconds (Groth16, 35.5 MiB key download) | ~10–20 s desktop (STARK; no key download; prototype measured 3.2 s native on a larger trace) |
673| Ballot upload to sequencer | ~2 KB | ~20 KB package + ~400 KB proof (proof not stored on-chain) |
674| DA per ballot | ~2 KB | 1.7–20.5 KB depending on ν and KEM (§8.6 table) |
675| DA per refresh | ~1–2 KB | 40 B (framed) |
676| Batch proving | 2.3–4.0×10^8 steps | + ~1M steps × votes for STARK verification (7,515 Poseidon2 permutations/proof **measured**) |
677| Tally | θ partial decryptions of one accumulator + BSGS | archive-linear warden jobs (§10.1) + one ceremony + on-chain Lagrange |
678| Registry tally cap | 10^12 | 2^61 |
679
680---
681
682## 14. Errors and edge cases (normative)
683
684- **voteID collision** (admission finds the leaf occupied): resample `k` (recovery mode:
685  bump the counter) and re-cast — as v2. Skipped counters are harmless (§5.2 recovery scan).
686- **Unsettled predecessor**: a revote consuming a predecessor not yet settled under the
687  batch's starting root is rejected at admission and retried by the sequencer in a later
688  batch automatically; clients should submit revotes to the sequencer that holds their
689  pending vote, as in v2.
690- **Duplicate revocation race** (two sequencers hold revotes of the same package): the first
691  settles; the loser's re-validation drops the vote at admission (nullifier present) and
692  notifies the voter — the v2 "voteID already in state" pattern.
693- **Live package excluded** ($P_t \in X$): the client detects it (public $X$) and informs
694  the voter they are not counted; no recovery within the election (casting is closed when
695  complaints run).
696- **Warden key unavailable at cast time**: the client refuses to cast (it cannot build a
697  complete package); election creation already requires all ν keys registered (§4).
698- **Ceremony dealer failure**: dealer excluded, session restarted with fresh masks (§10.3);
699  if the roster drops below θ, the tally is lost — counted under liveness (§9.3).
700
701---
702
703## 15. Tracked upgrades
704
7051. **STARK-friendly verifiable encryption** (RLWE-LPR with a Poseidon2-based FO transform) to
706   prove warden transport at admission — removes the complaint window entirely. Requires its
707   own security review before adoption.
7082. **PQ re-randomizable package representation** — would restore v2-grade resistance to
709   revocation-token coercion (§12.3). Open research.
7103. **Locked mode** as a separately specified and reviewed extension (§4).
7114. Direct on-chain STARK verification (drop the PlonK wrapper) once rollup gas permits.
7125. Classic McEliece transport profile for large committees [MCE].
713
714---
715
716## 16. References
717
718- [DAV2] Vocdoni, *DAVINCI protocol specification v2*. https://spec.davinci.vote
719- [FIPS 203] NIST, *Module-Lattice-Based Key-Encapsulation Mechanism Standard (ML-KEM)*, 2024. https://doi.org/10.6028/NIST.FIPS.203
720- [FIPS 205] NIST, *Stateless Hash-Based Digital Signature Standard (SLH-DSA)*, 2024. https://doi.org/10.6028/NIST.FIPS.205
721- [Sha79] A. Shamir, *How to Share a Secret*, CACM 22(11), 1979.
722- [DST] Vocdoni, *davinci-stark: Plonky3 ballot proof prototype*. https://github.com/vocdoni/davinci-stark
723- [P3] Polygon Zero, *Plonky3*. https://github.com/Plonky3/Plonky3
724- [ZISK] Polygon, *ZisK zkVM*. https://github.com/0xPolygonHermez/zisk
725- [POS2] L. Grassi et al., *Poseidon2: A Faster Version of the Poseidon Hash Function*, ePrint 2023/323.
726- [ETHS] StarkWare, *ethSTARK Documentation*, ePrint 2021/582.
727- [EIP4844] V. Buterin et al., *EIP-4844: Shard Blob Transactions*, 2022.
728- [IR89] R. Impagliazzo, S. Rudich, *Limits on the Provable Consequences of One-Way Permutations*, STOC 1989.
729- [NOAH] M. Dahl et al., *Noah's Ark: Efficient Threshold-FHE Using Noise Flooding*, WAHC/CCS 2023.
730- [TEV] J. Alizadeh, *Threshold Post-Quantum E-Voting from Lattice Commitments*, ePrint 2026/2500.
731- [PQK] N. Huber et al., *PQKryvos: Post-Quantum Secure E-Voting With Flexible Ballot Formats and Public Tally-Hiding*, PoPETs 2026.
732- [MCE] D. J. Bernstein et al., *Classic McEliece*. https://classic.mceliece.org
733- [KEMB] *ML-KEM WebAssembly implementations and benchmarks*. https://github.com/dchest/mlkem-wasm
734- [WHIR] *EVM Verification of WHIR over a 31-bit Field*, ethresear.ch, 2025.