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
8% Working directory
9\newcommand{\definedir}[2]{\newcommand{#1}{#2}}
10\definedir{\secs}{../sections}
11\definedir{\figs}{../figures}
12\definedir{\bib}{../bibliography}
13
14% Comments
15\newcommand{\marta}[1]{\todo[size=\small, color=red!40]{\textbf{Marta}: #1}}
16\newcommand{\martai}[1]{\todo[inline, size=\small, color=red!40]{\textbf{Marta}: #1}}
17\newcommand{\pau}[1]{\todo[size=\small, color=blue!40]{\textbf{Pau}: #1}}
18\newcommand{\paui}[1]{\todo[inline, size=\small, color=blue!40]{\textbf{Pau}: #1}}
19\newcommand{\jordi}[1]{\todo[size=\small, color=green!40]{\textbf{Jordi}: #1}}
20\newcommand{\jordii}[1]{\todo[inline, size=\small, color=green!40]{\textbf{Jordi}: #1}}
21
22% Freefootnote
23\let\svthefootnote\thefootnote
24\newcommand\freefootnote[1]{%
25 \let\thefootnote\relax%
26 \footnotetext{#1}%
27 \let\thefootnote\svthefootnote%
28}
29
30% Table of contents style
31% Make section entries bold in ToC
32\makeatletter
33\renewcommand{\@dotsep}{4.5}
34\renewcommand{\l@section}[2]{\addpenalty{\@secpenalty}
35 \addvspace{1.0em plus 1pt}
36 \@tempdima=1.5em
37 \parindent \z@ \rightskip \@pnumwidth
38 \parfillskip -\@pnumwidth
39 {\leavevmode
40 \advance\leftskip\@tempdima
41 \hskip -\leftskip
42 \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par}
43\makeatother
44
45% Adds vertical space before and after \subsubsection headings and ensures body text starts on a new line
46\makeatletter
47\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
48 {-18\p@ \@plus -4\p@ \@minus -4\p@}% % Before skip
49 {4\p@ \@plus 2\p@ \@minus 2\p@}% % After skip
50 {\normalfont\normalsize\bfseries}} % Font style
51\makeatother
52
53% Colours
54\definecolor{cred}{rgb}{1, 0.5, 0.5}
55\definecolor{cgreen}{rgb}{0.5, 1, 0.5}
56\definecolor{cblue}{rgb}{0.5, 0.5, 1}
57
58% Hyperref setup
59%\hypersetup{
60% final=true,
61% colorlinks=true,
62% linkcolor=cblue,
63% urlcolor=black,
64% citecolor=cblue,
65%}
66
67% Mathbb
68\newcommand{\N}{\ensuremath{\mathbb{N}}\xspace}
69\newcommand{\Z}{\ensuremath{\mathbb{Z}}\xspace}
70\newcommand{\G}{\ensuremath{\mathbb{G}}\xspace}
71\newcommand{\F}{\ensuremath{\mathbb{F}}\xspace}
72\newcommand{\J}{\ensuremath{\mathbb{J}}\xspace}
73
74% Elliptic curves
75\newcommand{\BW}[1]{\ensuremath{{#1}^{\text{\tiny \sf BW}}}\xspace}
76\newcommand{\BLS}[1]{\ensuremath{{#1}^{\text{\tiny \sf BLS}}}\xspace}
77\newcommand{\BN}[1]{\ensuremath{{#1}^{\text{\tiny \sf BN}}}\xspace}
78\newcommand{\BJ}[1]{\ensuremath{{#1}^{\text{\tiny \sf BJ}}}\xspace}
79\newcommand{\SEC}[1]{\ensuremath{{#1}^{\text{\tiny \sf SEC}}}\xspace}
80
81% Trees
82\newcommand{\tree}[1][]{\sf{MT}^{\sf{#1}}}
83\renewcommand{\root}[1][]{\sf{root}^{\sf{#1}}}
84\newcommand{\recentroots}{\sf{recentRoots}}
85\newcommand{\leaf}{\sf{leaf}}
86\newcommand{\leaves}{\sf{leaves}}
87\newcommand{\MTRoot}{\sf{Root}}
88\newcommand{\MTInsert}{\sf{Insert}}
89\newcommand{\MTProof}{\sf{Proof}}
90\newcommand{\MTRemove}{\sf{Remove}}
91\newcommand{\MTOpen}{\sf{Open}}
92\newcommand{\MTVerify}{\sf{Verify}}
93
94% Circuits
95\newcommand{\public}{{\sf\color{teal}public}\xspace}
96\newcommand{\private}{{\sf\color{red}private}\xspace}
97
98% Roles
99\definecolor{voterbg}{RGB}{200, 230, 200} % soft, muted green
100\definecolor{organizerbg}{RGB}{245, 222, 135} % classic mustard tone
101\definecolor{sequencerbg}{RGB}{235, 225, 250} % soft lavender-like purple
102\definecolor{darkgrayborder}{RGB}{100, 100, 100} % dark neutral gray
103
104\newcommand{\voter}{\fcolorbox{darkgrayborder}{voterbg}{ \textsf{voter} }\xspace}
105\newcommand{\organizer}{\fcolorbox{darkgrayborder}{organizerbg}{ \textsf{organizer} }\xspace}
106\newcommand{\sequencer}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencer} }\xspace}
107\newcommand{\sequencers}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencers} }\xspace}
108
109% Ballot protocol
110\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
111\newcommand{\maxcount}{\ballotstyle{maxCount}}
112\newcommand{\maxvalue}{\ballotstyle{maxValue}}
113\newcommand{\minvalue}{\ballotstyle{minValue}}
114\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
115\newcommand{\maxtotalcost}{\ballotstyle{maxTotalCost}}
116\newcommand{\mintotalcost}{\ballotstyle{minTotalCost}}
117\newcommand{\costexponent}{\ballotstyle{costExponent}}
118
119% Voting protocol
120\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
121\newcommand{\censusdata}{\variablestyle{censusData}}
122\newcommand{\voteproof}{\variablestyle{voteProof}}
123\newcommand{\censusproof}{\variablestyle{censusProof}}
124\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
125\newcommand{\voteid}{\variablestyle{voteID}}
126\newcommand{\ballot}{\variablestyle{ballot}}
127\newcommand{\vote}{\variablestyle{vote}}
128\newcommand{\processid}{\variablestyle{processID}}
129\newcommand{\censuspf}{\variablestyle{censusProof}}
130\newcommand{\commitment}{\variablestyle{identityCommitment}}
131\newcommand{\nullifier}{\variablestyle{nullifier}}
132\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
133\newcommand{\zkproof}{\variablestyle{ZKproof}}
134\newcommand{\signature}{\variablestyle{signature}}
135\newcommand{\address}{\variablestyle{address}}
136
137% State Merkle tree
138\newcommand{\censusroot}{\variablestyle{censusRoot}}
139\newcommand{\type}{\variablestyle{type}}
140\newcommand{\ballotmode}{\variablestyle{ballotMode}}
141\newcommand{\epk}{\variablestyle{encryptionKey}}
142\newcommand{\addaccumulator}{\variablestyle{addedResultsAccumulator}}
143\newcommand{\substractaccumulator}{\variablestyle{substractResultsAccumulator}}
144\newcommand{\addresses}{\variablestyle{addresses}}
145\newcommand{\nullifiers}{\variablestyle{nullifiers}}
146\newcommand{\weight}{\variablestyle{weight}}
147
148% Others
149\newcommand{\noi}{\noindent}
150\newcommand{\conc}{\:||\:}
151
152% Hyperlinks
153\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
154\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
155
156% Cryptographic primitives
157\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
158\newcommand{\Keccak}{\methodstyle{Hash_1}}
159\newcommand{\Poseidon}{\methodstyle{Hash_2}}
160\newcommand{\Mimc}{\methodstyle{Hash_3}}
161\newcommand{\Multimimc}{\methodstyle{MultiMiMC7}}
162\newcommand{\Enc}{\methodstyle{Enc}}
163\newcommand{\Dec}{\methodstyle{Dec}}
164\newcommand{\EncAdd}{\methodstyle{EncAdd}}
165\newcommand{\ReEnc}{\methodstyle{ReEnc}}
166\newcommand{\SSign}{\methodstyle{S.Sign}}
167\newcommand{\SVer}{\methodstyle{S.Verify}}
168\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
169\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
170\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
171\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
172
173\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
174\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
175\newcommand{\sk}[1][]{{\sf{sk}^{#1}}}
176\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
177\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
178\newcommand{\sample}{\xleftarrow{\$}}
179
180% VOC token
181\newcommand{\token}{VOC\xspace}
182\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
183\newcommand{\baseCost}{\vocstyle{baseCost}}
184\newcommand{\capacityCost}{\vocstyle{capacityCost}}
185\newcommand{\durationCost}{\vocstyle{durationCost}}
186\newcommand{\fixedCost}{\vocstyle{fixedCost}}
187\newcommand{\maxVotes}{\vocstyle{maxVotes}}
188\newcommand{\maxDuration}{\vocstyle{maxDuration}}
189\newcommand{\numSequencers}{\vocstyle{numSequencers}}
190\newcommand{\processDuration}{\vocstyle{processDuration}}
191\newcommand{\reimbursement}{\vocstyle{reimbursement}}
192\newcommand{\securityCost}{\vocstyle{securityCost}}
193\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
194\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
195\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
196\newcommand{\totalCost}{\vocstyle{totalCost}}
197\newcommand{\totalReward}{\vocstyle{totalReward}}
198\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
199\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
200\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
201\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
202\newcommand{\votes}{\vocstyle{votes}}
203\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
204
205% Misc
206\newcommand{\davinci}{DAVINCI\xspace}
207\newcommand{\Davinci}{DAVINCI\xspace}
208
209% Draft watermark
210%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
211
212% New foonote referencing a previous footmark
213\makeatletter
214\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
215\makeatother