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{\MTRemove}{\sf{Remove}}
90\newcommand{\MTOpen}{\sf{Open}}
91\newcommand{\MTVerify}{\sf{Verify}}
92
93% Circuits
94\newcommand{\public}{{\sf\color{teal}public}\xspace}
95\newcommand{\private}{{\sf\color{red}private}\xspace}
96
97% Roles
98\definecolor{voterbg}{RGB}{200, 230, 200} % soft, muted green
99\definecolor{organizerbg}{RGB}{245, 222, 135} % classic mustard tone
100\definecolor{sequencerbg}{RGB}{235, 225, 250} % soft lavender-like purple
101\definecolor{darkgrayborder}{RGB}{100, 100, 100} % dark neutral gray
102
103\newcommand{\voter}{\fcolorbox{darkgrayborder}{voterbg}{ \textsf{voter} }\xspace}
104\newcommand{\organizer}{\fcolorbox{darkgrayborder}{organizerbg}{ \textsf{organizer} }\xspace}
105\newcommand{\sequencer}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencer} }\xspace}
106\newcommand{\sequencers}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencers} }\xspace}
107
108% Ballot protocol
109\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
110\newcommand{\maxcount}{\ballotstyle{maxCount}}
111\newcommand{\maxvalue}{\ballotstyle{maxValue}}
112\newcommand{\minvalue}{\ballotstyle{minValue}}
113\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
114\newcommand{\maxtotalcost}{\ballotstyle{maxTotalCost}}
115\newcommand{\mintotalcost}{\ballotstyle{minTotalCost}}
116\newcommand{\costexponent}{\ballotstyle{costExponent}}
117
118% Voting protocol
119\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
120\newcommand{\voteproof}{\variablestyle{voteProof}}
121\newcommand{\censusproof}{\variablestyle{censusProof}}
122\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
123\newcommand{\voteid}{\variablestyle{voteID}}
124\newcommand{\ballot}{\variablestyle{ballot}}
125\newcommand{\vote}{\variablestyle{vote}}
126\newcommand{\processid}{\variablestyle{processID}}
127\newcommand{\censuspf}{\variablestyle{censusProof}}
128\newcommand{\commitment}{\variablestyle{identityCommitment}}
129\newcommand{\nullifier}{\variablestyle{nullifier}}
130\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
131\newcommand{\zkproof}{\variablestyle{ZKproof}}
132\newcommand{\signature}{\variablestyle{signature}}
133\newcommand{\address}{\variablestyle{address}}
134
135% State Merkle tree
136\newcommand{\censusroot}{\variablestyle{censusRoot}}
137\newcommand{\type}{\variablestyle{type}}
138\newcommand{\ballotmode}{\variablestyle{ballotMode}}
139\newcommand{\epk}{\variablestyle{encryptionKey}}
140\newcommand{\addaccumulator}{\variablestyle{addedResultsAccumulator}}
141\newcommand{\substractaccumulator}{\variablestyle{substractResultsAccumulator}}
142\newcommand{\addresses}{\variablestyle{addresses}}
143\newcommand{\nullifiers}{\variablestyle{nullifiers}}
144\newcommand{\weight}{\variablestyle{weight}}
145
146% Others
147\newcommand{\noi}{\noindent}
148\newcommand{\conc}{\:||\:}
149
150% Hyperlinks
151\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
152\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
153
154% Cryptographic primitives
155\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
156\newcommand{\Keccak}{\methodstyle{Hash_1}}
157\newcommand{\Poseidon}{\methodstyle{Hash_2}}
158\newcommand{\Mimc}{\methodstyle{Hash_3}}
159\newcommand{\Enc}{\methodstyle{Enc}}
160\newcommand{\Dec}{\methodstyle{Dec}}
161\newcommand{\EncAdd}{\methodstyle{EncAdd}}
162\newcommand{\ReEnc}{\methodstyle{ReEnc}}
163\newcommand{\SSign}{\methodstyle{S.Sign}}
164\newcommand{\SVer}{\methodstyle{S.Verify}}
165\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
166\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
167\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
168\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
169
170\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
171\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
172\newcommand{\sk}[1][]{{\sf{sk}^{#1}}}
173\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
174\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
175\newcommand{\sample}{\xleftarrow{\$}}
176
177% VOC token
178\newcommand{\token}{VOC\xspace}
179\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
180\newcommand{\baseCost}{\vocstyle{baseCost}}
181\newcommand{\capacityCost}{\vocstyle{capacityCost}}
182\newcommand{\durationCost}{\vocstyle{durationCost}}
183\newcommand{\fixedCost}{\vocstyle{fixedCost}}
184\newcommand{\maxVotes}{\vocstyle{maxVotes}}
185\newcommand{\maxDuration}{\vocstyle{maxDuration}}
186\newcommand{\numSequencers}{\vocstyle{numSequencers}}
187\newcommand{\processDuration}{\vocstyle{processDuration}}
188\newcommand{\reimbursement}{\vocstyle{reimbursement}}
189\newcommand{\securityCost}{\vocstyle{securityCost}}
190\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
191\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
192\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
193\newcommand{\totalCost}{\vocstyle{totalCost}}
194\newcommand{\totalReward}{\vocstyle{totalReward}}
195\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
196\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
197\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
198\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
199\newcommand{\votes}{\vocstyle{votes}}
200\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
201
202% Misc
203\newcommand{\davinci}{DAVINCI\xspace}
204\newcommand{\Davinci}{DAVINCI\xspace}
205
206% Draft watermark
207%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
208
209% New foonote referencing a previous footmark
210\makeatletter
211\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
212\makeatother