Commit Graph

14162 Commits

Author SHA1 Message Date
Kris Nuttycombe 50afda0231 consensus: Move overwinterActive rules ahead of saplingActive rules 2020-08-22 01:06:32 +01:00
Kris Nuttycombe 25974d4d25 consensus: Add a placeholder for !canopyActive 2020-08-22 01:06:32 +01:00
Kris Nuttycombe 830b8a44ca consensus: Combine heartwoodActive conditionals 2020-08-22 01:06:32 +01:00
Kris Nuttycombe 6027a61c2e consensus: Remove canopyActive gate around GetActiveFundingStreamElements
The function gates internally on Canopy, so we can remove the redundant
check.
2020-08-22 01:06:32 +01:00
Kris Nuttycombe 570478a078 consensus: Refactor Sprout contextual rules to match the rest 2020-08-22 01:06:32 +01:00
Kris Nuttycombe cf45a26eed consensus: Clean up some whitespace and variable names 2020-08-22 01:06:32 +01:00
Jack Grigg a379f275dd test: Update ZIP 215 test cases from ed25519-zebra 2020-08-21 17:28:12 +01:00
Homu 595b15fc43 Auto merge of #4675 - str4d:zip-207-ncc-comments, r=nuttycom
ZIP 207 and ZIP 214 NCC comments

Changes to the ZIP 207 and ZIP 214 implementations as suggested in the NCC audit.
2020-08-21 15:56:36 +00:00
str4d 732f1a76e4
Adjust GetActiveFundingStream* comments
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-08-22 03:47:12 +12:00
Homu 30619ae888 Auto merge of #4654 - str4d:sodium-oxide, r=str4d
Replace most libsodium usage with Rust crates

We currently use four components of libsodium:

- Random byte generation
- BLAKE2b
- Ed25519
- ChaCha20Poly1305

This PR replaces the first three with equivalent logic from Rust crates:

- `rand_core::OsRng`
- `blake2b_simd`
- `ed25519-zebra`
  - `libsodium` is still used for Ed25519 verification in the consensus rules until Canopy activation.
2020-08-20 18:11:16 +00:00
Jack Grigg d41cf37841 ed25519: Panic (triggering abort) if nullptr passed into APIs 2020-08-20 19:00:48 +01:00
Jack Grigg efb4246ad3 Replace libsodium's crypto_sign with ed25519-zebra
crypto_sign_verify_detached is still used within the consensus rules
until Canopy activation. ed25519-zebra generates signatures that are
valid under both pre- and post-Canopy rules (for our honest usage),
so we can use it to generate transaction signatures now. Then once
Canopy activates, we can remove the remaining usages of crypto_sign.
2020-08-20 19:00:47 +01:00
Jack Grigg c595056883 consensus: Clearly gate active funding stream elements on Canopy
We only use the output of GetActiveFundingStreamElements and
GetActiveFundingStreams within Canopy contexts, but this makes it
explicit that funding streams are disabled before Canopy activation.
2020-08-20 17:54:44 +01:00
Homu 016e351972 Auto merge of #4674 - therealyingtong:zip-212-ncc-fixes, r=therealyingtong
ZIP 212 NCC fixes

Fixes to the ZIP 212 implementation as suggested in the NCC audit.
2020-08-20 15:05:30 +00:00
ying tong 1ed936b893
Add link to ZIP212 in coinbase comment
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-08-20 22:20:34 +08:00
Jack Grigg 768534a8b9 consensus: Statically check funding stream numerators and denominators 2020-08-20 14:48:01 +01:00
Jack Grigg bfeaa0e4c0 consensus: Document the empty conditional branch in ContextualCheckBlock
It exists to implement a ZIP 207 consensus rule that turns off the
Founders' Reward once Canopy activates.
2020-08-20 14:09:15 +01:00
Jack Grigg b47f686754 consensus: Add assertions for Params::HalvingHeight parameters
- Height must be non-negative.
- Halving index must be positive.
2020-08-20 14:09:15 +01:00
ying tong 2f2c8ea5f3
Rename PRV_DIVERSIFIER to PRF_TAG
Co-authored-by: str4d <thestr4d@gmail.com>
2020-08-20 19:49:24 +08:00
Homu c3f0e181ef Auto merge of #4672 - charlieok:remove_debian_8_jessie_descriptor, r=str4d
Remove 'jessie' (debian 8) from suites list in linux gitian descriptors

Debian 8 "jessie" support reached its end-of-life on June 30, 2020
https://www.debian.org/News/2020/20200709
2020-08-19 19:02:08 +00:00
therealyingtong edcecc8a31
assert(leadbyte == 0x02) after every if(leadbyte != 0x01) 2020-08-19 23:37:47 +08:00
therealyingtong 952c7f7c70
Define PRF diversifiers in prf.h 2020-08-19 18:19:12 +08:00
therealyingtong 992007ecbc
Move esk derivation check to beginning of plaintext_checks_without_height() 2020-08-19 14:25:49 +08:00
therealyingtong 2361228144
Add documentation specific to ZIP 212 2020-08-19 14:24:01 +08:00
Jack Grigg 1c447d85c0 Replace libsodium's randombytes_buf with rand_core::OsRng::fill_bytes 2020-08-18 21:57:06 +01:00
Charlie O'Keefe 2605fc29dd Remove 'jessie' (debian 8) from suites list in linux gitian descriptors
Debian 8 "jessie" support reached its end-of-life on June 30, 2020
https://www.debian.org/News/2020/20200709
2020-08-18 13:33:40 -06:00
Homu 24863f30c9 Auto merge of #4619 - nuttycom:bazel-patches, r=daira
Cleanups needed for Bazel but that have value on their own (updated)

