Commit Graph

15423 Commits

Author SHA1 Message Date
Kris Nuttycombe f14651b56b Update transaction auth commitments for pre-v5 transactions.
As specified in https://github.com/zcash/zips/pull/520

Fixes #5218
2021-06-15 08:21:46 -06:00
Homu c5bb13d35c Auto merge of #5167 - str4d:5164-block-bench-fix, r=str4d
Re-include reading blocks from disk in block connection benchmark

Fixes a regression introduced in zcash/zcash#4427.

Closes zcash/zcash#5164.
2021-06-15 13:15:56 +00:00
Homu 6808b33eab Auto merge of #5217 - str4d:5194-orchard-sig-checks, r=str4d
Implement Orchard signature validation consensus rules

Implemented via an `AuthValidator` class that internally uses batch validation.

- Currently, only RedPallas signatures are batch-validated. We can extend
  this validator to cover Halo 2 proofs in the future.

- Signatures in a batch are not retried individually if the batch fails:
  - For per-transaction batching (when adding to the mempool), we don't
    care which signature within the transaction failed.
  - For per-block batching, we currently don't care which transaction
    failed. We might do so in future, at which point this behaviour can
    be easily changed.

Closes zcash/zcash#5194.
2021-06-15 00:47:09 +00:00
Jack Grigg 36b4d130ab rust: Fix patched dependencies
The orchard crate was pinning a specific rev of zcash_note_encryption
which prevented CI from vendoring the crate dependencies. Now orchard
uses a patch, which enables us to similarly patch here to get the
correct crate versions throughout our tree (while the crates are still
in flux).
2021-06-15 01:11:32 +01:00
Homu e9462066ad Auto merge of #5216 - str4d:ci-book-fix, r=str4d
CI book fixes
2021-06-14 23:34:37 +00:00
Jack Grigg 3fe8285c7e Implement Orchard signature validation consensus rules 2021-06-14 22:47:00 +01:00
Jack Grigg af1b9c15bb Implement Orchard authorization batch validator
- Currently, only RedPallas signatures are batch-validated. We can extend
  this validator to cover Halo 2 proofs in the future.

- Signatures in a batch are not retried individually if the batch fails:
  - For per-transaction batching (when adding to the mempool), we don't
    care which signature within the transaction failed.
  - For per-block batching, we currently don't care which transaction
    failed. We might do so in future, at which point this behaviour can
    be easily changed.
2021-06-14 22:47:00 +01:00
Homu 3f50ffc3f8 Auto merge of #5215 - str4d:4983-zip-244, r=str4d
ZIP 244 transaction and signature digests

Closes zcash/zcash#4983.
2021-06-14 16:53:22 +00:00
str4d 7195b72ce2 rust: Explicitly return null hash for pre-v5 auth digests
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-14 17:48:53 +01:00
str4d 0a4c4fa721 Improvements to CBlock::BuildAuthDataMerkleTree
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-14 17:45:59 +01:00
str4d 4e56985277
Document next_pow2 effects and algorithm source
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-14 17:40:43 +01:00
Jack Grigg 1bbdadadc3 rust: Documentation improvements to FFI methods 2021-06-14 17:39:33 +01:00
Jack Grigg 93a46e303d CI: Build book with latest mdbook
`mdbook-katex` is installed from crates.io, and if it doesn't use the
same version of `mdbook` it can cause build issues.
2021-06-13 08:04:26 +01:00
Jack Grigg 20abdb0e04 CI: Publish correct book directory 2021-06-13 08:04:26 +01:00
Jack Grigg 5ce1e649d3 Throw an exception instead of asserting if Rust tx parser fails
The Rust parser is stricter than the C++ parser, so we can reach errors
now non-contextually that previously were thrown by the consensus rules.

Various tests have been updated to check for these exceptions, as they
can no longer instantiate these transactions to pass to the consensus
rules. The tests use an unsafe constructor so they can still check the
consensus rules.
2021-06-13 07:57:39 +01:00
Jack Grigg a54359eed6 test: Regenerate sighash.json after generator fixes 2021-06-13 07:57:39 +01:00
Jack Grigg 59efe29a78 test: Small fixes to sighash test vector generation
Also tweaks the test that parses them to display errors
2021-06-13 07:57:39 +01:00
Jack Grigg cfa7d6bf73 test: Generate valid Sapling types
The C++ parser only requires the various Sapling components to be 32-byte
arrays. The Rust parser enforces stricter type checks at parse time, and
we now unconditionally parse with the Rust parser for deriving txids.
2021-06-13 07:57:39 +01:00
Jack Grigg 08baaaa492 Fix tests that assume CTxOuts can be "null" 2021-06-13 01:45:17 +01:00
Jack Grigg 29ec54fad6 ZIP 244 hashAuthDataRoot computation 2021-06-12 20:03:53 +01:00
Jack Grigg 0b8a348c2b ZIP 244 signature digests 2021-06-12 20:03:53 +01:00
Jack Grigg bd1fd2eaca ZIP 244 transaction digests 2021-06-12 20:03:53 +01:00
Homu bad7f7eadb Auto merge of #5202 - str4d:5022-tx-v5, r=str4d
v5 transaction format

Includes a new wrapper that enables passing C++ streams across to Rust.

Closes zcash/zcash#5022.
2021-06-12 17:59:44 +00:00
Jack Grigg 1ef818103d CTransaction: Make new ZIP 225 fields non-const and private
Using `const_cast` to serialize into an otherwise-constant field is
undefined behaviour:

  https://github.com/zcash/zcash/issues/967#issuecomment-225467855

