Commit Graph

13546 Commits

Author SHA1 Message Date
Homu 726bd2a2c8 Auto merge of #4371 - str4d:4260-nu-branch-id-errors, r=str4d
Check failing transparent and JoinSplit signatures against the previous network upgrade

This change improves usability across network upgrades, by informing
users when their new transactions are being created with the consensus
branch ID from the previous epoch.

We only check failing signatures against the previous epoch to minimise
the extra computational load on nodes.

A future refactor is needed to similarly check Sapling signatures.

Part of #4260.
2020-04-09 04:27:29 +00:00
Jack Grigg 4216319ee6 test: Assert that GetValidTransaction supports the given branch ID
Also includes a small documentation fix.
2020-04-09 15:43:18 +12:00
Homu e2624328ec Auto merge of #4422 - ca333:patch-12, r=str4d
depends: Fix OpenSSL download path

The top-level URL is only valid for the latest OpenSSL release. Each release series has its own URL subpath for downloading historic releases.
2020-04-09 01:24:25 +00:00
Alfredo Garcia 9c3d5b378b Lock with cs_main inside gtests that call chainActive.Height() 2020-04-08 13:00:49 -03:00
Jack Grigg e3ec96d3af build: Connect cargo verbosity to make verbosity 2020-04-08 18:17:19 +12:00
Jack Grigg eca5009825 test: Build Rust tests as part of qa/zcash/full_test_suite.py
The previous version of full_test_suite.py directly called the test
binary, which was being compiled at the same time as the static library.
However, by passing the --tests argument to cargo, rustc was ignoring
several important release-profile configurations, and was also
attempting to link the test binary, which was breaking cross-compilation
builds.

This commit alters src/Makefile.am to only build the static library, and
leaves test compilation to the test runner itself. This ensures that the
tests are only compiled for native builds, when the tests will be run on
the same platform.
2020-04-08 18:17:19 +12:00
Jack Grigg 5c79c26876 build: Correctly remove generated files from .cargo 2020-04-08 13:50:58 +12:00
Jack Grigg 1e2e0216ac build: Move cargo arguments into RUST_BUILD_OPTS 2020-04-08 13:50:51 +12:00
Jack Grigg cb57c17eb6 test: Verify ZIP 221 logic against reference implementation 2020-04-08 08:49:01 +12:00
Jack Grigg 82fe37d22b Use a C array for HistoryEntry instead of std::array
std::vector<T> is guaranteed to store T contiguously. However, there is
no guarantee that sizeof(std::array<unsigned char, N>) == N, which
prevents us from interpreting std::vector<std::array<unsigned char, N>>
as &[[u8; N]] on the Rust side of the FFI.

Instead, we define HistoryEntry as a struct wrapping a C array, which
(as checked by static_assert) contains no padding.
2020-04-08 08:49:01 +12:00
Jack Grigg 8a658dfd33 Return the correct root from librustzcash_mmr_{append, delete}
Per https://zips.z.cash/zip-0221#tree-node-specification :

    Once the MMR has been generated, we produce hashChainHistoryRoot,
    which we define as the BLAKE2b-256 digest of the serialization of
    the root node.
2020-04-08 08:49:01 +12:00
Jack Grigg b5c7c4a22f Implement ZIP 221 consensus rules 2020-04-08 08:49:01 +12:00
Jack Grigg 483d35e37c Add ZIP 221 support to miner and getblocktemplate
The "finalsaplingroothash" field of the getblocktemplate output is no
longer guaranteed to match the actual Sapling commitment tree root, and
has been deprecated. Users should migrate to "lightclientroothash".
2020-04-08 08:49:01 +12:00
Jack Grigg cf480fe402 Add ZIP 221 logic to block index
CBlockHeader.hashFinalSaplingRoot has been renamed to hashLightClient.

CBlockIndex now stores:
- hashLightClient as from the block header
- hashFinalSaplingRoot, which is accurate for all blocks prior to
  Heartwood activation, and all blocks from Heartwood activation onward
  that are connected at some point to the main chain in ConnectBlock().