Supersedes https://github.com/zcash/zcash/pull/2895
2020-08-18 16:18:21 +00:00
Homu 940fe0b3be Auto merge of #4657 - str4d:tracing-fields, r=str4d
Add support for logging fields in spans and events

Field values must be pointers to C strings, which in practice means that they
cannot be formatted inline (as the pointer must remain valid across the FFI).
This might be improved by future iterations of the macros.

`LogPrint()` is also moved to the DEBUG level, leaving `LogPrintf()` at INFO.
2020-08-17 16:23:58 +00:00
str4d 5ca852ba41
debian: Rename X11 to Expat-with-advertising-clause in copyright
The X11 license specifically mentions the X Consortium as the party that the no-advertising clause applies to.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-08-18 02:00:24 +12:00
Homu c2f991db5b Auto merge of #4659 - str4d:tracing-init, r=str4d
Improvements to tracing initialization

The refactor makes it easier to implement further tracing customisations.

We also now have spans for `zcashd` initialization and shutdown.
2020-08-17 07:32:04 +00:00
Homu 70b8aac97a Auto merge of #4670 - daira:update-checksec, r=str4d
Update checksec.sh to slimm609/checksec.sh version 2.3.0

To verify against the upstream signature:
```
git clone https://github.com/slimm609/checksec.sh
cd checksec.sh
git checkout a6df608ac077689b2160e521db6601abc7b9e26e
openssl dgst -sha256 -verify checksec.pub -signature checksec.sig ${ZCASH_SRC}/qa/zcash/checksec.sh
```

This version has more thorough Fortify checking (using `--extended --fortify-file=`) and checks specific to Clang-compiled executables.
2020-08-14 22:32:04 +00:00
Kris Nuttycombe 0cdce269b5 Merge remote-tracking branch 'upstream/master' into bazel-patches 2020-08-14 14:30:15 -06:00
Homu 99bfa46d09 Auto merge of #3593 - arielgabizon:explain-expiry-error, r=daira
Give a better error message for transaction expiry

As mentioned in https://github.com/zcash/zcash/issues/3393, user gets an error when sending a tx while wallet not caught up. Here we give the user a better explanation of the possible error.
2020-08-14 19:33:21 +00:00
Daira Hopwood 57a0418fbb Repair full_test_suite.py for new checksec.sh.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-14 18:02:27 +01:00
Daira Hopwood eea06658f4 Newer version of checksec.sh from a6df608ac0
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-14 17:49:16 +01:00
Homu b3407f06c8 Auto merge of #1665 - bitbandi:master, r=daira
Allow to configure the zk-SNARK parameters directory using `-paramsdir=`

same use as datadir=/foo/bar parameter
2020-08-14 15:24:05 +00:00
Homu 95a27e9fc9 Auto merge of #4661 - therealyingtong:history-node-garbage-test, r=daira
Add test for garbage memory in history nodes

Tests that garbage memory in history nodes smaller than `NODE_SERIALIZED_LENGTH` have no effect when computing the `HistoryRoot` hash.
2020-08-13 14:54:40 +00:00
ying tong 659a39931a
Make sure garbage bytes are different
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-08-13 22:18:33 +08:00
Homu ddae981525 Auto merge of #4662 - therealyingtong:zip-211-ncc-fixes, r=daira
ZIP 211 NCC fixes

Fixes to the ZIP 211 implementation as suggested in the NCC audit.
2020-08-13 13:43:33 +00:00
therealyingtong cb3a19f47a
Add test for garbage memory in history nodes 2020-08-13 18:21:00 +08:00
therealyingtong 41cf525001
Add missing curly braces after if statement 2020-08-13 12:58:13 +08:00
Homu 9e117fdebe Auto merge of #4547 - zebambam:add_libfuzzer_support, r=str4d
Add libfuzzer support

- Added libfuzzer support to the build system in zcutil.
- Added UniValue::Read fuzzer, dict, corpus.

I made a slight change to the build.sh script so as to separate dependency building vs src building, just so that I can layer the docker containers for building over in another repo to speed up the continuous build processes that will want to build multiple fuzzers from the same commit.

Closes #4548
2020-08-12 20:47:53 +00:00
bambam 58dda603a4 Added libfuzzer support. 2020-08-12 21:41:30 +01:00
bambam f8fa2fcad0 Added support for afl-clang-fast. 2020-08-12 21:41:30 +01:00
Jack Grigg 027a9925c9 init: Add spans for initialization and shutdown 2020-08-11 14:38:51 +01:00
Jack Grigg 735503b473 init: Rework tracing_init call 2020-08-11 14:38:51 +01:00
Jack Grigg 25d2e6e3c3 tracing: Rework tracing_init into a single function
This will make it possible to de-duplicate some components of the
tracing configuration. The layers themselves cannot be fully
de-duplicated due to type system constraints (a Layer wraps a
Subscriber, and is itself a Subscriber typed on the one it wraps).
2020-08-11 13:16:28 +01:00
Jack Grigg 90e86b53bf tracing: Parse log_path into an Option<Path> 2020-08-11 11:45:30 +01:00
Jack Grigg 81446deef2 util: Use DEBUG level for LogPrint(), leaving INFO for LogPrintf() 2020-08-11 02:10:42 +01:00
Jack Grigg c9879d2f96 Add fields to logging in CNode and UpdateTip 2020-08-11 01:56:32 +01:00