arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
docs(spec): address the second technical review

Fix a sentence fragment, the signature length symbol, the ballot key
serialization, the refresh cost figures, and table and paragraph layout.
Pau Escrich p4u@dabax.net
Sat, 17 Oct 2026 01:36:04 +0000
commit

9006e4354ed234bd43b8c8bc75a30f165fb5172d

parent

f6197222dde70afdde7bac3871eba8fe558182e4

M v2/sections/analysis.tex → v2/sections/analysis.tex

@@ -85,7 +85,7 @@ We evaluate \davinci along four axes: voter-side proving, sequencer proving, on-chain verification, and data availability, together with the end-to-end throughput of the system. Unless stated otherwise, sequencer measurements use one NVIDIA RTX 5090 GPU (32~GB) on a host with an AMD Ryzen 9 9950X3D CPU.

\paragraph{Voter proving.} A ballot proof is generated with snarkjs; natively, one 16-core CPU produces about six proofs per second, and a single proof takes about $0.16$~s. In a browser, proving is slower and is dominated by the download of the proving artifacts, but it requires no specialized hardware and remains within the latency a voter tolerates at casting time. -\paragraph{Sequencer proving.} Table~\ref{tab:proving} and Fig.~\ref{fig:proving-time} report the time to prove one batch, including witness generation, the \ac{STARK} proof, its recursion, and the PlonK wrapper. The \emph{first} batch of an election has nothing to refresh; a \emph{steady} batch refreshes as many slots as it writes, which is the regime that determines throughput. The fixed cost per batch is about $15.5$~s, and each additional refresh costs about 13~ms at $n_f = 2$ and 40~ms at $n_f = 16$. Throughput peaks around 512 votes per batch at $n_f = 2$ and 256 at $n_f = 16$; beyond that, the batch size is bounded by the host memory of the prover (about 54~GB for a steady batch of 1024 votes), not by the GPU. The proof is 768 bytes, plus 512 bytes of public values, at every batch size. These figures were measured on ZisK~1.3.0, the predecessor of the release in Table~\ref{tab:pins}, with the same batch program logic. +\paragraph{Sequencer proving.} Table~\ref{tab:proving} and Fig.~\ref{fig:proving-time} report the time to prove one batch, including witness generation, the \ac{STARK} proof, its recursion, and the PlonK wrapper. The \emph{first} batch of an election has nothing to refresh; a \emph{steady} batch refreshes as many slots as it writes, which is the regime that determines throughput. A batch of two votes takes about $15.5$~s, mostly the fixed cost of recursion and of the PlonK wrapper, and each refresh adds 13--16~ms at $n_f = 2$ and 40--50~ms at $n_f = 16$, the upper values at the largest batches. Throughput peaks around 512 votes per batch at $n_f = 2$ and 256 at $n_f = 16$; beyond that, the batch size is bounded by the host memory of the prover (about 54~GB for a steady batch of 1024 votes), not by the GPU. The proof is 768 bytes, plus 512 bytes of public values, at every batch size. These figures were measured on ZisK~1.3.0, the predecessor of the release in Table~\ref{tab:pins}, with the same batch program logic. \begin{table}[h] \centering

@@ -116,7 +116,7 @@ \end{figure}

