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