From 1fafff988a6769aec74911309ea204b8fa6dc6a0 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Fri, 5 Jun 2020 15:54:52 +0100 Subject: [PATCH] ZIP 215: editorial and formatting changes; regenerate HTML. Signed-off-by: Daira Hopwood --- README.rst | 1 + index.html | 1 + zip-0215.html | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++ zip-0215.rst | 32 +++++++++-------- 4 files changed, 116 insertions(+), 15 deletions(-) create mode 100644 zip-0215.html diff --git a/README.rst b/README.rst index 1d763c1f..9ff53875 100644 --- a/README.rst +++ b/README.rst @@ -82,6 +82,7 @@ Index of ZIPs 212 Allow Recipient to Derive Sapling Ephemeral Secret from Note Plaintext Proposed 213 Shielded Coinbase Implemented (zcashd) 214 Consensus rules for a Zcash Development Fund Proposed + 215 Explicitly define Ed25519 validation rules Proposed 221 FlyClient - Consensus-Layer Changes Implemented (zcashd) 243 Transaction Signature Verification for Sapling Final 250 Deployment of the Heartwood Network Upgrade Implemented (zcashd) diff --git a/index.html b/index.html index 55e02882..376febea 100644 --- a/index.html +++ b/index.html @@ -55,6 +55,7 @@ 212 Allow Recipient to Derive Sapling Ephemeral Secret from Note Plaintext Proposed 213 Shielded Coinbase Implemented (zcashd) 214 Consensus rules for a Zcash Development Fund Proposed + 215 Explicitly define Ed25519 validation rules Proposed 221 FlyClient - Consensus-Layer Changes Implemented (zcashd) 243 Transaction Signature Verification for Sapling Final 250 Deployment of the Heartwood Network Upgrade Implemented (zcashd) diff --git a/zip-0215.html b/zip-0215.html new file mode 100644 index 00000000..f8c588eb --- /dev/null +++ b/zip-0215.html @@ -0,0 +1,97 @@ + + + + ZIP 215: Explicitly define Ed25519 validation rules + + + + +
+
ZIP: 215
+Title: Explicitly define Ed25519 validation rules
+Owners: Henry de Valence <hdevalence@zfnd.org>
+Status: Proposed
+Category: Consensus
+Created: 2020-04-27
+License: BSD-2-Clause
+

Terminology

+

The key word "MUST" in this document is to be interpreted as described in RFC 2119. 1

+
+

Abstract

+

Zcash uses Ed25519 signatures as part of Sprout transactions. However, Ed25519 does not clearly define criteria for signature validity, and implementations conformant to RFC 8032 2 need not agree on whether signatures are valid. This is unacceptable for a consensus-critical application like Zcash. Currently, Zcash inherits criteria for signature verification from an obsolete version of libsodium. Instead, this ZIP settles the situation by explicitly defining the Ed25519 verification criteria and changing them to be compatible with batch verification.

+
+

Motivation

+

The lack of clear verification criteria for Ed25519 signatures poses a maintenance burden. The initial implementation of Zcash consensus in zcashd inherited validation criteria from a then-current version of libsodium (1.0.15). Due to a bug in libsodium, this was different from the intended criteria documented in the Zcash protocol specification 3 (before the specification was changed to match libsodium 1.0.15 in specification version 2020.1.2). Also, libsodium never guaranteed stable validation criteria, and changed behavior in a later point release. This forced zcashd to use an older version of the library before eventually patching a newer version to have consistent validation criteria. To be compatible, Zebra had to implement a special library, ed25519-zebra to provide Zcash-flavored Ed25519, attempting to match libsodium 1.0.15 exactly. And the initial attempt to implement ed25519-zebra was also incompatible, because it precisely matched the wrong compile-time configuration of libsodium.

+

In addition, the validation criteria used by Zcash preclude the use of batch verification of Ed25519 signatures. While signature verification is not the primary bottleneck for Zcash, it would be nice to be able to batch-verify signatures, as is the case for RedJubJub.

+
+

Specification

+

After activation of this ZIP, the + \(\mathsf{JoinSplitSig}\) + validation rules in §5.4.5 of the protocol specification 3 are changed to the following:

+
    +
  • + \(\underline{A}\) + and + \(\underline{R}\) + MUST be encodings of a point on the Edwards form of Curve25519;
  • +
  • + \(\underline{S}\) + MUST represent an integer less than + \(\ell\) + ;
  • +
  • The group equation + \([8][s]B = [8]R + [8][k]A\) + MUST be satisfied, where + \(k\) + is defined as in RFC 8032 §5.1.7. 2
  • +
+

The language about ExcludedPointEncodings in §5.4.5 of the Zcash specification no longer applies.

+

