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
  8% Working directory
  9\newcommand{\definedir}[2]{\newcommand{#1}{#2}}
 10\definedir{\secs}{../sections}
 11\definedir{\figs}{../figures}
 12\definedir{\bib}{../bibliography}
 13
 14% Comments
 15\newcommand{\marta}[1]{\todo[size=\small, color=red!40]{\textbf{Marta}: #1}}
 16\newcommand{\martai}[1]{\todo[inline, size=\small, color=red!40]{\textbf{Marta}: #1}}
 17\newcommand{\pau}[1]{\todo[size=\small, color=blue!40]{\textbf{Pau}: #1}}
 18\newcommand{\paui}[1]{\todo[inline, size=\small, color=blue!40]{\textbf{Pau}: #1}}
 19\newcommand{\jordi}[1]{\todo[size=\small, color=green!40]{\textbf{Jordi}: #1}}
 20\newcommand{\jordii}[1]{\todo[inline, size=\small, color=green!40]{\textbf{Jordi}: #1}}
 21
 22% Freefootnote
 23\let\svthefootnote\thefootnote
 24\newcommand\freefootnote[1]{%
 25	\let\thefootnote\relax%
 26	\footnotetext{#1}%
 27	\let\thefootnote\svthefootnote%
 28}
 29
 30% Footnote spaces
 31\setlength{\skip\footins}{20pt}      % space between text and footnotes
 32\setlength{\footnotesep}{1em}        % space between individual footnotes
 33
 34% Table of contents style
 35% Make section entries bold in ToC
 36\makeatletter
 37\renewcommand{\@dotsep}{4.5}
 38\renewcommand{\l@section}[2]{\addpenalty{\@secpenalty}
 39	\addvspace{1.0em plus 1pt}
 40	\@tempdima=1.5em
 41	\parindent \z@ \rightskip \@pnumwidth
 42	\parfillskip -\@pnumwidth
 43	{\leavevmode
 44		\advance\leftskip\@tempdima
 45		\hskip -\leftskip
 46		\bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par}
 47\makeatother
 48
 49% Adds vertical space before and after \subsubsection headings and ensures body text starts on a new line
 50\makeatletter
 51\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
 52	{-18\p@ \@plus -4\p@ \@minus -4\p@}%   % Before skip
 53	{4\p@ \@plus 2\p@ \@minus 2\p@}%      % After skip
 54	{\normalfont\normalsize\bfseries}}   % Font style
 55\makeatother
 56
 57% Colours
 58\definecolor{cred}{rgb}{1, 0.5, 0.5}
 59\definecolor{cgreen}{rgb}{0.5, 1, 0.5}
 60\definecolor{cblue}{rgb}{0.5, 0.5, 1}
 61
 62% Hyperref setup
 63%\hypersetup{
 64%	final=true,
 65%	colorlinks=true,
 66%	linkcolor=cblue,
 67%	urlcolor=black,
 68%	citecolor=cblue,
 69%}
 70
 71% Mathbb
 72\newcommand{\N}{\ensuremath{\mathbb{N}}\xspace}
 73\newcommand{\Z}{\ensuremath{\mathbb{Z}}\xspace}
 74\newcommand{\G}{\ensuremath{\mathbb{G}}\xspace}
 75\newcommand{\F}{\ensuremath{\mathbb{F}}\xspace}
 76\newcommand{\J}{\ensuremath{\mathbb{J}}\xspace}
 77
 78% Elliptic curves
 79\newcommand{\BW}[1]{\ensuremath{{#1}^{\text{\tiny \sf BW}}}\xspace}
 80\newcommand{\BLS}[1]{\ensuremath{{#1}^{\text{\tiny \sf BLS}}}\xspace}
 81\newcommand{\BN}[1]{\ensuremath{{#1}^{\text{\tiny \sf BN}}}\xspace}
 82\newcommand{\BJ}[1]{\ensuremath{{#1}^{\text{\tiny \sf BJ}}}\xspace}
 83\newcommand{\SEC}[1]{\ensuremath{{#1}^{\text{\tiny \sf SEC}}}\xspace}
 84
 85% Trees
 86\newcommand{\tree}[1][]{\sf{MT}^{\sf{#1}}}
 87\renewcommand{\root}[1][]{\sf{root}^{\sf{#1}}}
 88\newcommand{\recentroots}{\sf{recentRoots}}
 89\newcommand{\leaf}{\sf{leaf}}
 90\newcommand{\leaves}{\sf{leaves}}
 91\newcommand{\MTGenerate}{\sf{Generate}}
 92\newcommand{\MTRoot}{\sf{Root}}
 93\newcommand{\MTInsert}{\sf{Insert}}
 94\newcommand{\MTProof}{\sf{Proof}}
 95\newcommand{\MTMembershipProof}{\sf{MembershipProof}}
 96\newcommand{\MTNonMembershipProof}{\sf{NonMembershipProof}}
 97\newcommand{\MTRemove}{\sf{Remove}}
 98\newcommand{\MTOpen}{\sf{Open}}
 99\newcommand{\MTUpdate}{\sf{Update}}
100\newcommand{\MTVerify}{\sf{Verify}}
101\newcommand{\censusTree}{\sf{MT^{\census}}}
102\newcommand{\stateTree}{\sf{MT^{\state}}}
103
104% Circuits
105\newcommand{\public}{{\sf\color{teal}public}\xspace}
106\newcommand{\private}{{\sf\color{red}private}\xspace}
107
108% Roles
109\definecolor{voterbg}{RGB}{200, 230, 200}  % soft, muted green
110\definecolor{organizerbg}{RGB}{245, 222, 135}  % classic mustard tone
111\definecolor{sequencerbg}{RGB}{235, 225, 250}  % soft lavender-like purple
112\definecolor{darkgrayborder}{RGB}{100, 100, 100}  % dark neutral gray
113
114\newcommand{\voter}{\fcolorbox{darkgrayborder}{voterbg}{ \textsf{voter} }\xspace}
115\newcommand{\organizer}{\fcolorbox{darkgrayborder}{organizerbg}{ \textsf{organizer} }\xspace}
116\newcommand{\sequencer}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencer} }\xspace}
117\newcommand{\sequencers}{\fcolorbox{darkgrayborder}{sequencerbg}{ \textsf{sequencers} }\xspace}
118
119% Ballot protocol
120\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
121\newcommand{\numfields}{\ballotstyle{numFields}}
122\newcommand{\maxvalue}{\ballotstyle{maxValue}}
123\newcommand{\minvalue}{\ballotstyle{minValue}}
124\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
125\newcommand{\maxvaluesum}{\ballotstyle{maxValueSum}}
126\newcommand{\minvaluesum}{\ballotstyle{minValueSum}}
127\newcommand{\costexponent}{\ballotstyle{costExponent}}
128\newcommand{\totalvaluesum}{\ballotstyle{totalValueSum}}
129\newcommand{\validvote}{\ballotstyle{validVote}}
130% Voting protocol
131\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
132\newcommand{\census}{\variablestyle{census}}
133\newcommand{\censusdata}{\variablestyle{censusData}}
134\newcommand{\voteproof}{\variablestyle{voteProof}}
135\newcommand{\ballotproof}{\variablestyle{ballotProof}}
136\newcommand{\censusproof}{\variablestyle{censusProof}}
137\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
138\newcommand{\aggregationproof}{\variablestyle{aggregationProof}}
139\newcommand{\voteid}{\variablestyle{voteID}}
140\newcommand{\ballot}{\variablestyle{ballot}}
141\newcommand{\vote}{\variablestyle{vote}}
142\newcommand{\processid}{\variablestyle{processID}}
143\newcommand{\censuspf}{\variablestyle{censusProof}}
144\newcommand{\commitment}{\variablestyle{identityCommitment}}
145\newcommand{\nullifier}{\variablestyle{nullifier}}
146\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
147\newcommand{\zkproof}{\variablestyle{ZKproof}}
148\newcommand{\signature}{\variablestyle{signature}}
149\newcommand{\address}{\variablestyle{address}}
150\newcommand{\stateproof}{\variablestyle{stateProof}}
151
152% State Merkle tree
153\newcommand{\censusroot}{\variablestyle{censusRoot}}
154\newcommand{\stateroot}{\variablestyle{stateRoot}}
155\newcommand{\type}{\variablestyle{type}}
156%\newcommand{\path}{\variablestyle{path}}
157\newcommand{\state}{\variablestyle{state}}
158\newcommand{\ballotmode}{\variablestyle{ballotMode}}
159\newcommand{\epk}{\variablestyle{encryptionKey}}
160\newcommand{\addaccumulator}{\variablestyle{resultsAdd}}
161\newcommand{\substractaccumulator}{\variablestyle{resultsSub}}
162\newcommand{\addresses}{\variablestyle{addresses}}
163\newcommand{\nullifiers}{\variablestyle{nullifiers}}
164\newcommand{\weight}{\variablestyle{weight}}
165
166% Others
167\newcommand{\noi}{\noindent}
168\newcommand{\conc}{\:||\:}
169
170% Hyperlinks
171\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
172\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
173
174% Cryptographic primitives
175\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
176\newcommand{\Keccak}{\methodstyle{Hash_1}}
177\newcommand{\Poseidon}{\methodstyle{Hash_2}}
178\newcommand{\Mimc}{\methodstyle{Hash_3}}
179\newcommand{\Multimimc}{\methodstyle{MultiMiMC7}}
180\newcommand{\Enc}{\methodstyle{Enc}}
181\newcommand{\Dec}{\methodstyle{Dec}}
182\newcommand{\EncAdd}{\methodstyle{EncAdd}}
183\newcommand{\ReEnc}{\methodstyle{ReEnc}}
184\newcommand{\SSign}{\methodstyle{S.Sign}}
185\newcommand{\SVer}{\methodstyle{S.Verify}}
186\newcommand{\PProve}{\methodstyle{P.Prove}}
187\newcommand{\PVerify}{\methodstyle{P.Verify}}
188\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
189\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
190\newcommand{\GenerateEncryptedShares}{\methodstyle{GenerateEncryptedShares}}
191\newcommand{\VerifyEncryptedShare}{\methodstyle{VerifyEncryptedShare}}
192\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
193\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
194
195\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
196\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
197\newcommand{\sk}[1][]{{\sf{sk}^{#1}}} 
198\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
199\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
200\newcommand{\sample}{\xleftarrow{\$}}
201
202% VOC token
203\newcommand{\token}{VOC\xspace}
204\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
205\newcommand{\baseCost}{\vocstyle{baseCost}}
206\newcommand{\capacityCost}{\vocstyle{capacityCost}}
207\newcommand{\durationCost}{\vocstyle{durationCost}}
208\newcommand{\fixedCost}{\vocstyle{fixedCost}}
209\newcommand{\maxVotes}{\vocstyle{maxVotes}}
210\newcommand{\maxDuration}{\vocstyle{maxDuration}}
211\newcommand{\numSequencers}{\vocstyle{numSequencers}}
212\newcommand{\processDuration}{\vocstyle{processDuration}}
213\newcommand{\reimbursement}{\vocstyle{reimbursement}}
214\newcommand{\securityCost}{\vocstyle{securityCost}}
215\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
216\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
217\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
218\newcommand{\totalCost}{\vocstyle{totalCost}}
219\newcommand{\totalReward}{\vocstyle{totalReward}}
220\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
221\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
222\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
223\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
224\newcommand{\votes}{\vocstyle{votes}}
225\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
226
227% Misc
228\newcommand{\davinci}{DAVINCI\xspace}
229\newcommand{\Davinci}{DAVINCI\xspace}
230
231% Draft watermark
232%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
233
234% New foonote referencing a previous footmark
235\makeatletter
236\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
237\makeatother