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