It is not required that + \(\underline{A}\) + and + \(\underline{R}\) + are canonical encodings; in other words, the integer encoding the + \(y\) + -coordinate of the points may be unreduced modulo + \(2^{255}-19\) + .

+
+

Rationale

+

This change simplifies the Ed25519 validation logic and reduces future maintenance burden. Because multiplication by the cofactor admits more solutions to the verification equation, not fewer, it is compatible with all existing Ed25519 signatures on the chain.

+

It also allows the use of batch verification, which requires multiplication by the cofactor in the verification equation.

+
+

Security and Privacy Considerations

+

This change has no effect on honestly-generated signatures. Unlike the current validation rules, it makes it possible for a user to generate weak signing keys or to generate signing keys with nonzero torsion component and submit them to the blockchain. However, doing so provides them with no advantage, only compromise to their own security. Moreover, these cases are not a failure mode of any deployed implementation.

+
+

Deployment

+

This is intended to be deployed with the Canopy Network Upgrade, which is scheduled to activate on Mainnet at block height 1046400.

+
+

References

+ + + + + + + +
1Key words for use in RFCs to Indicate Requirement Levels
+ + + + + + + +
2Edwards-Curve Digital Signature Algorithm (EdDSA)
+ + + + + + + +
3Zcash Protocol Specification, Version 2020.1.5 or later [Overwinter+Sapling+Blossom+Heartwood]
+
+
+ + \ No newline at end of file diff --git a/zip-0215.rst b/zip-0215.rst index 5e05ebef..156812e2 100644 --- a/zip-0215.rst +++ b/zip-0215.rst @@ -12,15 +12,15 @@ Terminology =========== -The key word "MUST" in this document is to be interpreted as -described in `RFC2119`_. +The key word "MUST" in this document is to be interpreted as described in +RFC 2119. [#RFC2119]_ Abstract ======== Zcash uses Ed25519 signatures as part of Sprout transactions. However, Ed25519 does not clearly define criteria for signature validity, and implementations conformant -to `RFC8032`_ need not agree on whether signatures are valid. This is +to RFC 8032 [#RFC8032]_ need not agree on whether signatures are valid. This is unacceptable for a consensus-critical application like Zcash. Currently, Zcash inherits criteria for signature verification from an obsolete version of `libsodium`. Instead, this ZIP settles the situation by explicitly defining the @@ -53,19 +53,21 @@ signatures, as is the case for RedJubJub. Specification ============= -After activation of this ZIP, the `JoinSplitSig` validation rules in §5.4.5 of the -protocol specification [#protocol]_ are changed to the following: +After activation of this ZIP, the :math:`\mathsf{JoinSplitSig}` validation rules +in §5.4.5 of the protocol specification [#protocol]_ are changed to the following: -- :math:`\underline{A}` and :math:`\underline{R}` MUST be encodings of a point on the Edwards form of Curve25519; -- :math:`underline{S}` MUST represent an integer less than :math:`\ell`; -- The group equation `[8][s]B = [8]R + [8][k]A` MUST be satisfied, where `k` is defined as in RFC 8032 §5.1.7. +- :math:`\underline{A}` and :math:`\underline{R}` MUST be encodings of a point + on the Edwards form of Curve25519; +- :math:`\underline{S}` MUST represent an integer less than :math:`\ell`; +- The group equation :math:`[8][s]B = [8]R + [8][k]A` MUST be satisfied, where + :math:`k` is defined as in RFC 8032 §5.1.7. [#RFC8032]_ The language about `ExcludedPointEncodings` in §5.4.5 of the Zcash -specification is deleted. +specification no longer applies. -It is *not* required that `A` and `R` are canonical encodings; in other words, -the integer encoding the `y`-coordinate of the points may be unreduced modulo -`2^255-19`. +It is *not* required that :math:`\underline{A}` and :math:`\underline{R}` +are canonical encodings; in other words, the integer encoding the +:math:`y`-coordinate of the points may be unreduced modulo :math:`2^{255}-19`. Rationale ========= @@ -89,14 +91,14 @@ compromise to their own security. Moreover, these cases are not a failure mode of any deployed implementation. Deployment -========= +========== This is intended to be deployed with the Canopy Network Upgrade, which is -scheduled to activate on mainnet at block height 1046400. +scheduled to activate on Mainnet at block height 1046400. References ========== .. [#RFC2119] `Key words for use in RFCs to Indicate Requirement Levels `_ .. [#RFC8032] `Edwards-Curve Digital Signature Algorithm (EdDSA) `_ -.. [#protocol] `Zcash Protocol Specification, Version {...} or later [Overwinter+Sapling+Blossom] `_ +.. [#protocol] `Zcash Protocol Specification, Version 2020.1.5 or later [Overwinter+Sapling+Blossom+Heartwood] `_