davinci-paper/v2/build/preamble-macros.tex
v2/build/preamble-macros.texRaw
1% !TeX root = main.tex
2
3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4%% DOCUMENT STYLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6
7% Document sytle
8\setlength{\emergencystretch}{3em} % fewer overfull lines with long monospace identifiers
9\setcounter{secnumdepth}{3} %enumerate sections up to depth 3 (subsubsection)
10\setlist[itemize,1]{label=$\bullet$} %set the first-level itemize label to use math mode \bullet
11\setlist[enumerate,2]{label=(\alph*),ref=\alph*} %the second-level enumerates (enumerate,2) should only show (a) when referenced (not (3a)).
12
13% Working directory
14\newcommand{\definedir}[2]{\newcommand{#1}{#2}}
15\definedir{\secs}{../sections}
16\definedir{\figs}{../figures}
17\definedir{\bib}{../bibliography}
18
19% Colours
20\definecolor{cred}{rgb}{1, 0.5, 0.5}
21\definecolor{cgreen}{rgb}{0.5, 1, 0.5}
22\definecolor{cblue}{rgb}{0.5, 0.5, 1}
23
24% Hyperref setup
25%\hypersetup{
26 % final=true,
27 % colorlinks=true,
28 % linkcolor=cblue,
29 % urlcolor=black,
30 % citecolor=cblue,
31 %}
32
33% Freefootnote
34\let\svthefootnote\thefootnote
35\newcommand\freefootnote[1]{%
36 \let\thefootnote\relax%
37 \footnotetext{#1}%
38 \let\thefootnote\svthefootnote%
39}
40
41% Footnote spaces
42\setlength{\skip\footins}{20pt} %space between text and footnotes
43\setlength{\footnotesep}{1em} %space between individual footnotes
44
45% New foonote referencing a previous footmark
46\makeatletter
47\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
48\makeatother
49
50% Table of contents style
51\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} % it works like p{} but centered
52
53% Make section entries bold in ToC
54\makeatletter
55\renewcommand{\@dotsep}{4.5}
56\renewcommand{\l@section}[2]{\addpenalty{\@secpenalty}
57 \addvspace{1.0em plus 1pt}
58 \@tempdima=1.5em
59 \parindent \z@ \rightskip \@pnumwidth
60 \parfillskip -\@pnumwidth
61 {\leavevmode
62 \advance\leftskip\@tempdima
63 \hskip -\leftskip
64 \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par}
65\makeatother
66
67% Adds vertical space before and after \subsubsection headings and ensures body text starts on a new line
68\makeatletter
69\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
70 {-18\p@ \@plus -4\p@ \@minus -4\p@}% % Before skip
71 {4\p@ \@plus 2\p@ \@minus 2\p@}% % After skip
72 {\normalfont\normalsize\bfseries}} % Font style
73\makeatother
74
75% Draft watermark
76%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
77
78%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79%% COMMENTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81
82\newcommand{\marta}[1]{\todo[size=\small, color=red!40]{\textbf{Marta}: #1}}
83\newcommand{\martai}[1]{\todo[inline, size=\small, color=red!40]{\textbf{Marta}: #1}}
84\newcommand{\pau}[1]{\todo[size=\small, color=green!40]{\textbf{Pau}: #1}}
85\newcommand{\paui}[1]{\todo[inline, size=\small, color=green!40]{\textbf{Pau}: #1}}
86\newcommand{\roger}[1]{\todo[size=\small, color=blue!40]{\textbf{Roger}: #1}}
87\newcommand{\rogeri}[1]{\todo[inline, size=\small, color=blue!40]{\textbf{Roger}: #1}}
88
89%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90%% NOMENCLATURE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92
93% Mathbb
94\newcommand{\N}{\mathbb{N}\xspace}
95\newcommand{\Z}{\mathbb{Z}\xspace}
96\newcommand{\G}{\mathbb{G}\xspace}
97\newcommand{\F}{\mathbb{F}\xspace}
98\newcommand{\J}{\mathbb{J}\xspace}
99
100% Elliptic curves
101\newcommand{\BW}[1]{{#1}^{\text{\tiny \sf BW}}\xspace}
102\newcommand{\BLS}[1]{{#1}^{\text{\tiny \sf BLS}}\xspace}
103\newcommand{\BN}[1]{{#1}^{\text{\tiny \sf BN}}\xspace}
104\newcommand{\BJ}[1]{{#1}^{\text{\tiny \sf BJ}}\xspace}
105\newcommand{\SEC}[1]{{#1}^{\text{\tiny \sf SEC}}\xspace}
106
107% Trees
108\newcommand{\tree}[1][]{{\sf MT}^{{\sf #1}}}
109\renewcommand{\root}[1][]{\sf{root}^{\sf{#1}}}
110\newcommand{\recentroots}{{\sf recentRoots}}
111\newcommand{\leaf}{{\sf leaf}}
112\newcommand{\leaves}{{\sf leaves}}
113\newcommand{\MTGenerate}{{\sf Generate}}
114\newcommand{\MTRoot}{{\sf Root}}
115\newcommand{\MTInsert}{{\sf Insert}}
116\newcommand{\MTProof}{{\sf Proof}}
117\newcommand{\MTMembershipProof}{{\sf MembershipProof}}
118\newcommand{\MTNonMembershipProof}{\text{\sf{NonMembershipProof}}}
119\newcommand{\MTRemove}{\sf{Remove}}
120\newcommand{\MTOpen}{\sf{Open}}
121\newcommand{\MTUpdate}{\sf{Update}}
122\newcommand{\MTVerify}{\text{\sf{Verify}}}
123\newcommand{\censusTree}{\sf{MT^{\census}}}
124\newcommand{\stateTree}{\sf{MT^{\state}}}
125
126% Circuits
127\newcommand{\public}{{\sf\color{teal}public}\xspace}
128\newcommand{\private}{{\sf\color{red}private}\xspace}
129\newcommand{\circuitstyle}[1]{{\sf{#1}}\xspace}
130\newcommand{\ballotcircuit}{\circuitstyle{BallotCircuit}}
131\newcommand{\verifiercircuit}{\circuitstyle{VerifierCircuit}}
132\newcommand{\aggregationcircuit}{\circuitstyle{AggregationCircuit}}
133\newcommand{\statetransitioncircuit}{\circuitstyle{StateTransitionCircuit}}
134\newcommand{\resultscircuit}{\circuitstyle{ResultsCircuit}}
135\newcommand{\publicinputs}{\circuitstyle{PI}}
136\newcommand{\witness}{\circuitstyle{witness}}
137
138% Roles
139\definecolor{voterbg}{RGB}{200, 230, 200} % soft, muted green
140\definecolor{organizerbg}{RGB}{245, 222, 135} % classic mustard tone
141\definecolor{sequencerbg}{RGB}{235, 225, 250} % soft lavender-like purple
142\definecolor{darkgrayborder}{RGB}{100, 100, 100} % dark neutral gray
143
144\newcommand{\voter}{\fcolorbox{darkgrayborder}{voterbg}{ \textsf{voter} }\xspace}
145\newcommand{\organizer}{\fcolorbox{darkgrayborder}{organizerbg}{ \textsf{organizer} }\xspace}
146\newcommand{\sequencer}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencer} }\xspace}
147\newcommand{\sequencers}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencers} }\xspace}
148
149% Ballot protocol
150\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
151\newcommand{\numfields}{\ballotstyle{numFields}}
152\newcommand{\maxvalue}{\ballotstyle{maxValue}}
153\newcommand{\minvalue}{\ballotstyle{minValue}}
154\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
155\newcommand{\maxvaluesum}{\ballotstyle{maxValueSum}}
156\newcommand{\minvaluesum}{\ballotstyle{minValueSum}}
157\newcommand{\costexponent}{\ballotstyle{costExponent}}
158\newcommand{\totalvaluesum}{\ballotstyle{totalValueSum}}
159\newcommand{\validvote}{\ballotstyle{validVote}}
160
161% Voting protocol
162\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
163\newcommand{\true}{\variablestyle{true}}
164\newcommand{\census}{\variablestyle{census}}
165\newcommand{\censusdata}{\variablestyle{censusData}}
166\newcommand{\censusorigin}{\variablestyle{censusOrigin}}
167\newcommand{\censusuri}{\variablestyle{censusURI}}
168\newcommand{\voteproof}{\variablestyle{voteProof}}
169\newcommand{\ballotproof}{\variablestyle{ballotProof}}
170\newcommand{\censusproof}{\variablestyle{censusProof}}
171\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
172\newcommand{\aggregationproof}{\variablestyle{aggregationProof}}
173\newcommand{\resultsproof}{\variablestyle{resultsProof}}
174\newcommand{\voteid}{\variablestyle{voteID}}
175\newcommand{\ballot}{\variablestyle{ballot}}
176\newcommand{\vote}{\variablestyle{vote}}
177\newcommand{\processid}{\variablestyle{processID}}
178\newcommand{\censuspf}{\variablestyle{censusProof}}
179\newcommand{\commitment}{\variablestyle{identityCommitment}}
180\newcommand{\nullifier}{\variablestyle{nullifier}}
181\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
182\newcommand{\reencryptedballot}{\variablestyle{reEncryptedBallot}}
183\newcommand{\zkproof}{\variablestyle{ZKproof}}
184\newcommand{\signature}{\variablestyle{signature}}
185\newcommand{\address}{\variablestyle{address}}
186\newcommand{\stateproof}{\variablestyle{stateProof}}
187\newcommand{\merkleproofs}{\variablestyle{merkleProofs}}
188\newcommand{\merkleInclusionPf}{\variablestyle{inclusionProof}}
189\newcommand{\merkleNInclusionPf}{\variablestyle{nonInclusionProof}}
190\newcommand{\configmax}{\variablestyle{configMax}}
191\newcommand{\electionmetadata}{\variablestyle{electionMetadata}}
192\newcommand{\starttime}{\variablestyle{startTime}}
193\newcommand{\duration}{\variablestyle{duration}}
194
195% State Merkle tree
196\newcommand{\censusroot}{\variablestyle{censusRoot}}
197\newcommand{\stateroot}{\variablestyle{stateRoot}}
198\newcommand{\type}{\variablestyle{type}}
199%\newcommand{\path}{\variablestyle{path}}
200\newcommand{\state}{\variablestyle{state}}
201\newcommand{\ballotmode}{\variablestyle{ballotMode}}
202\newcommand{\epk}{\variablestyle{encryptionKey}}
203\newcommand{\decryptionkey}{\variablestyle{decryptionKey}}
204\newcommand{\encresults}{\variablestyle{encryptedResults}}
205\newcommand{\addaccumulator}{\variablestyle{resultsAdd}}
206\newcommand{\substractaccumulator}{\variablestyle{resultsSub}}
207\newcommand{\addresses}{\variablestyle{addresses}}
208\newcommand{\nullifiers}{\variablestyle{nullifiers}}
209\newcommand{\weight}{\variablestyle{weight}}
210\newcommand{\numoverwrites}{\variablestyle{numOverwrites}}
211\newcommand{\numvotes}{\variablestyle{numVotes}}
212\newcommand{\blobcomm}{\variablestyle{blobComm}}
213
214% Others
215\newcommand{\noi}{\noindent}
216\newcommand{\conc}{\:||\:}
217\newcommand{\batchsize}{\variablestyle{batchSize}}
218\newcommand{\old}{\texttt{old}\xspace}
219\newcommand{\new}{\texttt{new}\xspace}
220% Hyperlinks
221\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
222\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
223\newcommand{\idx}{\variablestyle{idx}}
224
225% Smart contracts
226\newcommand{\smartcontractstyle}[1]{{\sf{#1}}\xspace}
227\newcommand{\orgregistry}{\smartcontractstyle{OrganizationRegistry}}
228\newcommand{\electionregistry}{\smartcontractstyle{ElectionRegistry}}
229\newcommand{\dkgmanagement}{\smartcontractstyle{KeyManagement}}
230\newcommand{\statetransitionverifier}{\smartcontractstyle{StateTransitionVerifier}}
231\newcommand{\resultsverifier}{\smartcontractstyle{ResultsVerifier}}
232\newcommand{\censusmanagement}{\smartcontractstyle{CensusManagement}}
233\newcommand{\processregistry}{\smartcontractstyle{ProcessRegistry}}
234\newcommand{\ziskverifier}{\smartcontractstyle{ZiskVerifier}}
235\newcommand{\lblobverifier}{\smartcontractstyle{L1BlobVerifier}}
236\newcommand{\lblock}{\smartcontractstyle{L1Block}}
237\newcommand{\dkgadapter}{\smartcontractstyle{DavinciDKGAdapter}}
238\newcommand{\counciladapter}{\smartcontractstyle{CouncilAdapter}}
239\newcommand{\dkgregistry}{\smartcontractstyle{DKGRegistry}}
240\newcommand{\dkgmanager}{\smartcontractstyle{DKGManager}}
241\newcommand{\dkgappmanager}{\smartcontractstyle{DKGAppManager}}
242\newcommand{\councilmanager}{\smartcontractstyle{CouncilManager}}
243\newcommand{\censusvalidator}{\smartcontractstyle{ICensusValidator}}
244
245% Contract methods and events
246\newcommand{\fn}[1]{\texttt{#1}\xspace}
247
248% zkVM programs and proofs
249\newcommand{\batchprogram}{\circuitstyle{BatchProgram}}
250\newcommand{\resultsprogram}{\circuitstyle{ResultsProgram}}
251\newcommand{\aggregatorprogram}{\circuitstyle{AggregatorProgram}}
252\newcommand{\Prog}{\mathcal{P}}
253\newcommand{\VMProve}{\methodstyle{VM.Prove}}
254\newcommand{\VMVerify}{\methodstyle{VM.Verify}}
255\newcommand{\VMExec}{\methodstyle{VM.Execute}}
256\newcommand{\programvk}{\variablestyle{programVK}}
257\newcommand{\rootc}{\variablestyle{rootCVadcopFinal}}
258\newcommand{\publicvalues}{\variablestyle{publicValues}}
259\newcommand{\batchproof}{\variablestyle{batchProof}}
260\newcommand{\ballotinputshash}{\variablestyle{inputsHash}}
261\newcommand{\ballotvkhash}{\variablestyle{ballotVKHash}}
262\newcommand{\blobsdigest}{\variablestyle{blobsDigest}}
263\newcommand{\nblobs}{\variablestyle{nBlobs}}
264\newcommand{\occupiedbefore}{\variablestyle{occupiedBefore}}
265\newcommand{\voterscount}{\variablestyle{votersCount}}
266\newcommand{\overwrittencount}{\variablestyle{overwrittenVotesCount}}
267\newcommand{\maxvoters}{\variablestyle{maxVoters}}
268\newcommand{\seed}{\variablestyle{seed}}
269\newcommand{\slot}{\variablestyle{slot}}
270\newcommand{\keymode}{\variablestyle{keyMode}}
271\newcommand{\grace}{\variablestyle{grace}}
272\newcommand{\graceend}{\variablestyle{graceEnd}}
273\newcommand{\lastvoteat}{\variablestyle{lastVoteAt}}
274\newcommand{\metadatauri}{\variablestyle{metadataURI}}
275\newcommand{\failmask}{\variablestyle{failMask}}
276\newcommand{\okflag}{\variablestyle{ok}}
277\newcommand{\groupsize}{\ballotstyle{groupSize}}
278\newcommand{\Sha}{\methodstyle{SHA256}}
279\newcommand{\SlotOf}{\methodstyle{Slot}}
280\newcommand{\CPProve}{\methodstyle{CP.Prove}}
281\newcommand{\CPVerify}{\methodstyle{CP.Verify}}
282
283% Blobs
284\newcommand{\blobstyle}[1]{{\sf{#1}}\xspace}
285\newcommand{\blobdata}{\blobstyle{blobData}}
286\newcommand{\blobcom}{\blobstyle{blobCommitment}}
287\newcommand{\evalpoint}{\blobstyle{evalPoint}}
288\newcommand{\openproof}{\blobstyle{openingProof}}
289
290% Cryptographic primitives
291\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
292\newcommand{\Keccak}{\methodstyle{Keccak}}
293\newcommand{\Poseidon}{\methodstyle{Poseidon}}
294\newcommand{\Mimc}{\methodstyle{MiMC}}
295\newcommand{\Multimimc}{\methodstyle{MultiMiMC7}}
296\newcommand{\Enc}{\methodstyle{Enc}}
297\newcommand{\Dec}{\methodstyle{Dec}}
298\newcommand{\EncAdd}{\methodstyle{EncAdd}}
299\newcommand{\ReEnc}{\methodstyle{ReEnc}}
300\newcommand{\SSign}{\methodstyle{S.Sign}}
301\newcommand{\SVer}{\methodstyle{S.Verify}}
302\newcommand{\SPubKey}{\methodstyle{S.ExtractPublicKey}}
303\newcommand{\CCommit}{\methodstyle{C.Commit}}
304\newcommand{\CSetup}{\methodstyle{C.Setup}}
305\newcommand{\COpen}{\methodstyle{C.Open}}
306\newcommand{\CVerifyPoly}{\methodstyle{C.VerifyPoly}}
307\newcommand{\CCreateWitness}{\methodstyle{C.CreateWitness}}
308\newcommand{\CVerifyEval}{\methodstyle{C.VerifyEval}}
309\newcommand{\CProve}{\methodstyle{C.Prove}}
310\newcommand{\CVerify}{\methodstyle{C.Verify}}
311\newcommand{\PProve}{\methodstyle{P.Prove}}
312\newcommand{\PVerify}{\methodstyle{P.Verify}}
313\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
314\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
315\newcommand{\GenerateEncryptedShares}{\methodstyle{GenerateEncryptedShares}}
316\newcommand{\VerifyEncryptedShare}{\methodstyle{VerifyEncryptedShare}}
317\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
318\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
319
320\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
321\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
322\newcommand{\sk}[1][]{{\sf{sk}^{#1}}}
323\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
324\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
325\newcommand{\sample}{\xleftarrow{\$}}
326
327% VOC token
328\newcommand{\token}{VOC\xspace}
329\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
330\newcommand{\baseCost}{\vocstyle{baseCost}}
331\newcommand{\capacityCost}{\vocstyle{capacityCost}}
332\newcommand{\durationCost}{\vocstyle{durationCost}}
333\newcommand{\fixedCost}{\vocstyle{fixedCost}}
334\newcommand{\maxVotes}{\vocstyle{maxVotes}}
335\newcommand{\maxDuration}{\vocstyle{maxDuration}}
336\newcommand{\numSequencers}{\vocstyle{numSequencers}}
337\newcommand{\processDuration}{\vocstyle{processDuration}}
338\newcommand{\reimbursement}{\vocstyle{reimbursement}}
339\newcommand{\securityCost}{\vocstyle{securityCost}}
340\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
341\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
342\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
343\newcommand{\totalCost}{\vocstyle{totalCost}}
344\newcommand{\totalReward}{\vocstyle{totalReward}}
345\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
346\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
347\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
348\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
349\newcommand{\votes}{\vocstyle{votes}}
350\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
351
352% Misc
353\newcommand{\davinci}{DAVINCI\xspace}
354\newcommand{\Davinci}{DAVINCI\xspace}
355\newcommand{\keywarden}{key warden\xspace}
356\newcommand{\Keywarden}{Key warden\xspace}
357\newcommand{\keywardens}{key wardens\xspace}
358\newcommand{\Keywardens}{Key wardens\xspace}