Instead, we should make CTransaction's members non-const and private,
and provide accessors. It's not practical to make this change everywhere
yet, but we can start by only introducing new fields in this way. We
will need to provide accessors for orchardBundle's properties in any
case, since we need to call across the Rust FFI.
2021-06-12 00:21:46 +01:00
Homu 332693f48c Auto merge of #5214 - str4d:streams-data, r=str4d
Add `data()` method to `CDataStream`

Analogous to C++11 `std::vector::data()`.

Cherry-picked from bitcoin/bitcoin#9353 (excluding bench change).
2021-06-11 22:47:48 +00:00
Jack Grigg 36874e7f07 rust: Document read_callback_t and write_callback_t 2021-06-11 23:03:26 +01:00
Jack Grigg 88b3c377d1 Remove early return logic from transaction parsing
This also fixes a bug in `CTransaction::SerializationOp` where
`CTransaction::UpdateHash` was not being called for v5 transactions.
2021-06-11 22:56:01 +01:00
Wladimir J. van der Laan 46bb82f816 wallet: Use CDataStream.data()
(cherry picked from commit 5113474a91b8dcac4de0e4566b9babd5da281f29)
2021-06-11 21:34:43 +01:00
Wladimir J. van der Laan 06768aaed2 dbwrapper: Use new .data() method of CDataStream
(cherry picked from commit adff950faeea95249df5f7536159701ea2202255)
2021-06-11 21:34:43 +01:00
Wladimir J. van der Laan 1fca92ae03 streams: Remove special cases for ancient MSVC
Quite sure that we haven't supported MSVC 6.0 for ages (MSC_VER 1300 is
>= MSVC++ 7.0) but with the C++11 switch we can be sure.

(cherry picked from commit a2141e415aed26bab756220d8707b5fb33e6fef8)
2021-06-11 21:34:43 +01:00
Wladimir J. van der Laan 336d0e3be5 streams: Add data() method to CDataStream
Analogous to c++11 vector data().

(cherry picked from commit af4c44ce59aa643b3e03eaa121ec075f524227a5)
2021-06-11 21:34:43 +01:00
Jack Grigg 66832c1e54 contrib: Add BOSL to contrib/debian/copyright 2021-06-10 22:11:42 +01:00
Jack Grigg bfc77d571e v5 transaction format parser
The majority of the parser is in C++, but Orchard bundles are parsed
exclusively by Rust.

The ZIP 244 test vectors are brought in here so we can start by testing
round-trip serialization.
2021-06-10 22:11:42 +01:00
Jack Grigg e8748f89d3 ZIP 225 tx format constants 2021-06-10 22:11:41 +01:00
Jack Grigg e6dd9550e1 rust: Enable C++ streams to be passed into Rust code 2021-06-10 22:11:41 +01:00
Jack Grigg 22d97339b2 Extract SpendDescriptionV5 and OutputDescriptionV5 classes 2021-06-10 22:11:41 +01:00
Homu 1249659a3b Auto merge of #5213 - str4d:5201-zip-216, r=str4d
Implement ZIP 216 consensus rules

In addition to the specified consensus rules, we unconditionally enable
ZIP 216 in the following situations:

- Wallet code
  - Transaction building
  - Nullifiers for wallet notes
- Tests
- Benchmarks

Closes zcash/zcash#5201.
2021-06-10 20:00:11 +00:00
Jack Grigg 0be07bb70c Implement ZIP 216 consensus rules
In addition to the specified consensus rules, we unconditionally enable
ZIP 216 in the following situations:

- Wallet code
  - Transaction building
  - Nullifiers for wallet notes
- Tests
- Benchmarks

Closes zcash/zcash#5201.
2021-06-10 11:36:12 +01:00
Homu c6a0ec17fe Auto merge of #5212 - str4d:release-v4.4.1, r=str4d
Release v4.4.1

Due to Homu merge confusion, the release commit for this release is
0dade79ce7 (the final commit in the
release branch), not the merge commit.
2021-06-10 00:48:18 +00:00
str4d 0dade79ce7
Fix typo in release notes
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-10 00:34:43 +01:00
Jack Grigg 41a21cab89 Add bugfix to v4.4.1 release notes 2021-06-09 23:40:32 +01:00
Jack Grigg 5fe7df4c6f make-release.py: Updated release notes and changelog for 4.4.1. 2021-06-09 23:19:49 +01:00
Jack Grigg 07d047d40a make-release.py: Updated manpages for 4.4.1. 2021-06-09 23:19:49 +01:00
Jack Grigg d51c3884bf make-release.py: Versioning changes for 4.4.1. 2021-06-09 23:14:25 +01:00
Homu 8fbabc4740 Auto merge of #5205 - str4d:bump-rust-deps, r=str4d
Migrate to latest Rust dependencies

This brings in the Orchard dependencies, as well as a `metrics` feature we upstreamed.
2021-06-09 15:26:37 +00:00
Homu bd927d0084 Auto merge of #5209 - str4d:release-v4.4.1-rc1, r=str4d
Release v4.4.1-rc1
2021-06-08 23:00:34 +00:00
Jack Grigg 5ef2270b2a make-release.py: Updated release notes and changelog for 4.4.1-rc1. 2021-06-08 22:45:20 +01:00
Jack Grigg 79b497aa80 make-release.py: Updated manpages for 4.4.1-rc1. 2021-06-08 22:45:20 +01:00
Jack Grigg 81ee683c38 make-release.py: Versioning changes for 4.4.1-rc1. 2021-06-08 22:38:24 +01:00
Homu dd903c2544 Auto merge of #5208 - str4d:postpone-deps-4.4.1, r=str4d
Postpone dependency updates until after 4.4.1
2021-06-08 18:31:13 +00:00