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