Add Makefile changes and macros for Heartwood spec.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2019-11-25 22:00:43 +00:00
parent 624aa9eaa1
commit 149dfcdb53
2 changed files with 89 additions and 16 deletions

View File

@ -3,7 +3,7 @@ SHELL=/bin/bash -eo pipefail
# Experimental; options are pdflatex, lualatex, or xelatex. # Experimental; options are pdflatex, lualatex, or xelatex.
# On Debian, LuaLaTeX needs the texlive-luatex package, and XeLaTeX needs the texlive-xetex package. # On Debian, LuaLaTeX needs the texlive-luatex package, and XeLaTeX needs the texlive-xetex package.
# Make sure to read <https://github.com/zcash/zips/issues/249>. # Make sure to read <https://github.com/zcash/zips/issues/249>.
ENGINE= ENGINE=pdflatex
LATEXMKOPT_pdflatex= LATEXMKOPT_pdflatex=
LATEXMKOPT_xelatex=-pdflatex=xelatex -dvi- -ps- LATEXMKOPT_xelatex=-pdflatex=xelatex -dvi- -ps-
@ -15,7 +15,7 @@ LATEX=$(ENGINE) --halt-on-error --file-line-error
NOCRUFT=|awk '{gsub(/[({<][/][^ ]* ?/,"")}1' NOCRUFT=|awk '{gsub(/[({<][/][^ ]* ?/,"")}1'
.PHONY: all .PHONY: all
all: blossom sapling sprout all: heartwood blossom sapling sprout
sprout.pdf: protocol.tex zcash.bib incremental_merkle.png key_components.png sprout.pdf: protocol.tex zcash.bib incremental_merkle.png key_components.png
$(MAKE) sprout $(MAKE) sprout
@ -26,6 +26,9 @@ sapling.pdf: protocol.tex zcash.bib incremental_merkle.png key_components_saplin
blossom.pdf: protocol.tex zcash.bib incremental_merkle.png key_components_sapling.png blossom.pdf: protocol.tex zcash.bib incremental_merkle.png key_components_sapling.png
$(MAKE) blossom $(MAKE) blossom
heartwood.pdf: protocol.tex zcash.bib incremental_merkle.png key_components_sapling.png
$(MAKE) heartwood
.PHONY: auxsprout .PHONY: auxsprout
auxsprout: auxsprout:
printf '\\renewcommand{\\docversion}{Version %s [\\SproutSpec]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver printf '\\renewcommand{\\docversion}{Version %s [\\SproutSpec]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver
@ -84,6 +87,25 @@ pvcblossom:
rm -f aux/blossom.* rm -f aux/blossom.*
$(LATEXMK) -jobname=blossom -auxdir=aux -pvc protocol $(NOCRUFT) $(LATEXMK) -jobname=blossom -auxdir=aux -pvc protocol $(NOCRUFT)
.PHONY: auxheartwood
auxheartwood:
printf '\\toggletrue{isheartwood}\n\\renewcommand{\\docversion}{Version %s [\\HeartwoodSpec]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver
mkdir -p aux
rm -f aux/heartwood.*
$(LATEXMK) -jobname=heartwood -auxdir=aux -outdir=aux protocol $(NOCRUFT)
.PHONY: heartwood
heartwood:
$(MAKE) auxheartwood
mv -f aux/heartwood.pdf .
.PHONY: pvcheartwood
pvcheartwood:
printf '\\toggletrue{isheartwood}\n\\renewcommand{\\docversion}{Version %s [\\HeartwoodSpec]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver
mkdir -p aux
rm -f aux/heartwood.*
$(LATEXMK) -jobname=heartwood -auxdir=aux -pvc protocol $(NOCRUFT)
.PHONY: nolatexmk-sprout .PHONY: nolatexmk-sprout
nolatexmk-sprout: nolatexmk-sprout:
printf '\\renewcommand{\\docversion}{Version %s [\\SproutSpec]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver printf '\\renewcommand{\\docversion}{Version %s [\\SproutSpec]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver
@ -121,9 +143,21 @@ nolatexmk-blossom:
$(LATEX) -jobname=blossom protocol.tex || { touch incremental_merkle.png; exit 1; } $(LATEX) -jobname=blossom protocol.tex || { touch incremental_merkle.png; exit 1; }
cp -f blossom.pdf protocol.pdf cp -f blossom.pdf protocol.pdf
.PHONY: nolatexmk-heartwood
nolatexmk-heartwood:
printf '\\toggletrue{isheartwood}\n\\renewcommand{\\docversion}{Version %s [\\HeartwoodSpec]}' "$$(git describe --tags --abbrev=6)" |tee protocol.ver
# If $(LATEX) fails, touch an input so that 'make' won't think it is up-to-date next time.
rm -f heartwood.aux heartwood.bbl heartwood.blg heartwood.brf heartwood.bcf
$(LATEX) -jobname=heartwood protocol.tex || { touch incremental_merkle.png; exit 1; }
biber heartwood
$(LATEX) -jobname=heartwood protocol.tex || { touch incremental_merkle.png; exit 1; }
$(LATEX) -jobname=heartwood protocol.tex || { touch incremental_merkle.png; exit 1; }
sh mymakeindex.sh -o heartwood.ind heartwood.idx
$(LATEX) -jobname=heartwood protocol.tex || { touch incremental_merkle.png; exit 1; }
.PHONY: clean .PHONY: clean
clean: clean:
rm -f aux/* html/* protocol.ver \ rm -f aux/* html/* protocol.ver protocol.pdf \
sprout.dvi sprout.pdf sprout.bbl sprout.blg sprout.brf sprout.toc \ sprout.dvi sprout.pdf sprout.bbl sprout.blg sprout.brf sprout.toc \
sprout.aux sprout.out sprout.log sprout.bcf sprout.run.xml sprout.fls sprout.fdb_latexmk \ sprout.aux sprout.out sprout.log sprout.bcf sprout.run.xml sprout.fls sprout.fdb_latexmk \
sprout.idx sprout.ilg sprout.ind sprout.ind.original \ sprout.idx sprout.ilg sprout.ind sprout.ind.original \
@ -132,4 +166,7 @@ clean:
sapling.idx sapling.ilg sapling.ind sapling.ind.original \ sapling.idx sapling.ilg sapling.ind sapling.ind.original \
blossom.dvi blossom.pdf blossom.bbl blossom.blg blossom.brf blossom.toc \ blossom.dvi blossom.pdf blossom.bbl blossom.blg blossom.brf blossom.toc \
blossom.aux blossom.out blossom.log blossom.bcf blossom.run.xml blossom.fls blossom.fdb_latexmk \ blossom.aux blossom.out blossom.log blossom.bcf blossom.run.xml blossom.fls blossom.fdb_latexmk \
blossom.idx blossom.ilg blossom.ind blossom.ind.original blossom.idx blossom.ilg blossom.ind blossom.ind.original \
heartwood.dvi heartwood.pdf heartwood.bbl heartwood.blg heartwood.brf heartwood.toc \
heartwood.aux heartwood.out heartwood.log heartwood.bcf heartwood.run.xml heartwood.fls heartwood.fdb_latexmk \
heartwood.idx heartwood.ilg heartwood.ind heartwood.ind.original

View File

@ -483,10 +483,13 @@
\newcommand{\SproutSpec}{Sprout} \newcommand{\SproutSpec}{Sprout}
\newcommand{\SaplingSpec}{Overwinter+Sapling} \newcommand{\SaplingSpec}{Overwinter+Sapling}
\newcommand{\BlossomSpec}{Overwinter+Sapling+Blossom} \newcommand{\BlossomSpec}{Overwinter+Sapling+Blossom}
\newcommand{\HeartwoodSpec}{Overwinter+Sapling+Blossom+Heartwood}
\newtoggle{issapling} \newtoggle{issapling}
\togglefalse{issapling} \togglefalse{issapling}
\newtoggle{isblossom} \newtoggle{isblossom}
\togglefalse{isblossom} \togglefalse{isblossom}
\newtoggle{isheartwood}
\togglefalse{isheartwood}
\InputIfFileExists{protocol.ver}{}{} \InputIfFileExists{protocol.ver}{}{}
\newcommand{\doctitle}{Zcash Protocol Specification} \newcommand{\doctitle}{Zcash Protocol Specification}
@ -513,15 +516,33 @@ electronic commerce and payment, financial privacy, proof of work, zero knowledg
\newcommand{\saplingcolor}{green} \newcommand{\saplingcolor}{green}
\newcommand{\overwintercolor}{blue} \newcommand{\overwintercolor}{blue}
\newcommand{\blossomcolor}{red} \newcommand{\blossomcolor}{red}
\newcommand{\heartwoodcolor}{orange}
\newcommand{\labelcolor}{yellow!20} \newcommand{\labelcolor}{yellow!20}
\iftoggle{isheartwood}{
\toggletrue{isblossom}
\newcommand{\setheartwood}{\color{\heartwoodcolor}}
\newcommand{\heartwood}[1]{\texorpdfstring{{\setheartwood{#1}}}{#1}}
\newcommand{\notheartwood}[1]{}
\newcommand{\notbeforeheartwood}[1]{#1}
} {
\newcommand{\setheartwood}{}
\newcommand{\heartwood}[1]{}
\newcommand{\notheartwood}[1]{#1}
\newcommand{\notbeforeheartwood}[1]{}
}
\iftoggle{isblossom}{ \iftoggle{isblossom}{
\toggletrue{issapling} \toggletrue{issapling}
\newcommand{\setblossom}{\color{\blossomcolor}} \newcommand{\setblossom}{\color{\blossomcolor}}
\newcommand{\blossom}[1]{\texorpdfstring{{\setblossom{#1}}}{#1}} \newcommand{\blossom}[1]{\texorpdfstring{{\setblossom{#1}}}{#1}}
\newcommand{\notblossom}[1]{} \newcommand{\notblossom}[1]{}
\newcommand{\notbeforeblossom}[1]{#1} \newcommand{\notbeforeblossom}[1]{#1}
\iftoggle{isheartwood}{
\newcommand{\baseurl}{https://zips.z.cash/protocol/heartwood.pdf}
} {
\newcommand{\baseurl}{https://zips.z.cash/protocol/protocol.pdf} \newcommand{\baseurl}{https://zips.z.cash/protocol/protocol.pdf}
}
} { } {
\newcommand{\setblossom}{} \newcommand{\setblossom}{}
\newcommand{\blossom}[1]{} \newcommand{\blossom}[1]{}
@ -619,6 +640,8 @@ electronic commerce and payment, financial privacy, proof of work, zero knowledg
\newcommand{\SaplingText}{\textbf{Sapling}} \newcommand{\SaplingText}{\textbf{Sapling}}
\newcommand{\Blossom}{\termbf{Blossom}} \newcommand{\Blossom}{\termbf{Blossom}}
\newcommand{\BlossomText}{\textbf{Blossom}} \newcommand{\BlossomText}{\textbf{Blossom}}
\newcommand{\Heartwood}{\termbf{Heartwood}}
\newcommand{\HeartwoodText}{\textbf{Heartwood}}
\newcommand{\Bitcoin}{\termbf{Bitcoin}} \newcommand{\Bitcoin}{\termbf{Bitcoin}}
\newcommand{\BitcoinText}{\textbf{Bitcoin}} \newcommand{\BitcoinText}{\textbf{Bitcoin}}
\newcommand{\CryptoNote}{\termbf{CryptoNote}} \newcommand{\CryptoNote}{\termbf{CryptoNote}}
@ -1966,13 +1989,20 @@ electronic commerce and payment, financial privacy, proof of work, zero knowledg
\newcommand{\consensusrule}[1]{\needspace{4ex}\vspace{2ex}\callout{}{Consensus rule:}{#1}} \newcommand{\consensusrule}[1]{\needspace{4ex}\vspace{2ex}\callout{}{Consensus rule:}{#1}}
\newenvironment{consensusrules}{\introlist\callout{}{Consensus rules:}\begin{itemize}}{\end{itemize}} \newenvironment{consensusrules}{\introlist\callout{}{Consensus rules:}\begin{itemize}}{\end{itemize}}
\newcommand{\sproutspecificitem}[1]{\item \sproutspecific{#1}}
\newcommand{\preheartwooditem}[1]{\item \preheartwood{#1}}
\newcommand{\heartwoodonwarditem}[1]{\heartwood{\item {[\Heartwood onward]}\, {#1}}}
\newcommand{\preblossomitem}[1]{\item \preblossom{#1}}
\newcommand{\blossomonwarditem}[1]{\blossom{\item {[\Blossom onward]}\, {#1}}}
\newcommand{\presaplingitem}[1]{\item \presapling{#1}} \newcommand{\presaplingitem}[1]{\item \presapling{#1}}
\newcommand{\saplingonwarditem}[1]{\sapling{\item {[\Sapling onward]}\, {#1}}} \newcommand{\saplingonwarditem}[1]{\sapling{\item {[\Sapling onward]}\, {#1}}}
\newcommand{\preoverwinteritem}[1]{\item \preoverwinter{#1}} \newcommand{\preoverwinteritem}[1]{\item \preoverwinter{#1}}
\newcommand{\overwinteronlyitem}[1]{\overwinter{\item {[\Overwinter only, pre-\Sapling\!]}\, {#1}}} \newcommand{\overwinteronlyitem}[1]{\overwinter{\item {[\Overwinter only, pre-\Sapling\!]}\, {#1}}}
\newcommand{\overwinteronwarditem}[1]{\overwinter{\item {[\Overwinter onward]}\, {#1}}} \newcommand{\overwinteronwarditem}[1]{\overwinter{\item {[\Overwinter onward]}\, {#1}}}
\newcommand{\sproutspecific}[1]{\notsprout{[\Sprout\!]\,} {#1}} \newcommand{\sproutspecificitem}[1]{\item \sproutspecific{#1}}
\newcommand{\preheartwood}[1]{\notbeforeheartwood{[Pre-\Heartwood\!]\,} {#1}}
\newcommand{\heartwoodonward}[1]{\heartwood{[\Heartwood onward]\, {#1}}}
\newcommand{\preblossom}[1]{\notbeforeblossom{[Pre-\Blossom\!]\,} {#1}} \newcommand{\preblossom}[1]{\notbeforeblossom{[Pre-\Blossom\!]\,} {#1}}
\newcommand{\blossomonward}[1]{\blossom{[\Blossom onward]\, {#1}}} \newcommand{\blossomonward}[1]{\blossom{[\Blossom onward]\, {#1}}}
\newcommand{\presapling}[1]{\notsprout{[Pre-\Sapling\!]\,} {#1}} \newcommand{\presapling}[1]{\notsprout{[Pre-\Sapling\!]\,} {#1}}
@ -1980,6 +2010,7 @@ electronic commerce and payment, financial privacy, proof of work, zero knowledg
\newcommand{\preoverwinter}[1]{\notsprout{[Pre-\Overwinter\!]\,} {#1}} \newcommand{\preoverwinter}[1]{\notsprout{[Pre-\Overwinter\!]\,} {#1}}
\newcommand{\overwinteronly}[1]{\overwinter{[\Overwinter only, pre-\Sapling\!]\, {#1}}} \newcommand{\overwinteronly}[1]{\overwinter{[\Overwinter only, pre-\Sapling\!]\, {#1}}}
\newcommand{\overwinteronward}[1]{\overwinter{[\Overwinter onward]\, {#1}}} \newcommand{\overwinteronward}[1]{\overwinter{[\Overwinter onward]\, {#1}}}
\newcommand{\sproutspecific}[1]{\notsprout{[\Sprout\!]\,} {#1}}
\newcommand{\securityrequirement}[1]{\needspace{4ex}\vspace{2ex}\callout{}{Security requirement:}{#1}} \newcommand{\securityrequirement}[1]{\needspace{4ex}\vspace{2ex}\callout{}{Security requirement:}{#1}}
\newenvironment{securityrequirements}{\introlist\callout{}{Security requirements:}\begin{itemize}}{\end{itemize}} \newenvironment{securityrequirements}{\introlist\callout{}{Security requirements:}\begin{itemize}}{\end{itemize}}
@ -1988,11 +2019,14 @@ electronic commerce and payment, financial privacy, proof of work, zero knowledg
\newenvironment{pnotes}{\introlist\callout{}{Notes:}\begin{itemize}}{\end{itemize}} \newenvironment{pnotes}{\introlist\callout{}{Notes:}\begin{itemize}}{\end{itemize}}
\newcommand{\nnote}[1]{\needspace{4ex}\vspace{2ex}\callout{}{Non-normative note:}{#1}} \newcommand{\nnote}[1]{\needspace{4ex}\vspace{2ex}\callout{}{Non-normative note:}{#1}}
\newenvironment{nnotes}{\introlist\callout{}{Non-normative notes:}\begin{itemize}}{\end{itemize}} \newenvironment{nnotes}{\introlist\callout{}{Non-normative notes:}\begin{itemize}}{\end{itemize}}
\newcommand{\sproutspecificpnote}[1]{\callout{\notsprout{[\Sprout\!]\,\,}}{Note:}{#1}}
\newcommand{\preheartwoodpnote}[1]{\callout{\notsprout{[Pre-\Heartwood\!]\,\,}}{Note:}{#1}}
\newcommand{\presaplingpnote}[1]{\callout{\notsprout{[Pre-\Sapling\!]\,\,}}{Note:}{#1}} \newcommand{\presaplingpnote}[1]{\callout{\notsprout{[Pre-\Sapling\!]\,\,}}{Note:}{#1}}
\newcommand{\preoverwinterpnote}[1]{\callout{\notsprout{[Pre-\Overwinter\!]\,\,}}{Note:}{#1}} \newcommand{\preoverwinterpnote}[1]{\callout{\notsprout{[Pre-\Overwinter\!]\,\,}}{Note:}{#1}}
\newcommand{\overwinteronlypnote}[1]{\callout{\overwinter{[\Overwinter only, pre-\Sapling\!]\,\,}}{Note:}{#1}} \newcommand{\overwinteronlypnote}[1]{\callout{\overwinter{[\Overwinter only, pre-\Sapling\!]\,\,}}{Note:}{#1}}
\newcommand{\overwinteronwardpnote}[1]{\callout{\overwinter{[\Overwinter onward]\,\,}}{Note:}{#1}} \newcommand{\overwinteronwardpnote}[1]{\callout{\overwinter{[\Overwinter onward]\,\,}}{Note:}{#1}}
\newcommand{\sproutspecificpnote}[1]{\callout{\notsprout{[\Sprout\!]\,\,}}{Note:}{#1}}
\newcommand{\fact}[1]{\callout{}{Fact:}{#1}} \newcommand{\fact}[1]{\callout{}{Fact:}{#1}}
\newcommand{\facts}[1]{\callout{}{Facts:}{#1}} \newcommand{\facts}[1]{\callout{}{Facts:}{#1}}
\newcommand{\snarkcondition}[2]{\callout{}{#1}\phantomsection\label{#2}} \newcommand{\snarkcondition}[2]{\callout{}{#1}\phantomsection\label{#2}}
@ -2088,6 +2122,8 @@ Changes specific to the \Sapling upgrade following \Overwinter
are highlighted in \sapling{\saplingcolor}. are highlighted in \sapling{\saplingcolor}.
\notbeforeblossom{Changes specific to the \Blossom upgrade following \Sapling \notbeforeblossom{Changes specific to the \Blossom upgrade following \Sapling
are highlighted in \blossom{\blossomcolor}.} are highlighted in \blossom{\blossomcolor}.}
\notbeforeheartwood{Changes specific to the \Heartwood upgrade following \Blossom
are highlighted in \heartwood{\heartwoodcolor}.}
All of these are also changes from \Zerocash. All of these are also changes from \Zerocash.
The name \Sprout is used for the \Zcash protocol prior to \Sapling The name \Sprout is used for the \Zcash protocol prior to \Sapling
(both before and after \Overwinter). (both before and after \Overwinter).