ZIP 202: "version group id" -> "version group ID"

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2020-03-17 15:15:24 +00:00
parent 5edc36cff1
commit 60485864f9
2 changed files with 37 additions and 26 deletions

View File

@ -145,7 +145,7 @@ License: MIT</pre>
<tr> <tr>
<td>&gt;= 3</td> <td>&gt;= 3</td>
<td><code>nVersionGroupId</code></td> <td><code>nVersionGroupId</code></td>
<td>version group id (not zero)</td> <td>version group ID (not zero)</td>
<td><code>uint32</code></td> <td><code>uint32</code></td>
</tr> </tr>
<tr> <tr>
@ -260,12 +260,12 @@ License: MIT</pre>
<p>Overwinter parsers will accept the transaction as valid as the most significant bit of the header has been set. By masking off (unsetting) the most significant bit, the parser can retrieve the transaction version number:</p> <p>Overwinter parsers will accept the transaction as valid as the most significant bit of the header has been set. By masking off (unsetting) the most significant bit, the parser can retrieve the transaction version number:</p>
<pre>0x80000003 &amp; 0x7FFFFFFF = 0x00000003 = 3</pre> <pre>0x80000003 &amp; 0x7FFFFFFF = 0x00000003 = 3</pre>
</section> </section>
<section id="version-group-id"><h3><span class="section-heading">Version Group Id</span><span class="section-anchor"> <a href="#version-group-id"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3> <section id="version-group-id"><h3><span class="section-heading">Version Group ID</span><span class="section-anchor"> <a href="#version-group-id"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The version group id is a non-zero, random and unique identifier, of type <code>uint32</code>, assigned to a transaction format version, or a group of soft-forking transaction format versions. The version group id helps nodes disambiguate between consensus branches using the same version number.</p> <p>The version group ID is a non-zero, random and unique identifier, of type <code>uint32</code>, assigned to a transaction format version, or a group of soft-forking transaction format versions. The version group ID helps nodes disambiguate between consensus branches using the same version number.</p>
<p>That is, it prevents a client on one branch of the network from attempting to parse transactions intended for another consensus branch, in the situation where the transactions share the same format version number but are actually specified differently. For example, Zcash and a clone of Zcash might both define their own custom v3 transaction formats, but each will have its own unique version group id, so that they can reject v3 transactions with unknown version group ids.</p> <p>That is, it prevents a client on one branch of the network from attempting to parse transactions intended for another consensus branch, in the situation where the transactions share the same format version number but are actually specified differently. For example, Zcash and a clone of Zcash might both define their own custom v3 transaction formats, but each will have its own unique version group ID, so that they can reject v3 transactions with unknown version group IDs.</p>
<p>The combination of transaction version and version group id, <code>nVersion || nVersionGroupId</code>, uniquely defines the transaction format, thus enabling parsers to reject transactions from outside the client's chain which cannot be parsed.</p> <p>The combination of transaction version and version group ID, <code>nVersion || nVersionGroupId</code>, uniquely defines the transaction format, thus enabling parsers to reject transactions from outside the client's chain which cannot be parsed.</p>
<p>By convention, it is expected that when introducing a new transaction version requiring a network upgrade, a new unique version group id will be assigned to that transaction version.</p> <p>By convention, it is expected that when introducing a new transaction version requiring a network upgrade, a new unique version group ID will be assigned to that transaction version.</p>
<p>However, if a new transaction version can be correctly parsed according to the format of a preceding version (that is, it only restricts the format, or defines fields that were previously reserved and which old parsers can safely ignore), then the same version group id MAY be re-used.</p> <p>However, if a new transaction version can be correctly parsed according to the format of a preceding version (that is, it only restricts the format, or defines fields that were previously reserved and which old parsers can safely ignore), then the same version group ID MAY be re-used.</p>
</section> </section>
<section id="expiry-height"><h3><span class="section-heading">Expiry Height</span><span class="section-anchor"> <a href="#expiry-height"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3> <section id="expiry-height"><h3><span class="section-heading">Expiry Height</span><span class="section-anchor"> <a href="#expiry-height"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The expiry height field, as defined in the Transaction Expiry ZIP <a id="id8" class="footnote_reference" href="#zip-0203">5</a>, stores the block height after which a transaction can no longer be mined.</p> <p>The expiry height field, as defined in the Transaction Expiry ZIP <a id="id8" class="footnote_reference" href="#zip-0203">5</a>, stores the block height after which a transaction can no longer be mined.</p>
@ -275,13 +275,13 @@ License: MIT</pre>
<p>A valid Overwinter transaction intended for Zcash MUST have:</p> <p>A valid Overwinter transaction intended for Zcash MUST have:</p>
<ul> <ul>
<li>version number 3; and</li> <li>version number 3; and</li>
<li>version group id 0x03C48270 <a id="id9" class="footnote_reference" href="#versiongroupid">6</a>; and</li> <li>version group ID 0x03C48270 <a id="id9" class="footnote_reference" href="#versiongroupid">6</a>; and</li>
<li><code>fOverwintered</code> flag set.</li> <li><code>fOverwintered</code> flag set.</li>
</ul> </ul>
<p>Overwinter validators MUST reject transactions for violating consensus rules if:</p> <p>Overwinter validators MUST reject transactions for violating consensus rules if:</p>
<ul> <ul>
<li>the <code>fOverwintered</code> flag is not set; or</li> <li>the <code>fOverwintered</code> flag is not set; or</li>
<li>the version group id is unknown; or</li> <li>the version group ID is unknown; or</li>
<li>the version number is unknown.</li> <li>the version number is unknown.</li>
</ul> </ul>
<p>Validation of version 3 transactions MUST use the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP <a id="id10" class="footnote_reference" href="#zip-0143">2</a>.</p> <p>Validation of version 3 transactions MUST use the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP <a id="id10" class="footnote_reference" href="#zip-0143">2</a>.</p>
@ -296,7 +296,7 @@ License: MIT</pre>
... ...
} }
}</pre> }</pre>
<p>When (de)serializing v3 transactions, the version group id must also be checked in case the transaction is intended for a consensus branch which has a different format for its version 3 transaction:</p> <p>When (de)serializing v3 transactions, the version group ID must also be checked in case the transaction is intended for a consensus branch which has a different format for its version 3 transaction:</p>
<pre>if (tx.nVersion == 3 &amp;&amp; tx.nVersionGroupId == OVERWINTER_VERSION_GROUP_ID) { <pre>if (tx.nVersion == 3 &amp;&amp; tx.nVersionGroupId == OVERWINTER_VERSION_GROUP_ID) {
auto expiryHeight = tx.nExpiryHeight; auto expiryHeight = tx.nExpiryHeight;
}</pre> }</pre>
@ -316,7 +316,7 @@ License: MIT</pre>
// Valid v3 format transaction intended for this client's chain // Valid v3 format transaction intended for this client's chain
}</pre> }</pre>
<p>It is expected that this test involving <code>nVersionGroupId</code> is only required when a transaction is being constructed or deserialized e.g. when an external transaction enters the system.</p> <p>It is expected that this test involving <code>nVersionGroupId</code> is only required when a transaction is being constructed or deserialized e.g. when an external transaction enters the system.</p>
<p>However, it's possible that a clone of Zcash is using the same version group id and passes the conditional.</p> <p>However, it's possible that a clone of Zcash is using the same version group ID and passes the conditional.</p>
<p>Ultimately, a client can determine if a transaction is truly intended for the client's chain or not by following the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP <a id="id11" class="footnote_reference" href="#zip-0143">2</a>.</p> <p>Ultimately, a client can determine if a transaction is truly intended for the client's chain or not by following the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP <a id="id11" class="footnote_reference" href="#zip-0143">2</a>.</p>
</section> </section>
</section> </section>
@ -325,7 +325,7 @@ License: MIT</pre>
</section> </section>
<section id="backwards-compatibility"><h2><span class="section-heading">Backwards compatibility</span><span class="section-anchor"> <a href="#backwards-compatibility"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h2> <section id="backwards-compatibility"><h2><span class="section-heading">Backwards compatibility</span><span class="section-anchor"> <a href="#backwards-compatibility"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p>This proposal intentionally creates what is known as a "bilateral consensus rule change" <a id="id13" class="footnote_reference" href="#zip-0200">3</a> between pre-Overwinter software and Overwinter-compatible software. Use of this new transaction format requires that all network participants upgrade their software to a compatible version within the upgrade window. Pre-Overwinter software will treat Overwinter transactions as invalid.</p> <p>This proposal intentionally creates what is known as a "bilateral consensus rule change" <a id="id13" class="footnote_reference" href="#zip-0200">3</a> between pre-Overwinter software and Overwinter-compatible software. Use of this new transaction format requires that all network participants upgrade their software to a compatible version within the upgrade window. Pre-Overwinter software will treat Overwinter transactions as invalid.</p>
<p>Once Overwinter has activated, Overwinter-compatible software will reject version 1 and version 2 transactions, and will only accept transactions based upon supported transaction version numbers and recognized version group ids.</p> <p>Once Overwinter has activated, Overwinter-compatible software will reject version 1 and version 2 transactions, and will only accept transactions based upon supported transaction version numbers and recognized version group IDs.</p>
</section> </section>
<section id="reference-implementation"><h2><span class="section-heading">Reference Implementation</span><span class="section-anchor"> <a href="#reference-implementation"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h2> <section id="reference-implementation"><h2><span class="section-heading">Reference Implementation</span><span class="section-anchor"> <a href="#reference-implementation"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h2>
<p><a href="https://github.com/zcash/zcash/pull/2925">https://github.com/zcash/zcash/pull/2925</a></p> <p><a href="https://github.com/zcash/zcash/pull/2925">https://github.com/zcash/zcash/pull/2925</a></p>

