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% Colours
46\definecolor{cred}{rgb}{1, 0.5, 0.5}
47\definecolor{cgreen}{rgb}{0.5, 1, 0.5}
48\definecolor{cblue}{rgb}{0.5, 0.5, 1}
49
50% Hyperref setup
51%\hypersetup{
52% final=true,
53% colorlinks=true,
54% linkcolor=cblue,
55% urlcolor=black,
56% citecolor=cblue,
57%}
58
59% Mathbb
60\newcommand{\N}{\ensuremath{\mathbb{N}}\xspace}
61\newcommand{\Z}{\ensuremath{\mathbb{Z}}\xspace}
62\newcommand{\G}{\ensuremath{\mathbb{G}}\xspace}
63\newcommand{\F}{\ensuremath{\mathbb{F}}\xspace}
64\newcommand{\J}{\ensuremath{\mathbb{J}}\xspace}
65
66% Elliptic curves
67\newcommand{\BW}[1]{\ensuremath{{#1}^{\text{\tiny \sf BW}}}\xspace}
68\newcommand{\BLS}[1]{\ensuremath{{#1}^{\text{\tiny \sf BLS}}}\xspace}
69\newcommand{\BN}[1]{\ensuremath{{#1}^{\text{\tiny \sf BN}}}\xspace}
70\newcommand{\BJ}[1]{\ensuremath{{#1}^{\text{\tiny \sf BJ}}}\xspace}
71\newcommand{\SEC}[1]{\ensuremath{{#1}^{\text{\tiny \sf SEC}}}\xspace}
72
73% Circuits
74\newcommand{\public}{{\sf\color{teal}public}\xspace}
75\newcommand{\private}{{\sf\color{red}private}\xspace}
76
77% Ballot protocol
78\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
79\newcommand{\maxcount}{\ballotstyle{maxCount}}
80\newcommand{\maxvalue}{\ballotstyle{maxValue}}
81\newcommand{\minvalue}{\ballotstyle{minValue}}
82\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
83\newcommand{\maxtotalcost}{\ballotstyle{maxTotalCost}}
84\newcommand{\mintotalcost}{\ballotstyle{minTotalCost}}
85\newcommand{\costexponent}{\ballotstyle{costExponent}}
86
87% Voting protocol
88\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
89\newcommand{\voteproof}{\variablestyle{voteProof}}
90\newcommand{\censusproof}{\variablestyle{censusProof}}
91\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
92\newcommand{\voteid}{\variablestyle{voteID}}
93\newcommand{\ballot}{\variablestyle{ballot}}
94\newcommand{\vote}{\variablestyle{vote}}
95\newcommand{\processid}{\variablestyle{processID}}
96\newcommand{\censuspf}{\variablestyle{censusProof}}
97\newcommand{\commitment}{\variablestyle{identityCommitment}}
98\newcommand{\nullifier}{\variablestyle{nullifier}}
99\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
100\newcommand{\zkproof}{\variablestyle{ZKproof}}
101\newcommand{\signature}{\variablestyle{signature}}
102\newcommand{\address}{\variablestyle{address}}
103
104% State Merkle tree
105\newcommand{\censusroot}{\variablestyle{censusRoot}}
106\newcommand{\type}{\variablestyle{type}}
107\newcommand{\ballotmode}{\variablestyle{ballotMode}}
108\newcommand{\epk}{\variablestyle{encryptionKey}}
109\newcommand{\addaccumulator}{\variablestyle{addedResultsAccumulator}}
110\newcommand{\substractaccumulator}{\variablestyle{substractResultsAccumulator}}
111\newcommand{\addresses}{\variablestyle{addresses}}
112\newcommand{\nullifiers}{\variablestyle{nullifiers}}
113\newcommand{\weight}{\variablestyle{weight}}
114
115% Others
116\newcommand{\noi}{\noindent}
117\newcommand{\conc}{\:||\:}
118
119% Hyperlinks
120\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
121\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
122
123% Cryptographic primitives
124\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
125\newcommand{\Keccak}{\methodstyle{Hash_1}}
126\newcommand{\Poseidon}{\methodstyle{Hash_2}}
127\newcommand{\Mimc}{\methodstyle{Hash_3}}
128\newcommand{\Enc}{\methodstyle{Enc}}
129\newcommand{\Dec}{\methodstyle{Dec}}
130\newcommand{\SSign}{\methodstyle{S.Sign}}
131\newcommand{\SVer}{\methodstyle{S.Verify}}
132\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
133\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
134\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
135\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
136
137\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
138\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
139\newcommand{\sk}[1][]{{\sf{sk}^{#1}}}
140\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
141\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
142\newcommand{\sample}{\xleftarrow{\$}}
143
144% VOC token
145\newcommand{\token}{VOC\xspace}
146\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
147\newcommand{\baseCost}{\vocstyle{baseCost}}
148\newcommand{\capacityCost}{\vocstyle{capacityCost}}
149\newcommand{\durationCost}{\vocstyle{durationCost}}
150\newcommand{\fixedCost}{\vocstyle{fixedCost}}
151\newcommand{\maxVotes}{\vocstyle{maxVotes}}
152\newcommand{\maxDuration}{\vocstyle{maxDuration}}
153\newcommand{\numSequencers}{\vocstyle{numSequencers}}
154\newcommand{\processDuration}{\vocstyle{processDuration}}
155\newcommand{\reimbursement}{\vocstyle{reimbursement}}
156\newcommand{\securityCost}{\vocstyle{securityCost}}
157\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
158\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
159\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
160\newcommand{\totalCost}{\vocstyle{totalCost}}
161\newcommand{\totalReward}{\vocstyle{totalReward}}
162\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
163\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
164\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
165\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
166\newcommand{\votes}{\vocstyle{votes}}
167\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
168
169% Misc
170\newcommand{\davinci}{DAVINCI\xspace}
171\newcommand{\Davinci}{DAVINCI\xspace}
172
173% Draft watermark
174%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
175
176% New foonote referencing a previous footmark
177\makeatletter
178\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
179\makeatother