Commit Graph

14338 Commits

Author SHA1 Message Date
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
Jack Grigg f54f9d5e06 tracing: Format field values with Display
This removes the surrounding double quotes from logged field values.
2020-08-11 01:36:08 +01:00
Jack Grigg d1e0087bd5 tracing: Add support for span fields 2020-08-11 01:36:08 +01:00
Homu 2502ebb183 Auto merge of #4656 - str4d:depends-fixes, r=str4d
depends: Fixes to build system
2020-08-10 23:58:27 +00:00
Jack Grigg 31ba572811 tracing: Add support for event fields 2020-08-11 00:51:33 +01:00
Jack Grigg 4591a4f832 tracing: Add MAP macro
Source: https://github.com/swansontec/map-macro
License: X11

Also updates contrib/debian/copyright for recent license additions.
2020-08-11 00:51:12 +01:00
Jack Grigg a7f695dbae FFI: Fix tracing log path handling on Windows
Windows uses u16 for OS strings, requiring an owned OsString when
converting to Rust. This needs to be stored in its own variable, so we
can take an immutable reference to it in Path::new.
2020-08-10 23:02:43 +01:00
Jack Grigg 682bc15757 depends: Split check-packages and check-sources across categories
All the text from a make action is passed as arguments to a single
execve call, and it can't be longer than the maximum size allowed by the
operating system. We now have enough Rust crates vendored by the depends
system that we are hitting this limit here.
2020-08-10 22:52:23 +01:00
Jack Grigg ddc517b2c8 depends: Add platform-specific overrides for download files 2020-08-10 22:52:23 +01:00
Jack Grigg 2a3770cfbf depends: Rework Rust integration
The Rust toolchain is now a native dependency, and the vendored crates
no longer depend on the native toolchain.
2020-08-10 22:52:23 +01:00
Homu 9487115cbb Auto merge of #3952 - LongShao007:master, r=daira
Remove unnecessary patch in bdb.mk

there is no "__atomic_compare_exchange" function in "src/dbinc/atomic.h".
2020-08-10 13:31:55 +00:00
Homu 2cd6d5c733 Auto merge of #4460 - rex4539:remove-deprecated-contrib, r=daira
Remove deprecated contrib utilities

Removed a bunch of unused/deprecated utilities from `zcash/contrib`.

If you feel there are more to be removed, feel free to point them out and I will remove them as well.
2020-08-08 12:23:04 +00:00
Dimitris Apostolou b0b8c63a54
Remove deprecated contrib utilities 2020-08-08 10:57:12 +03:00
Homu e0692ed4df Auto merge of #4642 - str4d:modernise-macos-toolchain, r=str4d
Modernise macOS cross-compilation toolchain

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#13617
  - Excluding the QT GUI changes.
- bitcoin/bitcoin#17550
- bitcoin/bitcoin#16392
  - Excluding the QT GUI changes.
- bitcoin/bitcoin#18589
- bitcoin/bitcoin#19240
- bitcoin/bitcoin#19407
- bitcoin/bitcoin#17919
  - Only the ancillary changes, not the `FORCE_USE_SYSTEM_CLANG` change.
- bitcoin/bitcoin#19530

After these changes, macOS versions earlier than 10.12 are no longer supported.

To cross-compile for macOS:
- Follow the instructions in `contrib/macdeploy/README.md` to generate
  `Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz`
  (requires an Apple Developer Account)
- Extract it into `depends/SDKs` (creating that folder first if it does not exist)
- `HOST=x86_64-apple-darwin16 ./zcutil/build.sh`
2020-08-07 23:13:46 +00:00
Jack Grigg bf4730dd64 contrib: Update macdeploy README 2020-08-08 00:12:10 +01:00
Jack Grigg 927a03465f Merge branch 'master' into modernise-macos-toolchain 2020-08-08 00:07:31 +01:00
Homu d36718542c Auto merge of #4597 - str4d:rust-tracing, r=str4d
Use the Rust tracing crate for C++ logging

