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