From 917dbf5c46d149f2ca5efa0d70d5c843edba4a21 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Fri, 6 Nov 2020 00:30:52 +0000 Subject: [PATCH] Add a missing consensus rule that has always been implemented in zcashd: there must be at least one transparent output, Sapling output, or JoinSplit in a transaction. Signed-off-by: Daira Hopwood --- protocol/protocol.tex | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/protocol/protocol.tex b/protocol/protocol.tex index 5b165cfa..b0337d13 100644 --- a/protocol/protocol.tex +++ b/protocol/protocol.tex @@ -897,8 +897,8 @@ electronic commerce and payment, financial privacy, proof of work, zero knowledg \newcommand{\transparentTxValuePool}{\termandindex{transparent transaction value pool}{transaction value pool (transparent)}} % There is no Sprout transaction value pool, since JoinSplits are balanced individually. \newcommand{\SaplingTxValuePool}{\termandindex{\textbf{Sapling} transaction value pool}{transaction value pool (Sapling)}} -\newcommand{\SproutChainValuePoolTotal}{\termandindex{\textbf{Sapling} chain value pool total}{chain value pool total (Sapling)}} -\newcommand{\SaplingChainValuePoolTotal}{\termandindex{\textbf{Sapling} chain value pool total}{chain value pool total (Sapling)}} +\newcommand{\SproutChainValuePoolBalance}{\termandindex{\textbf{Sprout} chain value pool balance}{chain value pool balance (Sprout)}} +\newcommand{\SaplingChainValuePoolBalance}{\termandindex{\textbf{Sapling} chain value pool balance}{chain value pool balance (Sapling)}} \newcommand{\shielded}{\term{shielded}} \newcommand{\xShielded}{\termx{shielded}} \newcommand{\blockChain}{\term{block chain}} @@ -9118,18 +9118,20 @@ $\versionField \geq 4$ and $\nShieldedSpend + \nShieldedOutput > 0$. be $\hexint{892F2085}$.} \presaplingitem{The encoded size of the \transaction{} \MUST be less than or equal to $100000$ bytes.} - \presaplingitem{If $\versionField = 1$ or $\nJoinSplit = 0$, then \txInCount{} \MUSTNOT be $0$.} + \presaplingitem{If $\versionField = 1$ or $\nJoinSplit = 0$, then both \txInCount{} and \txOutCount{} \MUST be nonzero.\!} \saplingonwarditem{At least one of \txInCount, \nShieldedSpend, and \nJoinSplit{} \MUST be nonzero.} + \saplingonwarditem{At least one of \txOutCount, \nShieldedOutput, and \nJoinSplit{} \MUST be nonzero.} \item A \transaction with one or more \transparent inputs from \coinbaseTransactions{} \MUST have no - \transparent outputs (i.e.\ \txOutCount{} \MUST be $0$). Note that inputs from + \transparent outputs (i.e.\ \txOutCount{} \MUST be $0$). Inputs from \coinbaseTransactions include \foundersReward outputs. \item If $\versionField \geq 2$ and $\nJoinSplit > 0$, then: \begin{itemize} - \item \joinSplitPubKey{} \MUST represent a valid encoding (as specified in \crossref{concretejssig}) of + \item \joinSplitPubKey{} \MUST be a valid encoding (see \crossref{concretejssig}) of an \EdSpecific \validatingKey. \item \joinSplitSig{} \MUST represent a valid signature under \joinSplitPubKey{} of $\dataToBeSigned$, as defined in \crossref{sproutnonmalleability}. \end{itemize} + \vspace{-1ex} \saplingonwarditem{If $\versionField \geq 4$ and $\nShieldedSpend + \nShieldedOutput > 0$, then: \begin{itemize} @@ -9138,6 +9140,7 @@ $\versionField \geq 4$ and $\nShieldedSpend + \nShieldedOutput > 0$. $\BindingPublic$ of $\SigHash$ --- i.e.\ $\BindingSigValidate{\BindingPublic}(\SigHash, \bindingSig) = 1$. \end{itemize}} + \vspace{-1ex} \saplingonwarditem{If $\versionField \geq 4$ and $\nShieldedSpend + \nShieldedOutput = 0$, then $\valueBalance$ \MUST be $0$.} \item The total amount of \transparentOutputs from a \coinbaseTransaction,\heartwood{ minus @@ -10875,6 +10878,9 @@ Peter Newell's illustration of the Jubjub bird, from \cite{Carroll1902}. \historyentry{2020.1.15}{} \begin{itemize} + \item Add a missing consensus rule that has always been implemented in \zcashd: there + must be at least one \transparentOutput, \outputDescription, or \joinSplitDescription + in a \transaction. \item Define \SproutChainValuePoolBalance\sapling{ and \SaplingChainValuePoolBalance,} and include consensus rules from \cite{ZIP-209}. \sapling{