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