Commit Graph

14174 Commits

Author SHA1 Message Date
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
Jack Grigg 58c410974d init: Place additional constraints on pathDebug 2020-08-07 15:26:28 +01:00
Jack Grigg 92f18661d8 FFI: Add missing <stddef.h> includes 2020-08-07 15:26:28 +01:00
Jack Grigg ba1f455e5d wallet: Fix logging to satisfy constexpr requirements 2020-08-07 15:26:28 +01:00
Jack Grigg f57f1c17a2 tracing: Use 'static constexpr' hack in macros
This enables us to enforce that the requisite macro parameters are
compile-time constants with static storage duration.
2020-08-07 15:26:28 +01:00
Jack Grigg cb294bbda0 FFI: Extract common codeunit types into a rust/types.h header 2020-08-07 15:26:28 +01:00
Jack Grigg 253ea6db38 Add some spans to the Zcash codebase 2020-08-07 15:26:28 +01:00
Jack Grigg aae7583cdb Add support for tracing spans 2020-08-07 15:26:28 +01:00
Jack Grigg f89ea3fc33 Add an RPC method for setting the tracing filter directives 2020-08-07 15:26:28 +01:00
Jack Grigg 3f81f9be80 Add support for reloading the tracing filter
Due to tracing's extensive use of the Rust type system, we have to Box
the handle in order to pass it back across the FFI. We define a
ReloadHandle trait which exposes the necessary Handle APIs.
2020-08-07 15:08:10 +01:00
Jack Grigg 2b7d824714 Use a tracing EnvFilter directive for -debug flags 2020-08-07 15:08:10 +01:00
Jack Grigg d5de95f170 Replace C++ logging with tracing logging
Does not yet handle SIGHUP log-reopening.
2020-08-07 15:08:10 +01:00