\paragraph{End-to-end throughput.} With two provers, each serving one sequencer that runs two elections of 2048 voters at $n_f = 2$ in batches of 512, the system proved and settled 8192 votes in $678.7$~s, a sustained throughput of $12.07$ votes per second ($724$ per minute), on a local chain with one-second blocks. Each prover was busy for the whole run, so throughput scales with the number of provers: one RTX 5090 settles about six votes per second at $n_f = 2$. -\paragraph{On-chain verification.} Thanks to the succinctness of PlonK, verifying a batch proof costs an essentially constant amount of gas, independent of the number of ballots in the batch; the cost of a settlement grows only with the number of blobs, by one point evaluation each. In blob mode, measured with the same contracts on Gnosis Chain, which supports blobs, a settlement with one blob costs 0.40--0.44M gas and one with two blobs 0.46--0.50M gas. On OP Mainnet in L1-blob mode, verifying the L1 proof with three Ethereum headers costs 430K--460K gas, and a whole settlement 800K--860K gas. +\paragraph{On-chain verification.} Thanks to the succinctness of PlonK, verifying a batch proof costs an essentially constant amount of gas, independent of the number of ballots in the batch; the cost of a settlement grows only with the number of blobs, by one point evaluation each. In blob mode, measured with the same contracts on Gnosis Chain (a chain with native blob transactions, on which \davinci was deployed before OP Mainnet), a settlement with one blob costs 0.40--0.44M gas and one with two blobs 0.46--0.50M gas. On OP Mainnet in L1-blob mode, verifying the L1 proof with three Ethereum headers costs 430K--460K gas, and a whole settlement 800K--860K gas. \paragraph{Data availability.} \Davinci publishes the data needed to reconstruct each state transition through EIP-4844 blobs. Compared with calldata, blobs substantially reduce data-availability costs by separating large protocol data from permanent Ethereum state. A blob holds 4096 cells; a steady batch needs $1 + \lceil 3n/4 \rceil + 4 n_f n$ cells for $n$ new votes and $n$ refreshes, so a batch of 128 votes at $n_f = 2$ fits in a single 128~KiB blob, while 512 votes at $n_f = 16$ need nine. In the measurements on OP Mainnet in L1-blob mode, in October 2026, posting the blobs of a batch cost 1.9--3.7~$\mu$ETH on Ethereum and settling it 0.04--0.05~$\mu$ETH on OP Mainnet, and batches settled 85--115~s after being sealed, a delay dominated by the time the rollup takes to adopt a new Ethereum block as its L1 origin.\\
M v2/sections/appendix.tex → v2/sections/appendix.tex

@@ -153,7 +153,7 @@ \item $\hlset{\SSign}_{\sk}(\msg)$: produces a signature $\sigma$ on message $\msg$ under the secret key $\sk$; in Ethereum's 65-byte format, $\sigma$ carries the two ECDSA scalars and a recovery identifier.

\item $\hlset{\SVer}_{\pk}(\msg, \sigma)$: returns $\true$ if $\sigma$ is a valid signature on $\msg$ under the public key $\pk$. \item $\hlset{\SPubKey}(\msg, \sigma)$: recovers the signer's public key $\pk$ from a message and its signature; this is the operation Ethereum exposes as \texttt{ecrecover}. \end{itemize} -An Ethereum address is derived from a public key as the low-order 20 bytes of its Keccak digest, $\address = \mathsf{low\text{-}20}\bigl(\hlget{\Keccak}(\pk)\bigr)$. Messages are signed in the Ethereum personal-message format: the signed digest of a message $\msg$ of $\ell$ bytes is $\Keccak(\texttt{"\textbackslash x19Ethereum Signed Message:\textbackslash n"} \conc \ell \conc \msg)$, with $\ell$ written in decimal. A voter signs the 32-byte message formed by 24 zero bytes followed by the 8-byte big-endian vote identifier, and a \ac{CSP} signs the 92-byte message of Eq.~\eqref{eq:csp-message}. Inside the \ac{zkVM}, signatures are verified by recovering the public key with a SECP256K1 precompile and comparing its address. +An Ethereum address is derived from a public key as the low-order 20 bytes of its Keccak digest, $\address = \mathsf{low\text{-}20}\bigl(\hlget{\Keccak}(\pk)\bigr)$. Messages are signed in the Ethereum personal-message format: the signed digest of a message $\msg$ of $L$ bytes is $\Keccak(\texttt{"\textbackslash x19Ethereum Signed Message:\textbackslash n"} \conc L \conc \msg)$, with $L$ written in decimal. A voter signs the 32-byte message formed by 24 zero bytes followed by the 8-byte big-endian vote identifier, and a \ac{CSP} signs the 92-byte message of Eq.~\eqref{eq:csp-message}. Inside the \ac{zkVM}, signatures are verified by recovering the public key with a SECP256K1 precompile and comparing its address. \subsection{Encryption scheme} \label{sec:cryptographic-primitives:encryption}
M v2/sections/census.tex → v2/sections/census.tex

@@ -43,7 +43,7 @@ \centering

\caption{Summary of census configurations supported by the \davinci protocol.} \label{tab:census-models} \small - \begin{tabular}{c p{0.17\textwidth} p{0.2\textwidth} p{0.22\textwidth} p{0.26\textwidth}} + \begin{tabular}{c >{\raggedright\arraybackslash}p{0.17\textwidth} >{\raggedright\arraybackslash}p{0.2\textwidth} >{\raggedright\arraybackslash}p{0.22\textwidth} >{\raggedright\arraybackslash}p{0.26\textwidth}} \toprule \textbf{Origin} & \textbf{Model} & \textbf{\censusroot} & \textbf{\censusuri} & \textbf{Root a state transition may use} \\ \midrule
M v2/sections/circuits.tex → v2/sections/circuits.tex

