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