- hashChainHistoryRoot, which is null prior to Heartwood activation, and
  set per ZIP 221 from Heartwood activation.

The new block index fields are only written to disk for client version
2.1.2 and above, which will be the first Heartwood-aware clients (even
if Heartwood doesn't have an activation height).
2020-04-08 08:49:01 +12:00
NikVolf 5608118cc4 use iterative platform-independent log2i 2020-04-08 08:49:01 +12:00
NikVolf 75d2f782b5 update chain history in ConnectBlock and DisconnectBlock 2020-04-08 08:49:01 +12:00
NikVolf cf247bc655 push/pop history with tests
Co-authored-by: Jack Grigg <jack@z.cash>
2020-04-08 08:49:01 +12:00
Alfredo Garcia 24a75fe4f8 change unclear wording in z_import calls address returned 2020-04-07 10:46:42 -03:00
Alfredo Garcia de5b69f160 add expected address check to tests 2020-04-07 10:39:33 -03:00
Alfredo Garcia 0a6ab8a5ab return address info in z_importviewingkey 2020-04-07 08:38:12 -03:00
Alfredo Garcia 6039242829
multiple debug categories documentation 2020-04-06 09:09:43 -03:00
ca333 61c4b6c432
fix dead openssl download path
updates openssl 1.1.1a download path analogue to 318ec36218

fyi: we are testing 1.1.1f in https://github.com/KomodoPlatform/komodo/pull/314
2020-04-05 02:41:59 +02:00
Homu 1be7250db9 Auto merge of #4411 - str4d:2074-rpc-test-harness-1, r=mdr0id
Backport RPC test harness PRs

Cherry-picked from the following upstream PRs:
- https://github.com/bitcoin/bitcoin/pull/6548
- https://github.com/bitcoin/bitcoin/pull/6804
  - Just the coverage backend, not the flag to enable it for all RPC tests.
- https://github.com/bitcoin/bitcoin/pull/7744
- https://github.com/bitcoin/bitcoin/pull/9832
  - Excludes `wallet-hd.py` change (missing bitcoin/bitcoin#8309).

Part of #2074.
2020-04-03 03:14:04 +00:00
Daira Hopwood 62142660b0 Remove a redundant `rm -f` command.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-30 15:06:14 +01:00
Daira Hopwood dd215e8994 Use `SA_RESTART` in `sa_flags` when setting up signal handlers.
Explanation: if a signal interrupts certain syscalls such as `open`, `read`, or `write`,
then the library function will by default fail with `errno` `EINTR`. But we almost never
check for `EINTR`, so this is likely to cause spurious errors. We want to restart the syscall
instead, which is what `SA_RESTART` is intended to do. Since our signal handlers (defined
in init.cpp) only set a flag, restarting the syscall is safe and is always the Right Thing.

See <https://www.gnu.org/software/libc/manual/html_node/Flags-for-Sigaction.html> and
<https://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html> for
further information.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-28 19:14:48 +00:00
Homu b5f179d207 Auto merge of #4370 - str4d:3060-sapling-viewing-keys, r=str4d
Add support for Sapling full viewing keys

This PR adds Sapling support to `z_exportviewingkey` and `z_importviewingkey`, and stores imported Sapling viewing keys in the wallet.

Closes #3060.
2020-03-28 02:41:26 +00:00
Daira Hopwood 6b8c0bc928 Address review comments.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-26 13:44:50 +00:00
Daira Hopwood 457437ef05 Avoid spurious error messages when cleaning up directories.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-26 13:44:06 +00:00
Daira Hopwood 9f6278e305 Executables end with .exe on Windows.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-26 13:41:48 +00:00
Daira Hopwood 531e2b290f Minor refactoring.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-26 13:39:22 +00:00
NicolasDorier b0d81be4cd [qa] assert_start_raises_init_error
Zcash: Excludes wallet-hd.py change (missing bitcoin/bitcoin#8309)
2020-03-24 21:55:08 +13:00
Wladimir J. van der Laan 11240d0928 test_framework: detect failure of bitcoind startup
Replace the `bitcoin-cli -rpcwait` after spawning bitcoind
with our own loop that detects when bitcoind exits prematurely.

And if one node fails to start, stop the others.

This prevents a hang in such a case (see #7463).
2020-03-24 21:55:08 +13:00
James O'Beirne d38a012970 Add basic coverage reporting for RPC tests
Thanks to @MarcoFalke @dexX7 @laanwj for review.

Zcash: Includes all the backend changes, but excludes the --coverage flag
added to rpc-tests.py as we have not yet migrated away from rpc-tests.sh.
2020-03-24 21:51:51 +13:00
ptschip 8f863b2817 Enable python tests for Native Windows
1) Multiplatorm support for devnull
2) Fixed a bug in the handling of cache files
3) Deleted run-bitcoin-cli as no longer needed
2020-03-24 18:05:30 +13:00
Daira Hopwood 4718c1e306 Split into clean.sh and distclean.sh.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-21 19:34:34 +00:00
Daira Hopwood 6174ba2d5c Add a `zcutil/clean.sh` script that works (unlike `make clean`).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-21 16:38:30 +00:00
Homu c3df71a8e9 Auto merge of #4386 - oxarbitrage:issue4385, r=daira
add check_node_log utility function

Closes https://github.com/zcash/zcash/issues/4385
2020-03-19 13:26:42 +00:00
Alfredo Garcia 77219bdc6c remove unused import 2020-03-19 08:46:33 -03:00
Alfredo Garcia 2707e6ff6c preserve test semantics
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-03-18 22:49:44 -03:00
Homu 08993dcb93 Auto merge of #4408 - oxarbitrage:patch-3, r=daira
Fix comment in rpc_wallet_tests

Address a small comment issue in `rpc_z_shieldcoinbase_parameters` rpx wallet tests.
2020-03-19 00:03:55 +00:00
Homu 2dd4721f84 Auto merge of #4365 - oxarbitrage:issue1361, r=daira
Replace tuples by classes in asyncoperation_sendmany

Close https://github.com/zcash/zcash/issues/1361
2020-03-17 23:56:02 +00:00
Homu d78fabaab3 Auto merge of #4407 - defuse:fix-updatecheck-newrust, r=str4d
Update updatecheck.py with the new Rust dependencies
2020-03-17 20:58:07 +00:00
Alfredo Garcia 0636fbabbd
minor comment fix 2020-03-17 17:56:25 -03:00
Taylor Hornby acdad52602 Update updatecheck.py with the new Rust dependencies and improve the error message in case the untracked dependency list becomes out of date. 2020-03-17 14:05:50 -06:00
Daira Hopwood 9526e13a02
Make the memo a mandatory argument for SendManyRecipient 2020-03-17 13:41:09 +00:00
Homu a125f3f5f8 Auto merge of #4403 - ebfull:rust-tests, r=str4d
Additional librustzcash integration

This adds librustzcash tests to the full test suite, and brings in the release profile configurations that are currently present in the librustzcash workspace on the other repository. It's very important that we build librustzcash with panic=abort because otherwise the unwinding panics across FFI boundaries could cause undefined behavior.
2020-03-17 07:50:48 +00:00
Homu 52f4794055 Auto merge of #4395 - defuse:fix-updatecheck, r=daira
Fix bug in updatecheck.py and add utfcpp to its dependency list
2020-03-16 19:14:48 +00:00
Homu fc9d0fa72f Auto merge of #4404 - daira:fix-reindex-divby0, r=ebfull
Avoid a theoretical possibility of division-by-zero introduced in #4368

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-16 17:13:39 +00:00
Homu 5a626317c7 Auto merge of #4390 - daira:fix-chaintip-race-condition, r=ebfull
Fix race conditions during init

Fix race conditions due to accessing `chainActive.Tip()` during init, and other minor cleanups.
Includes backport of https://github.com/bitcoin/bitcoin/pull/8063 .
2020-03-16 15:11:43 +00:00
Daira Hopwood b49cdee878 Avoid a theoretical possibility of division-by-zero introduced in #4368.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-16 14:56:38 +00:00