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