View File

@ -81,7 +81,7 @@ Version Field Description Type
- ``fOverwintered`` flag - ``fOverwintered`` flag
(bit 31, always set) (bit 31, always set)
- ``nVersion`` (bits 30-0) - ``nVersion`` (bits 30-0)
>= 3 ``nVersionGroupId`` version group id (not zero) ``uint32`` >= 3 ``nVersionGroupId`` version group ID (not zero) ``uint32``
>= 1 ``tx_in_count`` variable-length integer ``compactSize`` >= 1 ``tx_in_count`` variable-length integer ``compactSize``
>= 1 ``tx_in`` list of inputs ``vector`` >= 1 ``tx_in`` list of inputs ``vector``
>= 1 ``tx_out_count`` variable-length integer ``compactSize`` >= 1 ``tx_out_count`` variable-length integer ``compactSize``
@ -146,24 +146,29 @@ Overwinter parsers will accept the transaction as valid as the most significant
0x80000003 & 0x7FFFFFFF = 0x00000003 = 3 0x80000003 & 0x7FFFFFFF = 0x00000003 = 3
Version Group Id Version Group ID
---------------- ----------------
The version group id is a non-zero, random and unique identifier, of type ``uint32``, assigned The version group ID is a non-zero, random and unique identifier, of type ``uint32``, assigned
to a transaction format version, or a group of soft-forking transaction format versions. The to a transaction format version, or a group of soft-forking transaction format versions. The
version group id helps nodes disambiguate between consensus branches using the same version number. version group ID helps nodes disambiguate between consensus branches using the same version number.
That is, it prevents a client on one branch of the network from attempting to parse transactions That is, it prevents a client on one branch of the network from attempting to parse transactions
intended for another consensus branch, in the situation where the transactions share the same intended for another consensus branch, in the situation where the transactions share the same
format version number but are actually specified differently. For example, Zcash and a clone of format version number but are actually specified differently. For example, Zcash and a clone of
Zcash might both define their own custom v3 transaction formats, but each will have its own Zcash might both define their own custom v3 transaction formats, but each will have its own
unique version group id, so that they can reject v3 transactions with unknown version group ids. unique version group ID, so that they can reject v3 transactions with unknown version group IDs.
The combination of transaction version and version group id, ``nVersion || nVersionGroupId``, uniquely defines the transaction format, thus enabling parsers to reject transactions from outside the client's chain which cannot be parsed. The combination of transaction version and version group ID, ``nVersion || nVersionGroupId``,
uniquely defines the transaction format, thus enabling parsers to reject transactions from outside
the client's chain which cannot be parsed.
By convention, it is expected that when introducing a new transaction version requiring a network upgrade, a new unique version group id will be assigned to that transaction version. By convention, it is expected that when introducing a new transaction version requiring a network
upgrade, a new unique version group ID will be assigned to that transaction version.
However, if a new transaction version can be correctly parsed according to the format of a preceding version (that is, it only restricts the format, or defines fields that were previously reserved and which old parsers can safely ignore), then the same version group id MAY be re-used. However, if a new transaction version can be correctly parsed according to the format of a
preceding version (that is, it only restricts the format, or defines fields that were previously
reserved and which old parsers can safely ignore), then the same version group ID MAY be re-used.
Expiry Height Expiry Height
------------- -------------
@ -176,13 +181,13 @@ Transaction Validation
A valid Overwinter transaction intended for Zcash MUST have: A valid Overwinter transaction intended for Zcash MUST have:
- version number 3; and - version number 3; and
- version group id 0x03C48270 [#versiongroupid]_; and - version group ID 0x03C48270 [#versiongroupid]_; and
- ``fOverwintered`` flag set. - ``fOverwintered`` flag set.
Overwinter validators MUST reject transactions for violating consensus rules if: Overwinter validators MUST reject transactions for violating consensus rules if:
- the ``fOverwintered`` flag is not set; or - the ``fOverwintered`` flag is not set; or
- the version group id is unknown; or - the version group ID is unknown; or
- the version number is unknown. - the version number is unknown.
Validation of version 3 transactions MUST use the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP [#zip-0143]_. Validation of version 3 transactions MUST use the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP [#zip-0143]_.
@ -205,7 +210,7 @@ Tests can continue to check for the existence of forwards-compatible transaction
} }
} }
When (de)serializing v3 transactions, the version group id must also be checked in case the When (de)serializing v3 transactions, the version group ID must also be checked in case the
transaction is intended for a consensus branch which has a different format for its version 3 transaction is intended for a consensus branch which has a different format for its version 3
transaction:: transaction::
@ -239,7 +244,7 @@ To test if the format of an Overwinter transaction is both v3 and the transactio
It is expected that this test involving ``nVersionGroupId`` is only required when a transaction is being constructed or deserialized e.g. when an external transaction enters the system. It is expected that this test involving ``nVersionGroupId`` is only required when a transaction is being constructed or deserialized e.g. when an external transaction enters the system.
However, it's possible that a clone of Zcash is using the same version group id and passes the conditional. However, it's possible that a clone of Zcash is using the same version group ID and passes the conditional.
Ultimately, a client can determine if a transaction is truly intended for the client's chain or not by following the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP [#zip-0143]_. Ultimately, a client can determine if a transaction is truly intended for the client's chain or not by following the signature verification process detailed in the Transaction Signature Verification for Overwinter ZIP [#zip-0143]_.
@ -251,9 +256,15 @@ This proposal will be deployed with the Overwinter network upgrade. The activati
Backwards compatibility Backwards compatibility
======================= =======================
This proposal intentionally creates what is known as a "bilateral consensus rule change" [#zip-0200]_ between pre-Overwinter software and Overwinter-compatible software. Use of this new transaction format requires that all network participants upgrade their software to a compatible version within the upgrade window. Pre-Overwinter software will treat Overwinter transactions as invalid. This proposal intentionally creates what is known as a "bilateral consensus rule change"
[#zip-0200]_ between pre-Overwinter software and Overwinter-compatible software. Use of
this new transaction format requires that all network participants upgrade their software
to a compatible version within the upgrade window. Pre-Overwinter software will treat
Overwinter transactions as invalid.
Once Overwinter has activated, Overwinter-compatible software will reject version 1 and version 2 transactions, and will only accept transactions based upon supported transaction version numbers and recognized version group ids. Once Overwinter has activated, Overwinter-compatible software will reject version 1 and
version 2 transactions, and will only accept transactions based upon supported transaction
version numbers and recognized version group IDs.
Reference Implementation Reference Implementation