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