davinci-paper/v2/build/preamble-macros.tex
v2/build/preamble-macros.texRaw
1% !TeX root = main.tex
2
3% Doc sytle
4\setcounter{secnumdepth}{3} %enumerate sections up to depth 3 (subsubsection)
5% Set the first-level itemize label to use math mode \bullet
6\setlist[itemize,1]{label=$\bullet$}
7% The second-level enumerates (enumerate,2) should only show (a) when referenced (not (3a)).
8\setlist[enumerate,2]{label=(\alph*),ref=\alph*}
9
10% Working directory
11\newcommand{\definedir}[2]{\newcommand{#1}{#2}}
12\definedir{\secs}{../sections}
13\definedir{\figs}{../figures}
14\definedir{\bib}{../bibliography}
15
16% Hyperref setup
17%\hypersetup{
18% final=true,
19% colorlinks=true,
20% linkcolor=blue,
21% urlcolor=blue,
22% citecolor=blue,
23%}
24
25% Comments
26\newcommand{\marta}[1]{\todo[size=\small, color=red!40]{\textbf{Marta}: #1}}
27\newcommand{\martai}[1]{\todo[inline, size=\small, color=red!40]{\textbf{Marta}: #1}}
28\newcommand{\pau}[1]{\todo[size=\small, color=green!40]{\textbf{Pau}: #1}}
29\newcommand{\paui}[1]{\todo[inline, size=\small, color=green!40]{\textbf{Pau}: #1}}
30\newcommand{\roger}[1]{\todo[size=\small, color=blue!40]{\textbf{Roger}: #1}}
31\newcommand{\rogeri}[1]{\todo[inline, size=\small, color=blue!40]{\textbf{Roger}: #1}}
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% Table of contents style
46\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} % it works like p{} but centered
47
48% Make section entries bold in ToC
49\makeatletter
50\renewcommand{\@dotsep}{4.5}
51\renewcommand{\l@section}[2]{\addpenalty{\@secpenalty}
52 \addvspace{1.0em plus 1pt}
53 \@tempdima=1.5em
54 \parindent \z@ \rightskip \@pnumwidth
55 \parfillskip -\@pnumwidth
56 {\leavevmode
57 \advance\leftskip\@tempdima
58 \hskip -\leftskip
59 \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par}
60\makeatother
61
62% Adds vertical space before and after \subsubsection headings and ensures body text starts on a new line
63\makeatletter
64\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
65 {-18\p@ \@plus -4\p@ \@minus -4\p@}% % Before skip
66 {4\p@ \@plus 2\p@ \@minus 2\p@}% % After skip
67 {\normalfont\normalsize\bfseries}} % Font style
68\makeatother
69
70% Colours
71\definecolor{cred}{rgb}{1, 0.5, 0.5}
72\definecolor{cgreen}{rgb}{0.5, 1, 0.5}
73\definecolor{cblue}{rgb}{0.5, 0.5, 1}
74
75% Hyperref setup
76%\hypersetup{
77% final=true,
78% colorlinks=true,
79% linkcolor=cblue,
80% urlcolor=black,
81% citecolor=cblue,
82%}
83
84% Mathbb
85\newcommand{\N}{\ensuremath{\mathbb{N}}\xspace}
86\newcommand{\Z}{\ensuremath{\mathbb{Z}}\xspace}
87\newcommand{\G}{\ensuremath{\mathbb{G}}\xspace}
88\newcommand{\F}{\ensuremath{\mathbb{F}}\xspace}
89\newcommand{\J}{\ensuremath{\mathbb{J}}\xspace}
90
91% Elliptic curves
92\newcommand{\BW}[1]{\ensuremath{{#1}^{\text{\tiny \sf BW}}}\xspace}
93\newcommand{\BLS}[1]{\ensuremath{{#1}^{\text{\tiny \sf BLS}}}\xspace}
94\newcommand{\BN}[1]{\ensuremath{{#1}^{\text{\tiny \sf BN}}}\xspace}
95\newcommand{\BJ}[1]{\ensuremath{{#1}^{\text{\tiny \sf BJ}}}\xspace}
96\newcommand{\SEC}[1]{\ensuremath{{#1}^{\text{\tiny \sf SEC}}}\xspace}
97
98% Trees
99\newcommand{\tree}[1][]{\sf{MT}^{\sf{#1}}}
100\renewcommand{\root}[1][]{\sf{root}^{\sf{#1}}}
101\newcommand{\recentroots}{\sf{recentRoots}}
102\newcommand{\leaf}{\sf{leaf}}
103\newcommand{\leaves}{\sf{leaves}}
104\newcommand{\MTGenerate}{\sf{Generate}}
105\newcommand{\MTRoot}{\sf{Root}}
106\newcommand{\MTInsert}{\sf{Insert}}
107\newcommand{\MTProof}{\sf{Proof}}
108\newcommand{\MTMembershipProof}{\sf{MembershipProof}}
109\newcommand{\MTNonMembershipProof}{\sf{NonMembershipProof}}
110\newcommand{\MTRemove}{\sf{Remove}}
111\newcommand{\MTOpen}{\sf{Open}}
112\newcommand{\MTUpdate}{\sf{Update}}
113\newcommand{\MTVerify}{\sf{Verify}}
114\newcommand{\censusTree}{\sf{MT^{\census}}}
115\newcommand{\stateTree}{\sf{MT^{\state}}}
116
117% Circuits
118\newcommand{\public}{{\sf\color{teal}public}\xspace}
119\newcommand{\private}{{\sf\color{red}private}\xspace}
120\newcommand{\circuitstyle}[1]{{\sf{#1}}\xspace}
121\newcommand{\ballotcircuit}{\circuitstyle{BallotCircuit}}
122\newcommand{\verifiercircuit}{\circuitstyle{VerifierCircuit}}
123\newcommand{\aggregationcircuit}{\circuitstyle{AggregationCircuit}}
124\newcommand{\statetransitioncircuit}{\circuitstyle{StateTransitionCircuit}}
125\newcommand{\resultscircuit}{\circuitstyle{ResultsCircuit}}
126\newcommand{\publicinputs}{\circuitstyle{PI}}
127\newcommand{\witness}{\circuitstyle{witness}}
128
129% Roles
130\definecolor{voterbg}{RGB}{200, 230, 200} % soft, muted green
131\definecolor{organizerbg}{RGB}{245, 222, 135} % classic mustard tone
132\definecolor{sequencerbg}{RGB}{235, 225, 250} % soft lavender-like purple
133\definecolor{darkgrayborder}{RGB}{100, 100, 100} % dark neutral gray
134
135\newcommand{\voter}{\fcolorbox{darkgrayborder}{voterbg}{ \textsf{voter} }\xspace}
136\newcommand{\organizer}{\fcolorbox{darkgrayborder}{organizerbg}{ \textsf{organizer} }\xspace}
137\newcommand{\sequencer}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencer} }\xspace}
138\newcommand{\sequencers}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencers} }\xspace}
139
140% Ballot protocol
141\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
142\newcommand{\numfields}{\ballotstyle{numFields}}
143\newcommand{\maxvalue}{\ballotstyle{maxValue}}
144\newcommand{\minvalue}{\ballotstyle{minValue}}
145\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
146\newcommand{\maxvaluesum}{\ballotstyle{maxValueSum}}
147\newcommand{\minvaluesum}{\ballotstyle{minValueSum}}
148\newcommand{\costexponent}{\ballotstyle{costExponent}}
149\newcommand{\totalvaluesum}{\ballotstyle{totalValueSum}}
150\newcommand{\validvote}{\ballotstyle{validVote}}
151
152% Voting protocol
153\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
154\newcommand{\true}{\variablestyle{true}}
155\newcommand{\census}{\variablestyle{census}}
156\newcommand{\censusdata}{\variablestyle{censusData}}
157\newcommand{\censusorigin}{\variablestyle{censusOrigin}}
158\newcommand{\censusuri}{\variablestyle{censusURI}}
159\newcommand{\voteproof}{\variablestyle{voteProof}}
160\newcommand{\ballotproof}{\variablestyle{ballotProof}}
161\newcommand{\censusproof}{\variablestyle{censusProof}}
162\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
163\newcommand{\aggregationproof}{\variablestyle{aggregationProof}}
164\newcommand{\resultsproof}{\variablestyle{resultsProof}}
165\newcommand{\voteid}{\variablestyle{voteID}}
166\newcommand{\ballot}{\variablestyle{ballot}}
167\newcommand{\vote}{\variablestyle{vote}}
168\newcommand{\processid}{\variablestyle{processID}}
169\newcommand{\censuspf}{\variablestyle{censusProof}}
170\newcommand{\commitment}{\variablestyle{identityCommitment}}
171\newcommand{\nullifier}{\variablestyle{nullifier}}
172\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
173\newcommand{\reencryptedballot}{\variablestyle{reEncryptedBallot}}
174\newcommand{\zkproof}{\variablestyle{ZKproof}}
175\newcommand{\signature}{\variablestyle{signature}}
176\newcommand{\address}{\variablestyle{address}}
177\newcommand{\stateproof}{\variablestyle{stateProof}}
178\newcommand{\merkleproofs}{\variablestyle{merkleProofs}}
179\newcommand{\merkleInclusionPf}{\variablestyle{merkleInclusionProof}}
180\newcommand{\merkleNInclusionPf}{\variablestyle{merkleNonInclusionProof}}
181\newcommand{\configmax}{\variablestyle{configMax}}
182
183% State Merkle tree
184\newcommand{\censusroot}{\variablestyle{censusRoot}}
185\newcommand{\stateroot}{\variablestyle{stateRoot}}
186\newcommand{\type}{\variablestyle{type}}
187%\newcommand{\path}{\variablestyle{path}}
188\newcommand{\state}{\variablestyle{state}}
189\newcommand{\ballotmode}{\variablestyle{ballotMode}}
190\newcommand{\epk}{\variablestyle{encryptionKey}}
191\newcommand{\decryptionkey}{\variablestyle{decryptionKey}}
192\newcommand{\addaccumulator}{\variablestyle{resultsAdd}}
193\newcommand{\substractaccumulator}{\variablestyle{resultsSub}}
194\newcommand{\addresses}{\variablestyle{addresses}}
195\newcommand{\nullifiers}{\variablestyle{nullifiers}}
196\newcommand{\weight}{\variablestyle{weight}}
197\newcommand{\numoverwrites}{\variablestyle{numOverwrites}}
198\newcommand{\numvotes}{\variablestyle{numVotes}}
199\newcommand{\blobcomm}{\variablestyle{blobComm}}
200
201% Others
202\newcommand{\noi}{\noindent}
203\newcommand{\conc}{\:||\:}
204\newcommand{\batchsize}{\variablestyle{batchSize}}
205\newcommand{\old}{\texttt{old}\xspace}
206\newcommand{\new}{\texttt{new}\xspace}
207% Hyperlinks
208\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
209\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
210\newcommand{\idx}{\variablestyle{idx}}
211
212% Smart contracts
213\newcommand{\smartcontractstyle}[1]{{\sf{#1}}\xspace}
214\newcommand{\orgregistry}{\smartcontractstyle{OrganizationRegistry}}
215\newcommand{\electionregistry}{\smartcontractstyle{ElectionRegistry}}
216\newcommand{\dkgmanagement}{\smartcontractstyle{KeyManagement}}
217\newcommand{\statetransitionverifier}{\smartcontractstyle{StateTransitionVerifier}}
218\newcommand{\resultsverifier}{\smartcontractstyle{ResultsVerifier}}
219\newcommand{\censusmanagement}{\smartcontractstyle{CensusManagement}}
220
221% Blobs
222\newcommand{\blobstyle}[1]{{\sf{#1}}\xspace}
223\newcommand{\blobdata}{\blobstyle{blobData}}
224\newcommand{\blobcom}{\blobstyle{blobCommitment}}
225\newcommand{\evalpoint}{\blobstyle{evalPoint}}
226\newcommand{\openproof}{\blobstyle{openingProof}}
227
228% Cryptographic primitives
229\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
230\newcommand{\Keccak}{\methodstyle{Keccak}}
231\newcommand{\Poseidon}{\methodstyle{Poseidon}}
232\newcommand{\Mimc}{\methodstyle{MiMC}}
233\newcommand{\Multimimc}{\methodstyle{MultiMiMC7}}
234\newcommand{\Enc}{\methodstyle{Enc}}
235\newcommand{\Dec}{\methodstyle{Dec}}
236\newcommand{\EncAdd}{\methodstyle{EncAdd}}
237\newcommand{\ReEnc}{\methodstyle{ReEnc}}
238\newcommand{\SSign}{\methodstyle{S.Sign}}
239\newcommand{\SVer}{\methodstyle{S.Verify}}
240\newcommand{\SPubKey}{\methodstyle{S.ExtractPublicKey}}
241\newcommand{\CCommit}{\methodstyle{C.Commit}}
242\newcommand{\CSetup}{\methodstyle{C.Setup}}
243\newcommand{\COpen}{\methodstyle{C.Open}}
244\newcommand{\CVerifyPoly}{\methodstyle{C.VerifyPoly}}
245\newcommand{\CCreateWitness}{\methodstyle{C.CreateWitness}}
246\newcommand{\CVerifyEval}{\methodstyle{C.VerifyEval}}
247\newcommand{\CProve}{\methodstyle{C.Prove}}
248\newcommand{\CVerify}{\methodstyle{C.Verify}}
249\newcommand{\PProve}{\methodstyle{P.Prove}}
250\newcommand{\PVerify}{\methodstyle{P.Verify}}
251\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
252\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
253\newcommand{\GenerateEncryptedShares}{\methodstyle{GenerateEncryptedShares}}
254\newcommand{\VerifyEncryptedShare}{\methodstyle{VerifyEncryptedShare}}
255\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
256\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
257
258\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
259\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
260\newcommand{\sk}[1][]{{\sf{sk}^{#1}}}
261\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
262\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
263\newcommand{\sample}{\xleftarrow{\$}}
264
265% VOC token
266\newcommand{\token}{VOC\xspace}
267\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
268\newcommand{\baseCost}{\vocstyle{baseCost}}
269\newcommand{\capacityCost}{\vocstyle{capacityCost}}
270\newcommand{\durationCost}{\vocstyle{durationCost}}
271\newcommand{\fixedCost}{\vocstyle{fixedCost}}
272\newcommand{\maxVotes}{\vocstyle{maxVotes}}
273\newcommand{\maxDuration}{\vocstyle{maxDuration}}
274\newcommand{\numSequencers}{\vocstyle{numSequencers}}
275\newcommand{\processDuration}{\vocstyle{processDuration}}
276\newcommand{\reimbursement}{\vocstyle{reimbursement}}
277\newcommand{\securityCost}{\vocstyle{securityCost}}
278\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
279\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
280\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
281\newcommand{\totalCost}{\vocstyle{totalCost}}
282\newcommand{\totalReward}{\vocstyle{totalReward}}
283\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
284\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
285\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
286\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
287\newcommand{\votes}{\vocstyle{votes}}
288\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
289
290% Misc
291\newcommand{\davinci}{DAVINCI\xspace}
292\newcommand{\Davinci}{DAVINCI\xspace}
293\newcommand{\keywarden}{key warden\xspace}
294\newcommand{\Keywarden}{Key warden\xspace}
295\newcommand{\keywardens}{key wardens\xspace}
296\newcommand{\Keywardens}{Key wardens\xspace}
297
298% Draft watermark
299%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
300
301% New foonote referencing a previous footmark
302\makeatletter
303\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
304\makeatother