Commit Graph

13867 Commits

Author SHA1 Message Date
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
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
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
Jack Grigg e04da74957 FFI wrapper around tracing crate
The tracing crate is initialized with an optional log path, and will
either start a background thread for non-blocking log writing, or write
directly to standard output with ANSI encoding.

C preprocessor macros are used to emulate the Rust macros natively
provided by the tracing crate. They handle the creation of static
tracing callsites, and ensure that the correct file and line number
information is used for each logging site.
2020-08-07 15:07:44 +01:00
Jack Grigg e6a52fa9c8 Add tracing to librustzcash dependencies 2020-08-07 15:07:44 +01:00
Homu b6547929c9 Auto merge of #4593 - str4d:proofverifier-refactor, r=str4d
Refactor ProofVerifier

`ProofVerifier` was previously used to conditionally verify pre-Sapling Sprout
proofs (based on `ProofVerifier::Strict` or `ProofVerifier::Disabled` being
used), but hybrid Sprout proofs bypassed it (so were being verified multiple
times during block verification), and once `libsnark` was removed in
zcash/zcash#4060 `ProofVerifier::check` was doing nothing.

This PR refactors `ProofVerifier`, moving it out of the `libzcash` compilation
unit (so that it can depend on `primitives/transaction.h`), and moving Sprout
verification from `JSDescription::Verify` to `ProofVerifier::VerifySprout`.
Verification-skipping for Sprout proofs is re-introduced.

Additionally, the `ZCJoinSplit` global is removed from the codebase, and
`ZCJoinSplit::prove` is converted into a static function. We load the hybrid
Sprout parameters dynamically at proving time within the Rust code, and no
longer require a C++ global for any proving parameters.

As a side-effect, `libzcashconsensus.la` building with `--with-libs` is fixed,
as `primitives/transaction.cpp` no longer depends on `librustzcash.h`.
2020-08-07 12:16:59 +00:00
Jack Grigg 3855cf8be7 test: Remove obsolete TransactionBuilder test
We no longer pass Sprout parameters into the transaction builder, so
there's no error to test for.
2020-08-07 12:37:10 +01:00
Homu 022c3a4c6d Auto merge of #4567 - oxarbitrage:issue4537, r=daira
Build BDB utilities

To install the binaries we need to build with just `install` instead of `install_lib` and `install_include`, this will install everything.

Then the binaries will be moved to a folder in `zcutil` directory. We can just leave them in staging however the user might have a hard time to find them there.

Closes https://github.com/zcash/zcash/issues/4537
2020-08-07 11:11:47 +00:00
Daira Hopwood 45b2a612eb
Update Makefile.am
zcutil/bin should be cleaned by `make distclean`, not `make clean`.

Co-authored-by: str4d <thestr4d@gmail.com>
2020-08-07 11:03:55 +01:00
Jack Grigg 9cdc6f2a85 depends: Use FALLBACK_DOWNLOAD_PATH if the primary's hash doesn't match
The previous behaviour was to use FALLBACK_DOWNLOAD_PATH to download
dependencies if the primary did not resolve. This was not resilient
against primaries that either mis-report HTTP status codes (e.g.
SourceForge returning 200 OK alongside a 404 webpage), or did not
guarantee artifacts to be bit-stable (e.g. GitHub regenerating commit
archive caches in a non-reproducible manner); in either case, the
incorrect file would be fetched and then the build would fail due to
hash mismatch.

The new behaviour is to download dependencies and check their hashes as
an atomic operation, and use FALLBACK_DOWNLOAD_PATH if any part of the
operation fails.
2020-08-07 10:07:07 +01:00
Jack Grigg 25ef1940b0 Revert "Try downloading from our mirror first to avoid headaches."
This reverts commit 5cd512b928.
2020-08-07 09:14:20 +01:00
Jack Grigg a4bfd2ea09 Revert "Rename FALLBACK_DOWNLOAD_PATH to PRIORITY_DOWNLOAD_PATH"
This reverts commit be60c6d7f6.
2020-08-07 09:13:23 +01:00
Homu d6f527a88f Auto merge of #4650 - teor2345:patch-1, r=daira
Fix a comment typo in pow.cpp

*Documentation and testing not required: comment-only change.*
2020-08-06 10:32:11 +00:00
teor 5919464919
Fix a comment typo in pow.cpp 2020-08-06 19:03:52 +10:00
Homu 67ab09ae43 Auto merge of #4646 - defuse:bump-dependency-update-deadlines, r=str4d
Add new dependencies to updatecheck.py; extend the postponement deadline by a month
2020-08-04 13:06:13 +00:00
Taylor Hornby 902bf838af Add new dependencies to updatecheck.py, add a flag we can use to have our CI test it. 2020-08-03 15:01:01 -06:00
Taylor Hornby 88082c4a56 Extend deadline for postponing dependency updates 2020-08-03 15:00:22 -06:00
Homu 4e3c04c876 Auto merge of #4588 - nuttycom:remove_amqp, r=str4d
Remove AMQP code and Proton library dependencies & flags
2020-07-31 21:47:52 +00:00
Kris Nuttycombe 4dd0647c1c Remove Proton license from contrib/debian/copyright 2020-07-31 13:08:19 -06:00
Kris Nuttycombe 0391809da1 Remove amqp code and Proton library depenencies & flags. 2020-07-31 13:08:18 -06:00
Homu bded4ca502 Auto merge of #4583 - oxarbitrage:issue4495, r=str4d
Check for config options that may be duplicated in the config file

`ReadConfigFile()` now enforces that only a subset of config options may be duplicated. CLI behaviour is unaltered.

Closes https://github.com/zcash/zcash/issues/4495
2020-07-31 15:59:13 +00:00
Homu 2589b2fcc5 Auto merge of #4614 - str4d:ctaes, r=str4d
Replace OpenSSL AES with ctaes-based version

Backported from upstream PR https://github.com/bitcoin/bitcoin/pull/7689.

This is backported primarily to remove merge conflicts for a subsequent
backport, and also helps us towards removing OpenSSL. Its actual usage
in wallet encryption would be replaced by a more modern construction
before we make wallet encryption a supported feature, but for now this
does not affect anyone using the experimental feature.
2020-07-31 00:14:40 +00:00
Jack Grigg fb2edcc352 Debian: Add copyright entries for ctaes and secp256k1 2020-07-30 05:57:00 +01:00
Cory Fields 7e4a74ddf6 depends: bump native_cctools for fixed lto with external clang
https://github.com/tpoechtrager/cctools-port/pull/85 was merged upstream, which
fixes lto detection for external clang with some Linux Distro's including
Ubuntu.
2020-07-30 04:36:02 +01:00
Cory Fields 7a714958d4 depends: enable lto support for Apple's ld64
Note that this does not _enable_ lto by default in any way, only hooks up the
machinery for -flto to work correctly.

enable-lto-support is explicitly used for pinned-clang because we know it
works. It is neither enabled nor disabled in the external clang case so that
it can be auto-detected.
2020-07-30 04:35:25 +01:00
Carl Dong 25cc992ea3 depends: Add justifications for macOS clang flags 2020-07-30 04:33:36 +01:00