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% 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\newcommand{\batchsize}{\variablestyle{batchSize}}
192
193% Hyperlinks
194\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
195\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
196
197% Smart contracts
198\newcommand{\smartcontractstyle}[1]{{\sf{#1}}\xspace}
199\newcommand{\orgregistry}{\smartcontractstyle{OrganizationRegistry}}
200\newcommand{\electionregistry}{\smartcontractstyle{ElectionRegistry}}
201\newcommand{\dkgmanagement}{\smartcontractstyle{KeyManagement}}
202\newcommand{\statetransitionverifier}{\smartcontractstyle{StateTransitionVerifier}}
203\newcommand{\resultsverifier}{\smartcontractstyle{ResultsVerifier}}
204\newcommand{\censusmanagement}{\smartcontractstyle{CensusManagement}}
205
206% Blobs
207\newcommand{\blobstyle}[1]{{\sf{#1}}\xspace}
208\newcommand{\blobdata}{\blobstyle{blobData}}
209\newcommand{\blobcom}{\blobstyle{blobCommitment}}
210\newcommand{\evalpoint}{\blobstyle{evalPoint}}
211\newcommand{\openproof}{\blobstyle{openingProof}}
212
213% Cryptographic primitives
214\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
215\newcommand{\Keccak}{\methodstyle{Keccak}}
216\newcommand{\Poseidon}{\methodstyle{Poseidon}}
217\newcommand{\Mimc}{\methodstyle{MiMC}}
218\newcommand{\Multimimc}{\methodstyle{MultiMiMC7}}
219\newcommand{\Enc}{\methodstyle{Enc}}
220\newcommand{\Dec}{\methodstyle{Dec}}
221\newcommand{\EncAdd}{\methodstyle{EncAdd}}
222\newcommand{\ReEnc}{\methodstyle{ReEnc}}
223\newcommand{\SSign}{\methodstyle{S.Sign}}
224\newcommand{\SVer}{\methodstyle{S.Verify}}
225\newcommand{\SPubKey}{\methodstyle{S.ExtractPublicKey}}
226\newcommand{\CCommit}{\methodstyle{C.Commit}}
227\newcommand{\CSetup}{\methodstyle{C.Setup}}
228\newcommand{\COpen}{\methodstyle{C.Open}}
229\newcommand{\CVerifyPoly}{\methodstyle{C.VerifyPoly}}
230\newcommand{\CCreateWitness}{\methodstyle{C.CreateWitness}}
231\newcommand{\CVerifyEval}{\methodstyle{C.VerifyEval}}
232\newcommand{\CProve}{\methodstyle{C.Prove}}
233\newcommand{\CVerify}{\methodstyle{C.Verify}}
234\newcommand{\PProve}{\methodstyle{P.Prove}}
235\newcommand{\PVerify}{\methodstyle{P.Verify}}
236\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
237\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
238\newcommand{\GenerateEncryptedShares}{\methodstyle{GenerateEncryptedShares}}
239\newcommand{\VerifyEncryptedShare}{\methodstyle{VerifyEncryptedShare}}
240\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
241\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
242
243\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
244\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
245\newcommand{\sk}[1][]{{\sf{sk}^{#1}}} 
246\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
247\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
248\newcommand{\sample}{\xleftarrow{\$}}
249
250% VOC token
251\newcommand{\token}{VOC\xspace}
252\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
253\newcommand{\baseCost}{\vocstyle{baseCost}}
254\newcommand{\capacityCost}{\vocstyle{capacityCost}}
255\newcommand{\durationCost}{\vocstyle{durationCost}}
256\newcommand{\fixedCost}{\vocstyle{fixedCost}}
257\newcommand{\maxVotes}{\vocstyle{maxVotes}}
258\newcommand{\maxDuration}{\vocstyle{maxDuration}}
259\newcommand{\numSequencers}{\vocstyle{numSequencers}}
260\newcommand{\processDuration}{\vocstyle{processDuration}}
261\newcommand{\reimbursement}{\vocstyle{reimbursement}}
262\newcommand{\securityCost}{\vocstyle{securityCost}}
263\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
264\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
265\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
266\newcommand{\totalCost}{\vocstyle{totalCost}}
267\newcommand{\totalReward}{\vocstyle{totalReward}}
268\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
269\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
270\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
271\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
272\newcommand{\votes}{\vocstyle{votes}}
273\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
274
275% Misc
276\newcommand{\davinci}{DAVINCI\xspace}
277\newcommand{\Davinci}{DAVINCI\xspace}
278\newcommand{\keywarden}{key warden\xspace}
279\newcommand{\Keywarden}{Key warden\xspace}
280\newcommand{\keywardens}{key wardens\xspace}
281\newcommand{\Keywardens}{Key wardens\xspace}
282
283% Draft watermark
284%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
285
286% New foonote referencing a previous footmark
287\makeatletter
288\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
289\makeatother