@@ -100,7 +100,7 @@ \item \private $\{\blobcom_b\}_{b=1}^{\nblobs}$: \ac{KZG} commitments to the blobs.

\end{itemize} \textbf{Constraints} \\ \vspace{-0.4cm} \begin{itemize} - \item \emph{Ballot proof verification.} Every ballot proof is valid under the ballot verification key of the election. The program first checks that the key is the one committed in the state, $\Sha(\mathsf{vk}) = \ballotvkhash$, where the key is serialized as its points $\alpha, \beta, \gamma, \delta$ and the coefficients of $L$, each coordinate as four 64-bit little-endian limbs, and the digest is read as a big-endian integer. It also checks that all proof points are on their curves and not the identity, and that the $\BN{\G}_2$ points of the key are in the prime-order subgroup. It then verifies the $n$ proofs at once with a randomized batch check~\cite{bellare1998batch}: it derives coefficients $\rho_1 = 1$ and $\rho_i = \mathsf{lo}_{128}\bigl(\Sha(\Sha(T) \conc \mathsf{LE64}(i-1))\bigr)$ for $i \ge 2$ from the transcript $T = \texttt{"groth16-batch-v2"} \conc A_1 \conc B_1 \conc C_1 \conc x_1 \conc \cdots \conc A_n \conc B_n \conc C_n \conc x_n$ of all proofs $(A_i, B_i, C_i)$ and public inputs $x_i$, encoded as raw limbs (a zero coefficient is replaced by $1$), and checks the single pairing equation obtained as the $\rho$-weighted product of the $n$ Groth16 verification equations, computing every scalar multiplication itself. A batch containing an invalid proof passes this check with probability at most $2^{-128}$. For every $i \in \{1,\dots,n\}$, this establishes + \item \emph{Ballot proof verification.} Every ballot proof is valid under the ballot verification key of the election. The program first checks that the key is the one committed in the state, $\Sha(\mathsf{vk}) = \ballotvkhash$, where the key is serialized as its points $\alpha, \beta, \gamma, \delta$, the number of coefficients of $L$ as a 64-bit little-endian word, and the coefficients of $L$, each coordinate as four 64-bit little-endian limbs, and the digest is read as a big-endian integer. It also checks that all proof points are on their curves and not the identity, and that the $\BN{\G}_2$ points of the key are in the prime-order subgroup. It then verifies the $n$ proofs at once with a randomized batch check~\cite{bellare1998batch}: it derives coefficients $\rho_1 = 1$ and $\rho_i = \mathsf{lo}_{128}\bigl(\Sha(\Sha(T) \conc \mathsf{LE64}(i-1))\bigr)$ for $i \ge 2$ from the transcript $T = \texttt{"groth16-batch-v2"} \conc A_1 \conc B_1 \conc C_1 \conc x_1 \conc \cdots \conc A_n \conc B_n \conc C_n \conc x_n$ of all proofs $(A_i, B_i, C_i)$ and public inputs $x_i$, encoded as raw limbs (a zero coefficient is replaced by $1$), and checks the single pairing equation obtained as the $\rho$-weighted product of the $n$ Groth16 verification equations, computing every scalar multiplication itself. A batch containing an invalid proof passes this check with probability at most $2^{-128}$. For every $i \in \{1,\dots,n\}$, this establishes $$\hlget{\PVerify}\bigl(\ballotproof_i, (\address_i, \voteid_i, \ballotinputshash_i)\bigr) = \true.$$ % \item \emph{Authentication.} Every ballot is signed by the owner of its address. For every $i$, the vote identifier is a 64-bit integer, a public key is recovered from the signature over the 32-byte message $\texttt{0x00}^{24} \conc \voteid_{i,\text{BE8}}$ in the Ethereum personal-message format, and its address is the voter's:

@@ -142,7 +142,7 @@ \end{enumerate}

