diff --git a/protocol/protocol.tex b/protocol/protocol.tex index ef927d17..fc40e3fb 100644 --- a/protocol/protocol.tex +++ b/protocol/protocol.tex @@ -5381,7 +5381,7 @@ where \vspace{-1.5ex} \pnote{The $\rt{Orchard}$, $\enableSpends$, and $\enableOutputs$ components are the same for all \actionTransfers in a \transaction. They are encoded once in the \transaction body (see -\crossref{txnencodingandconsensus}), not in the $\type{ActionDescription}$ structure. +\crossref{txnencoding}), not in the $\type{ActionDescription}$ structure. $\Proof{}$ is aggregated with other Action proofs and encoded in the $\proofsOrchard$ field of a \transaction.} @@ -5989,7 +5989,7 @@ non-\Zcash-specific parts of the \transaction. In \Zcash, all \sighashTypes are extended to cover the \Zcash-specific fields $\nJoinSplit$, $\vJoinSplit$, and if present $\joinSplitPubKey$. These fields -are described in \crossref{txnencodingandconsensus}. The hash \emph{does not} cover the field $\joinSplitSig$. +are described in \crossref{txnencoding}. The hash \emph{does not} cover the field $\joinSplitSig$. \overwinter{After \Overwinter activation, all \sighashTypes are also extended to cover \transaction fields introduced in that upgrade\sapling{, and similarly after \Sapling activation}\nufive{ and after \NUFive activation}. @@ -6126,7 +6126,7 @@ For a v4 \transaction, $\vBalance{Sapling}$ is always explicitly encoded. For a v5 \transaction, $\vBalance{Sapling}$ is implicitly zero if the \transaction has no \spendDescriptions or \outputDescriptions. } %nufive -Transaction fields are described in \crossref{txnencodingandconsensus}. +Transaction fields are described in \crossref{txnencoding}. A positive $\saplingBalancingValue$ takes value from the \defining{\SaplingTxValuePool} and adds it to the \transparentTxValuePool. A negative $\saplingBalancingValue$ does the @@ -12184,7 +12184,7 @@ upgrade-supporting nodes \MUST allow for this. \lsection{Consensus Changes from \BitcoinText}{consensusfrombitcoin} \vspace{-1ex} -\extralabel{txnencoding}{\lsubsection{Transaction Encoding and Consensus}{txnencodingandconsensus}} +\extralabel{txnencodingandconsensus}{\lsubsection{Transaction Encoding and Consensus}{txnencoding}} The \Zcash{} \defining{\transaction} format up to and including \transactionVersion $4$ is as follows (this should be read in the context of consensus rules later in the section): @@ -12412,6 +12412,19 @@ is defined to be $0$. \raggedright\!\!\Transactionversion 5 does not support \joinSplitTransfers. Several fields are reordered and/or renamed relative to prior versions.}} %scalebox %nufive +\lsubsubsection{Transaction Identifiers}{txnidentifiers} + +The \transactionID of a \sapling{version 4} or earlier \transaction is the \shadHash hash +of the \transaction encoding in the \notbeforenufive{pre-v5} format described above. + +\nufive{ +The \transactionID of a version 5 \transaction is as defined in \cite{ZIP-244}. A v5 +\transaction also has a \wtxid (used for example in the peer-to-peer protocol) as defined +in \cite{ZIP-239}. +} %nufive + +\lsubsubsection{Transaction Consensus Rules}{txnconsensus} + \begin{consensusrules} \item The \defining{\transactionVersionNumber} \MUST be greater than or equal to $1$. \preoverwinteritem{The \fOverwintered{} flag \MUSTNOT be set.} @@ -12517,6 +12530,8 @@ Several fields are reordered and/or renamed relative to prior versions.}} %scale \item \todo{Other rules inherited from \Bitcoin.} \end{consensusrules} +The types specified in \crossref{txnencoding} are part of the consensus rules. + Consensus rules associated with each \joinSplitDescription\, (\crossref{joinsplitencodingandconsensus})\sapling{,\, each \spendDescription\, (\crossref{spendencodingandconsensus}),\,\notnufive{ and} each \outputDescription\, (\crossref{outputencodingandconsensus})}\nufive{,\, and each \actionDescription\, (\crossref{actionencodingandconsensus})} @@ -12739,9 +12754,9 @@ A signature authorizing this Spend. \\ \hline \vspace{-1.5ex} \nufive{$\dagger$ The $\anchorField{}$, $\zkproof$, and $\spendAuthSigField$ fields are only present in a \spendDescription if the \transactionVersion is $4$. For v5 \transactions, all \spendDescriptions share -the same \anchor, which is encoded once as the $\anchorField{Sapling}$ field of the \transaction as described in -\crossref{txnencodingandconsensus}. The $\zkproof$ and $\spendAuthSigField$ fields have been -moved into $\vSpendProofsSapling$ and $\vSpendAuthSigs{Sapling}$ respectively for v5.} +the same \anchor, which is encoded once as the $\anchorField{Sapling}$ field of the \transaction as +described in \crossref{txnencoding}. The $\zkproof$ and $\spendAuthSigField$ fields have been moved into +$\vSpendProofsSapling$ and $\vSpendAuthSigs{Sapling}$ respectively for v5.} \vspace{-2ex} \consensusrule{$\LEOStoIPOf{256}{\anchorField{Sapling}}$\nufive{, if present,} \MUST be less than $\ParamJ{q}$.} @@ -13618,8 +13633,8 @@ recipient address represented by $\fsAddressList_{\fsAddressIndex(\BlockHeight)} standard redeem script hash is specified in \cite{Bitcoin-Multisig} for P2SH multisig addresses, or \cite{Bitcoin-P2SH} for other P2SH addresses. \item The ``prescribed way" to pay a \Sapling address is as defined in \cite{ZIP-213}, - using the post-\Heartwood consensus rules specified - for \Sapling outputs of \coinbaseTransactions in \crossref{txnencodingandconsensus}. + using the post-\Heartwood consensus rules specified for \Sapling outputs of + \coinbaseTransactions in \crossref{txnconsensus}. \end{itemize} } %canopyonward } %consensusrule @@ -13710,8 +13725,8 @@ be ignored: \cite{BIP-66}. The effect of \cite{BIP-34} has been incorporated into the consensus rules -(\crossref{txnencodingandconsensus}). This excludes the \Mainnet and \Testnet{} -\genesisBlocks, for which the ``height in coinbase'' was inadvertently omitted. +(\crossref{txnconsensus}). This excludes the \Mainnet and \Testnet{} \genesisBlocks, +for which the ``height in coinbase'' was inadvertently omitted. \cite{BIP-13} applies with the changes to address version bytes described in \crossref{transparentaddrencoding}. @@ -14414,10 +14429,13 @@ Peter Newell's illustration of the Jubjub bird, from \cite{Carroll1902}. \historyentry{2021.2.8}{} \begin{itemize} \nufive{ - \item Change one of the \sapling{[\Sapling onward]} consensus rules in \crossref{txnencodingandconsensus} + \item Change one of the \sapling{[\Sapling onward]} consensus rules in \crossref{txnconsensus} to have the correct applicability: \sapling{[\Sapling to \Canopy inclusive, \nufive{pre-\NUFive}]}. } % nufive \item Describe \transactionIDs\nufive{ and \wtxids} in \crossref{transactions}. + \item Add a section \crossref{txnidentifiers} on how to compute \transactionIDs\nufive{ and \wtxids}. + \item Split the \transaction-related consensus rules into their own subsection + \crossref{txnconsensus}, for more precise cross-referencing. \end{itemize} @@ -14439,7 +14457,7 @@ Peter Newell's illustration of the Jubjub bird, from \cite{Carroll1902}. \nufive{ \item Require that from \NUFive activation, the \nExpiryHeight field of a \coinbaseTransaction is set to the \blockHeight. This is needed to maintain the property that all \transactions - have unique \transactionIDs, as explained in a note in \crossref{txnencodingandconsensus}. + have unique \transactionIDs, as explained in a note in \crossref{txnconsensus}. In order to avoid the \blockHeight being limited to $499999999$, we also remove that bound on \nExpiryHeight{} for \coinbaseTransactions. \item Remove the recommendation to support $63$-bit \blockHeights in \crossref{blockchain} @@ -14474,7 +14492,7 @@ Peter Newell's illustration of the Jubjub bird, from \cite{Carroll1902}. \historyentry{2021.2.4}{2021-06-08} \begin{itemize} \nufive{ - \item Add an explicit consensus rule in \crossref{txnencodingandconsensus} that the + \item Add an explicit consensus rule in \crossref{txnconsensus} that the reserved bits of the \flagsOrchard{} field \MUST be zero. \item Correct a cut-and-paste error in the algorithm for \crossref{orcharddummynotes}, which should refer to the \actionStatement rather than the \spendStatement. @@ -14526,7 +14544,7 @@ Peter Newell's illustration of the Jubjub bird, from \cite{Carroll1902}. \historyentry{2021.2.1}{2021-05-20} \begin{itemize} \nufive{ - \item Correct the size of \vActionsOrchard{} in \crossref{txnencodingandconsensus}. + \item Correct the size of \vActionsOrchard{} in \crossref{txnencoding}. \item Change the type of \Orchard Merkle \merkleHashes to $\MerkleHashOrchard$, with a corresponding change to the signature of $\MerkleCRH{Orchard}$. Add a note to \crossref{merklepath} clarifying that \nonCanonicalFieldElement encodings are @@ -14822,7 +14840,7 @@ Peter Newell's illustration of the Jubjub bird, from \cite{Carroll1902}. \item Add macros and \Makefile support for building the \NUFive draft specification. \item Clarify the encoding of \blockHeights for the ``height in coinbase'' rule. The description of this rule has also moved from \shortcrossref{blockheader} to - \crossref{txnencodingandconsensus}. + \crossref{txnconsensus}. \item Include the activation dates of \Heartwood and \Canopy in \crossref{networkupgrades}. \item Section links in the \Heartwood and \Canopy versions of the specification now go to the correct document URL.