This page is the Simplified Technical English version of ZIP 215. The source ZIP is the normative text. Read the writing rules to understand the marked words.
ZIP 215: Explicitly Defining and Modifying Ed25519 Validation Rules
ZIP: 215 Title: Explicitly Defining and Modifying Ed25519 Validation Rules Owners: Henry de Valence <hdevalence@zfnd.org> Status: Final Category: Consensus Created: 2020-04-27 License: BSD-2-Clause
Terminology
On this page, STE words are in the place of the BCP 14 key words of the source. Refer to the key word table.
Abstract
In Zcash, Ed25519 signatures are a part of Sprout transactions. But Ed25519 has no clear definition of the validity criteria for a signature. It is not necessary for implementations that conform to RFC 8032 [RFC8032] to agree on the validity of a signature. This is unacceptable for a consensus-critical application like Zcash.
At this time, the validity criteria for a signature in Zcash are inherited from an obsolete version of libsodium. Instead, the situation is settled in this ZIP. This ZIP has an explicit definition of the Ed25519 validity criteria. In this ZIP, the criteria are also changed to be compatible with batch validation.
Motivation
The lack of clear validity criteria for Ed25519 signatures is a maintenance burden. The initial implementation of Zcash consensus in zcashd inherited the validity criteria from a then-current version of libsodium (1.0.15).
Because of a bug in libsodium, these criteria were different from the intended criteria that were documented in the Zcash protocol specification [protocol-2020.1.1]. (Later, in specification version 2020.1.2, the specification was changed to match libsodium 1.0.15.)
Also, libsodium never had a guarantee of stable validity criteria. Its behavior changed in a later point release. Thus zcashd had to use an older version of the library. Eventually, zcashd patched a newer version to have consistent validity criteria.
To be compatible, Zebra had to implement a special library, ed25519-zebra, to give Zcash-flavored Ed25519. This library was an attempt to match libsodium 1.0.15 exactly. The initial attempt to implement ed25519-zebra was also incompatible, because it matched the wrong compile-time configuration of libsodium exactly.
In addition, batch validation of Ed25519 signatures is not possible with the validity criteria of Zcash. Signature validation is not the primary bottleneck for Zcash. But batch validation of signatures is desirable. Batch validation is possible for RedJubjub.
Specification
After activation of this ZIP, the validation rules of \(\mathsf{JoinSplitSig}\) in [protocol-concreteed25519] change to these rules:
- \(\underline{A}\) and \(\underline{R}\) must be encodings of points \(A\) and \(R\) respectively on the complete twisted Edwards curve Ed25519.
- \(\underline{S}\) must represent an integer \(S\) less than \(\ell\).
- The group equation \([8][S]B = [8]R + [8][k]A\) must be satisfied. \(k\) and \(B\) are defined as in RFC 8032 sections §5.1.7 and §5.1 respectively [RFC8032].
The language about \(\mathsf{ExcludedPointEncodings}\) in §5.4.5 of the Zcash specification [protocol-concreteed25519] no longer applies.
It is not necessary that \(\underline{A}\) and \(\underline{R}\) are canonical encodings. That is, the integer that encodes the \(y\)-coordinate of the points can be unreduced modulo \(2^{255}-19\).
Note: In RFC 8032, the alternate validation equation \([S]B = R + [k]A\) is an option. This equation must not be used.
Rationale
With this change, the Ed25519 validation logic is simpler and the future maintenance burden is smaller. With multiplication by the cofactor, the validation equation has more solutions, not fewer. Thus this change is compatible with all existing Ed25519 signatures on the chain.
With this change, the use of batch validation is also possible. For batch validation, multiplication by the cofactor is necessary in the validation equation.
Security and Privacy Considerations
This change has no effect on honestly-generated signatures. Unlike the current validation rules, this change has this result: a user can generate weak signing keys, or generate signing keys with a nonzero torsion component and send them to the block chain.
But the user gets no advantage from these actions. The only result is a compromise of the security of that user. Also, these cases are not a failure mode of any deployed implementation.
Deployment
This ZIP is intended for deployment with the Canopy network upgrade [zip-0251]. Canopy is scheduled to activate on Mainnet [protocol-networks] at block height 1046400.
References
- [BCP14]
- Information on BCP 14 — "RFC 2119: Key words for use in RFCs to Indicate Requirement Levels" and "RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"
- [RFC8032]
- RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA)
- [protocol-2020.1.1]
- Zcash Protocol Specification, Version 2020.1.1
- [protocol-networks]
- Zcash Protocol Specification, Version 2021.2.16. Section 3.12: Mainnet and Testnet
- [protocol-concreteed25519]
- Zcash Protocol Specification, Version 2021.2.16. Section 5.4.6: Ed25519
- [zip-0251]
- ZIP 251: Deployment of the Canopy Network Upgrade