This PR swaps in the `tracing` crate (via FFI) for logging to either standard
output or `debug.log`. It transparently maps all existing `LogPrintf` and
`LogPrint` invocations to info-level `tracing` events, and passes through
correct file and line information. `error` invocations are mapped to error-level
`tracing` events, currently without line information (due to the way that
`error` is used in the codebase; swapping individual callsites to the new
`LogError` macro will provide that information).

The end-goal for this change is that we don't need to make any disruptive
changes to the codebase, but we can start to leverage `tracing`-specific
functionality where we want to, such as providing extra fields on certain log
lines (that can be filtered for), adding spans to record the flow of execution
through `zcashd`, and logging within C++ and Rust simultaneously. Support
for extra fields on spans and events will be added in a subsequent PR.

The `-debug` config options are converted at launch into their corresponding
directives for tracing's `EnvFilter`. The new `setlogfilter` RPC method allows
this filter to be reloaded dynamically. The syntax is documented in the
`setlogfilter` help text, as well as here:

https://docs.rs/tracing-subscriber/0.2.7/tracing_subscriber/filter/struct.EnvFilter.html#directives

When `-printtoconsole` is specified, the output now includes timestamps and
ANSI encoding :)
2020-08-07 21:54:46 +00:00
elbandi 1bd4d236d4 Throw error if -paramsdir not a valid directory 2020-08-07 22:37:23 +02:00
elbandi beae52ef9b Add paramsdir option for manpage 2020-08-07 22:37:15 +02:00
elbandi 3b5966eefd Allow configure params directory 2020-08-07 22:36:18 +02:00
Homu 205c7b5844 Auto merge of #4653 - str4d:reliable-dependency-fetching, r=str4d
depends: Revert to using upstreams as primary download paths

We use the depends system for vendoring `zcashd` dependencies, pinning them
with SHA-256 hashes. It supports fetching dependencies from both their
upstream archive source, and a mirror operated by ECC.

In #816, we switched to the ECC mirror as the primary source, due to an
unreliable upstream (SourceForge). However, this only addressed the symptom
(that dependency builds would reliably fail with an unreliable upstream that
was serving incorrect files). In particular, if the ECC mirror were to become
similarly unreliable, the issue would return.

This PR fixes the core problem, by downloading dependencies and checking
their hashes as an atomic operation. This gives us greater resiliency, as
both the primary and fallback would need to fail in order to halt the build.
Having addressed this problem, we also switch back to using upstreams as
primary download paths.
2020-08-07 18:14:56 +00:00
Jack Grigg 5ada9230af Revert "Add check-depends step to STAGE_COMMANDS list"
This reverts commit d4f70e5536.
2020-08-07 17:03:50 +01:00
Jack Grigg 70c518bb84 depends: tracing-core 0.1.13 2020-08-07 15:26:28 +01:00
Jack Grigg c9ca74fb34 qa: Add tracing dependencies to updatecheck.py
A new safe_depends() checker is added, which allows the '.' character on
top of the existing safe() characters.

The time crate is postponed to 2021-02-01, by which time hopefully the
chrono crate will have figured out what it is doing with that dependency.
2020-08-07 15:26:28 +01:00
Jack Grigg 695d554ef3 doc: Update release notes for tracing backend 2020-08-07 15:26:28 +01:00
Jack Grigg 2ae4985d26 tracing: Document macro arguments that MUST be static constant UTF-8 strings 2020-08-07 15:26:28 +01:00
Jack Grigg c87205e5e0 tracing: Log field values that aren't valid UTF-8
This ensures that we retain as much logged information as possible,
while still enabling us to identify field values that cause problems.
2020-08-07 15:26:28 +01:00
Jack Grigg ba831f814a rpc: Throw error in setlogfilter if filter reloading fails 2020-08-07 15:26:28 +01:00