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{\publicinputs}{\circuitstyle{PI}}
117\newcommand{\witness}{\circuitstyle{witness}}
118
119% Roles
120\definecolor{voterbg}{RGB}{200, 230, 200} % soft, muted green
121\definecolor{organizerbg}{RGB}{245, 222, 135} % classic mustard tone
122\definecolor{sequencerbg}{RGB}{235, 225, 250} % soft lavender-like purple
123\definecolor{darkgrayborder}{RGB}{100, 100, 100} % dark neutral gray
124
125\newcommand{\voter}{\fcolorbox{darkgrayborder}{voterbg}{ \textsf{voter} }\xspace}
126\newcommand{\organizer}{\fcolorbox{darkgrayborder}{organizerbg}{ \textsf{organizer} }\xspace}
127\newcommand{\sequencer}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencer} }\xspace}
128\newcommand{\sequencers}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencers} }\xspace}
129
130% Ballot protocol
131\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
132\newcommand{\numfields}{\ballotstyle{numFields}}
133\newcommand{\maxvalue}{\ballotstyle{maxValue}}
134\newcommand{\minvalue}{\ballotstyle{minValue}}
135\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
136\newcommand{\maxvaluesum}{\ballotstyle{maxValueSum}}
137\newcommand{\minvaluesum}{\ballotstyle{minValueSum}}
138\newcommand{\costexponent}{\ballotstyle{costExponent}}
139\newcommand{\totalvaluesum}{\ballotstyle{totalValueSum}}
140\newcommand{\validvote}{\ballotstyle{validVote}}
141
142% Voting protocol
143\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
144\newcommand{\true}{\variablestyle{true}}
145\newcommand{\census}{\variablestyle{census}}
146\newcommand{\censusdata}{\variablestyle{censusData}}
147\newcommand{\censusorigin}{\variablestyle{censusOrigin}}
148\newcommand{\censusuri}{\variablestyle{censusURI}}
149\newcommand{\voteproof}{\variablestyle{voteProof}}
150\newcommand{\ballotproof}{\variablestyle{ballotProof}}
151\newcommand{\censusproof}{\variablestyle{censusProof}}
152\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
153\newcommand{\aggregationproof}{\variablestyle{aggregationProof}}
154\newcommand{\voteid}{\variablestyle{voteID}}
155\newcommand{\ballot}{\variablestyle{ballot}}
156\newcommand{\vote}{\variablestyle{vote}}
157\newcommand{\processid}{\variablestyle{processID}}
158\newcommand{\censuspf}{\variablestyle{censusProof}}
159\newcommand{\commitment}{\variablestyle{identityCommitment}}
160\newcommand{\nullifier}{\variablestyle{nullifier}}
161\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
162\newcommand{\zkproof}{\variablestyle{ZKproof}}
163\newcommand{\signature}{\variablestyle{signature}}
164\newcommand{\address}{\variablestyle{address}}
165\newcommand{\stateproof}{\variablestyle{stateProof}}
166\newcommand{\merkleproofs}{\variablestyle{merkleProofs}}
167
168% State Merkle tree
169\newcommand{\censusroot}{\variablestyle{censusRoot}}
170\newcommand{\stateroot}{\variablestyle{stateRoot}}
171\newcommand{\type}{\variablestyle{type}}
172%\newcommand{\path}{\variablestyle{path}}
173\newcommand{\state}{\variablestyle{state}}
174\newcommand{\ballotmode}{\variablestyle{ballotMode}}
175\newcommand{\epk}{\variablestyle{encryptionKey}}
176\newcommand{\addaccumulator}{\variablestyle{resultsAdd}}
177\newcommand{\substractaccumulator}{\variablestyle{resultsSub}}
178\newcommand{\addresses}{\variablestyle{addresses}}
179\newcommand{\nullifiers}{\variablestyle{nullifiers}}
180\newcommand{\weight}{\variablestyle{weight}}
181\newcommand{\numoverwrites}{\variablestyle{numOverwrites}}
182\newcommand{\numvotes}{\variablestyle{numVotes}}
183\newcommand{\blobcomm}{\variablestyle{blobComm}}
184
185% Others
186\newcommand{\noi}{\noindent}
187\newcommand{\conc}{\:||\:}
188
189% Hyperlinks
190\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
191\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
192
193% Smart contracts
194\newcommand{\smartcontractstyle}[1]{{\sf{#1}}\xspace}
195\newcommand{\orgregistry}{\smartcontractstyle{OrganizationRegistry}}
196\newcommand{\electionregistry}{\smartcontractstyle{ElectionRegistry}}
197\newcommand{\dkgmanagement}{\smartcontractstyle{KeyManagement}}
198\newcommand{\statetransitionverifier}{\smartcontractstyle{StateTransitionVerifier}}
199\newcommand{\resultsverifier}{\smartcontractstyle{ResultsVerifier}}
200\newcommand{\censusmanagement}{\smartcontractstyle{CensusManagement}}
201
202% Blobs
203\newcommand{\blobstyle}[1]{{\sf{#1}}\xspace}
204\newcommand{\blobdata}{\blobstyle{blobData}}
205\newcommand{\blobcom}{\blobstyle{blobCommitment}}
206\newcommand{\evalpoint}{\blobstyle{evalPoint}}
207\newcommand{\openproof}{\blobstyle{openingProof}}
208
209% Cryptographic primitives
210\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
211\newcommand{\Keccak}{\methodstyle{Hash_1}}
212\newcommand{\Poseidon}{\methodstyle{Hash_2}}
213\newcommand{\Mimc}{\methodstyle{Hash_3}}
214\newcommand{\Multimimc}{\methodstyle{MultiMiMC7}}
215\newcommand{\Enc}{\methodstyle{Enc}}
216\newcommand{\Dec}{\methodstyle{Dec}}
217\newcommand{\EncAdd}{\methodstyle{EncAdd}}
218\newcommand{\ReEnc}{\methodstyle{ReEnc}}
219\newcommand{\SSign}{\methodstyle{S.Sign}}
220\newcommand{\SVer}{\methodstyle{S.Verify}}
221\newcommand{\SPubKey}{\methodstyle{S.ExtractPublicKey}}
222\newcommand{\CCommit}{\methodstyle{C.Commit}}
223\newcommand{\CSetup}{\methodstyle{C.Setup}}
224\newcommand{\COpen}{\methodstyle{C.Open}}
225\newcommand{\CVerifyPoly}{\methodstyle{C.VerifyPoly}}
226\newcommand{\CCreateWitness}{\methodstyle{C.CreateWitness}}
227\newcommand{\CVerifyEval}{\methodstyle{C.VerifyEval}}
228\newcommand{\CProve}{\methodstyle{C.Prove}}
229\newcommand{\CVerify}{\methodstyle{C.Verify}}
230\newcommand{\PProve}{\methodstyle{P.Prove}}
231\newcommand{\PVerify}{\methodstyle{P.Verify}}
232\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
233\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
234\newcommand{\GenerateEncryptedShares}{\methodstyle{GenerateEncryptedShares}}
235\newcommand{\VerifyEncryptedShare}{\methodstyle{VerifyEncryptedShare}}
236\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
237\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
238
239\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
240\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
241\newcommand{\sk}[1][]{{\sf{sk}^{#1}}}
242\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
243\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
244\newcommand{\sample}{\xleftarrow{\$}}
245
246% VOC token
247\newcommand{\token}{VOC\xspace}
248\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
249\newcommand{\baseCost}{\vocstyle{baseCost}}
250\newcommand{\capacityCost}{\vocstyle{capacityCost}}
251\newcommand{\durationCost}{\vocstyle{durationCost}}
252\newcommand{\fixedCost}{\vocstyle{fixedCost}}
253\newcommand{\maxVotes}{\vocstyle{maxVotes}}
254\newcommand{\maxDuration}{\vocstyle{maxDuration}}
255\newcommand{\numSequencers}{\vocstyle{numSequencers}}
256\newcommand{\processDuration}{\vocstyle{processDuration}}
257\newcommand{\reimbursement}{\vocstyle{reimbursement}}
258\newcommand{\securityCost}{\vocstyle{securityCost}}
259\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
260\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
261\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
262\newcommand{\totalCost}{\vocstyle{totalCost}}
263\newcommand{\totalReward}{\vocstyle{totalReward}}
264\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
265\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
266\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
267\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
268\newcommand{\votes}{\vocstyle{votes}}
269\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
270
271% Misc
272\newcommand{\davinci}{DAVINCI\xspace}
273\newcommand{\Davinci}{DAVINCI\xspace}
274\newcommand{\keywarden}{key warden\xspace}
275\newcommand{\Keywarden}{Key warden\xspace}
276\newcommand{\keywardens}{key wardens\xspace}
277\newcommand{\Keywardens}{Key wardens\xspace}
278
279% Draft watermark
280%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
281
282% New foonote referencing a previous footmark
283\makeatletter
284\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
285\makeatother