% \item \emph{Re-encryption.} Every ballot written to the tree is a re-encryption of its source, with randomness derived from the secret seed. The program derives a chain of scalars from the seed and the current root, \[ \eta_0 = \Sha(\texttt{"davinci-reenc-v1"} \conc \seed \conc \stateroot^\old) \bmod s, \qquad \eta_{c+1} = \Sha(\eta_c) \bmod s, \] - where $s$ is the order of the BN254 scalar field (the base field of BabyJubjub), and consumes one scalar per active ciphertext, first through the $n$ voters' ballots and then through the $|\mathcal{R}|$ refreshed ballots, field by field (see Fig.~\ref{fig:re-encryption}). where the seed, the root, and every $\eta_c$ enter the hash as 32-byte big-endian integers. A ciphertext $(C_1, C_2)$ that consumes $\eta_c$ becomes $(C_1 + \eta_c \cdot \BJ{G},\ C_2 + \eta_c \cdot \epk)$, that is, + where $s$ is the order of the BN254 scalar field (the base field of BabyJubjub), and consumes one scalar per active ciphertext, first through the $n$ voters' ballots and then through the $|\mathcal{R}|$ refreshed ballots, field by field (see Fig.~\ref{fig:re-encryption}); the seed, the root, and every $\eta_c$ enter the hash as 32-byte big-endian integers. A ciphertext $(C_1, C_2)$ that consumes $\eta_c$ becomes $(C_1 + \eta_c \cdot \BJ{G},\ C_2 + \eta_c \cdot \epk)$, that is, \[B'_{i,f} = \hlget{\ReEnc}_{\epk}(B_{i,f}; \eta_c), \qquad R'_{j,f} = \hlget{\ReEnc}_{\epk}(R_{j,f}; \eta_{c'}),\] for the scalars $\eta_c$ and $\eta_{c'}$ that these ciphertexts consume. Inactive fields must be the identity, before and after, in every ballot. The key $\epk$ must be on the curve, not the identity, and in the prime-order subgroup.

@@ -244,7 +244,7 @@ \item \public $\okflag$, $\failmask$: whether every constraint below holds, and the groups that failed.

\item \public $\stateroot$: final root of the state tree. \item \public $\{\text{results}_j\}_{j=1}^{16}$: decrypted tally, one 64-bit entry per ballot field. \end{itemize} - The public values are 43 32-bit words: \okflag and \failmask in words 0 and 1, \stateroot in words 2 to 9, the low and high halves of $\text{results}_j$ in words $10 + 2(j-1)$ and $11 + 2(j-1)$, and, in word 42, the index of the first decryption proof that failed. The registry reads the first \numfields results. + \noi The public values are 43 32-bit words: \okflag and \failmask in words 0 and 1, \stateroot in words 2 to 9, the low and high halves of $\text{results}_j$ in words $10 + 2(j-1)$ and $11 + 2(j-1)$, and, in word 42, the index of the first decryption proof that failed. The registry reads the first \numfields results. \textbf{Private inputs} \begin{itemize}

@@ -267,6 +267,7 @@ \item \emph{Results range}. Each result is a 64-bit integer, $0 \le \text{results}_j < 2^{64}$, which is below the order $t$ of the BabyJubjub prime-order subgroup, so the plaintext of each ciphertext is unique.

\end{itemize} \vspace{-0.3cm} % +\smallskip \noi The per-field decryption proofs $\pi^{\mathrm{dec}}_j$ are produced by the key holder, who decrypts the aggregated results, recovers each value by a bounded discrete-logarithm search, and attests, through a discrete-log-equality proof, that the decryption was performed correctly under the election key. By checking these proofs against the public key committed at leaf $\texttt{0x3}$, the program guarantees that the released tally corresponds exactly to the encrypted results accumulated in the final state, without ever exposing the decryption key inside the proof. Inactive fields hold the identity ciphertext, for which only the value zero can be proven. If any constraint fails, the program outputs zero in place of the root and the results, so a consumer that omitted the check of $\okflag$ still could not match a root or read a tally. \begin{figure}[h]
M v2/sections/protocol-flow.tex → v2/sections/protocol-flow.tex

@@ -178,6 +178,7 @@ \caption{Settlement in L1-blob mode. The blob transactions are posted to Ethereum while the batch is proven; the settlement on the rollup proves, from a chain of Ethereum headers anchored at the rollup's L1 origin, that they are part of the Ethereum chain.}

\label{fig:l1-settlement} \end{figure} +\medskip \noi \textbf{(e) Concurrent sequencers and synchronization.} Several sequencers may serve the same election, and each builds its batches on the latest state root it knows. When two of them prepare a transition from the same root, the first one to land advances the election, and the settlement of the other reverts because its $\stateroot^\old$ is no longer the latest root. The losing sequencer returns its votes to the queue, synchronizes, and builds its next batch on the new root; a lost race costs only the gas of the reverted transaction and, in L1-blob mode, the posted blobs. To synchronize, a sequencer fetches the blobs of every transition settled by others, checks them against the versioned hashes recorded by the settlement, decodes the vote identifiers and the updated slots with their ballots, recomputes the results accumulator from the ballots it already holds, applies the updates to its tree, and requires the resulting root to equal the one recorded on-chain. Queued votes whose identifier appears in the tree are thereby settled. An observer runs the same procedure for every transition, which checks the election, and its encrypted tally, independently of the sequencers. Sequencers apply transitions only once they are buried under a configurable number of blocks, and they detect deeper reorganizations of the settlement chain, in which case they roll back the affected transitions and replay the chain from the published blobs. \subsubsection{End of the voting period}

@@ -247,6 +248,7 @@ \end{enumerate}

\paragraph{\ac{DKG} and council modes.} Once every submitted ciphertext has been decrypted, any sequencer calls \fn{finalizeResultsFromDKG} for the process. The registry reads the stored plaintexts through the adapter, requires all of them to be available and, for a council process, the decryption gate to be open, fills in the zero-valued fields, records the results, sets the status to \texttt{RESULTS}, and emits \fn{ProcessResultsSet}. Both this call and the request are permissionless, and every signing sequencer is ready to make them; to avoid duplicate transactions, each sequencer waits a random delay and sends a call only if it is still missing. +\medskip \noi The election is considered finalized once the decrypted results are available on-chain. At this stage, both the results and the complete integrity of the process are permanently recorded and publicly auditable: anyone can recompute the on-chain commitments and check the proofs. In particular, the combination of the final state root, the verified decryption of the
M v2/sections/state-tree.tex → v2/sections/state-tree.tex

@@ -27,8 +27,7 @@ The lowest indices of the tree are reserved for a small set of process parameters. Most are configuration values fixed at election setup and never modified thereafter

(\processid, \ballotmode, \epk, \censusorigin, \ballotvkhash); the remaining entry is a mutable accumulator (\encresults) updated on every state transition. In all cases these keys occupy deterministic, well-known positions and use a negligible portion of the key space. The entries are: \begin{itemize} - \item \texttt{0x0}: the election identifier (\processid), read as a 248-bit integer. - \footnote{The indices \texttt{0x1} and \texttt{0x5} are currently unused: \texttt{0x1} is + \item \texttt{0x0}: the election identifier (\processid), read as a 248-bit integer.\footnote{The indices \texttt{0x1} and \texttt{0x5} are currently unused: \texttt{0x1} is reserved for backward compatibility (historically used for alternative census structures), and \texttt{0x5} is reserved for future use (an earlier design stored a separate subtractive results accumulator there; the current design keeps a single net results accumulator at

@@ -72,7 +71,6 @@ As a result, collisions do not compromise correctness or liveness, but merely require retrying the identifier derivation.

Note that the maximum number of vote identifiers that can be stored is bounded by the size of this namespace ($2^{D-1}$), which upper-bounds the total number of votes and overwrites that can be processed throughout the election. -This capacity is orders of magnitude larger than any realistic election workload: historical elections peak at $\approx 10^{9}$ votes~\cite{reuters2024india}, ensuring that identifier exhaustion is practically impossible and that collisions are exceptionally rare -\footnote{Based on the birthday paradox, the probability of at least one collision occurring is given by $P=1 - e^{-n^2/2d}$, where $n$ is the number of vote identifiers and $d = 2^{D-1}$. For a large-scale national election of $10^8$ votes emitted, this probability is vanishingly small ($\approx0.054\%$), and for an extreme workload of $10^9$ votes, the probability of a single collision is only $\approx5.3\%$, meaning that the need to resample $k$ remains highly improbable.}. +This capacity is orders of magnitude larger than any realistic election workload: historical elections peak at $\approx 10^{9}$ votes~\cite{reuters2024india}, ensuring that identifier exhaustion is practically impossible and that collisions are exceptionally rare\footnote{Based on the birthday paradox, the probability of at least one collision occurring is given by $P=1 - e^{-n^2/2d}$, where $n$ is the number of vote identifiers and $d = 2^{D-1}$. For a large-scale national election of $10^8$ votes emitted, this probability is vanishingly small ($\approx0.054\%$), and for an extreme workload of $10^9$ votes, the probability of a single collision is only $\approx5.3\%$, meaning that the need to resample $k$ remains highly improbable.}. Together, the state tree provides a compact and tamper-proof commitment to the current status of the election. At the end of the election, the final state root together with the on-chain verification of all transitions serves as a complete cryptographic record of the election, encapsulating both the tally and the integrity of the entire voting procedure.