Commit Graph

13357 Commits

Author SHA1 Message Date
Jack Grigg 147526b0a8 zcutil/make-release.py: Fix to run with Python 3 2020-04-15 17:56:38 +12:00
Homu b5dda4ecc5 Auto merge of #4448 - str4d:equihash-validator-rust-nu, r=ebfull
consensus: From Heartwood activation, use Rust Equihash validator

The C++ and Rust Equihash validators are intended to have an identical
set of valid Equihash solutions, so this should merely be an
implementation detail. However, deploying the Rust validator at the same
time as a network upgrade reduces the risk of an unintentional consensus
divergence due to undocumented behaviour in either implementation.

Once Heartwood has activated on mainnet, we can verify that all
pre-Heartwood blocks satisfy the Rust validator, and then remove the C++
validator and make Equihash-checking non-contextual again.

Replaces zcash/zcash#2851.
2020-04-15 02:03:06 +00:00
Jack Grigg 655f0c9802 consensus: From Heartwood activation, use Rust Equihash validator
The C++ and Rust Equihash validators are intended to have an identical
set of valid Equihash solutions, so this should merely be an
implementation detail. However, deploying the Rust validator at the same
time as a network upgrade reduces the risk of an unintentional consensus
divergence due to undocumented behaviour in either implementation.

Once Heartwood has activated on mainnet, we can verify that all
pre-Heartwood blocks satisfy the Rust validator, and then remove the C++
validator and make Equihash-checking non-contextual again.
2020-04-15 11:53:28 +12:00
Jack Grigg 49f9584613 Pass the block height through to CheckEquihashSolution()
This requires moving CheckEquihashSolution() to
ContextualCheckBlockHeader() for all but the genesis block, which has no
effect on consensus; it just means that an invalid Equihash solution is
rejected slightly later in the block validation process.
2020-04-15 11:51:21 +12:00
Jack Grigg f4fe77ad1e test: Run Equihash test vectors on both C++ and Rust validators 2020-04-15 11:31:10 +12:00
Homu 084303d8c2 Auto merge of #4264 - NikVolf:mmr, r=str4d
[ZIP 221] FlyClient - Consensus-Layer Changes

Implements https://zips.z.cash/zip-0221
2020-04-14 20:09:34 +00:00
Homu ccc7735635 Auto merge of #4446 - str4d:heisenbug-squashing, r=ebfull
Heisenbug squashing

Both bugs addressed here had clear causes, so we are confident that the corresponding issues are fixed.
2020-04-14 16:47:24 +00:00
Jack Grigg f4194a3fd7 test: Add a second Sapling note to WalletTests.ClearNoteWitnessCache
Quoting the documentation for `std::vector::operator[]`:

    Portable programs should never call this function with an argument
    n that is out of range, since this causes undefined behavior.

This test was doing just that: performing checks on a non-existent
second Sapling witness (duplicating the Sprout logic that checked two
notes, one of which was in the wallet). The test was instead reading
arbitrary memory after the witness that did exist; in most cases, this
memory was interpreted as a `boost::none` as expected, but in some cases
the memory was interpreted as a "real" witness.

Closes zcash/zcash#4445.

Co-authored-by: Ying Tong <yingtong@ethereum.org>
2020-04-14 20:57:59 +12:00
Jack Grigg e85fac5167 test: Ignore timestamps in addressindex checks
The mempool timestamps are local to each node, and if the testing
machine is under load, they can potentially differ by a second.

Closes zcash/zcash#4439.

Co-authored-by: Ying Tong <yingtong@ethereum.org>
2020-04-14 20:56:37 +12:00
str4d 070f4faaeb
Merge pull request #4443 from rex4539/fix-pr-template
Update GitHub PR template
2020-04-14 17:45:18 +12:00
str4d eaafb8d6b5
Merge pull request #4435 from rex4539/rocket2discord
Point at support community on Discord
2020-04-14 12:53:24 +12:00
Dimitris Apostolou f2a163ccaf
Update documentation info 2020-04-12 15:27:09 +03:00
Jack Grigg 31e5f9cde2 Make peak_pos zero-indexed in CCoinsViewCache::PreloadHistoryTree 2020-04-11 11:52:56 +12:00
Jack Grigg 21d8e5be15 Comment clarifications and fixes 2020-04-11 11:39:00 +12:00
Jack Grigg bc30c57cdb Truncate HistoryCache.appends correctly for zero-indexed entries 2020-04-10 19:56:13 +12:00
Jack Grigg 15ef73e586 Improve documentation of CCoinsViewCache::PreloadHistoryTree 2020-04-10 19:47:45 +12:00
Jack Grigg 65073157e6 Remove unnecessary else case in CCoinsViewCache::PreloadHistoryTree 2020-04-10 19:47:45 +12:00
Jack Grigg 9cfd574eac test: Add an extra assertion to feature_zip221.py 2020-04-10 19:47:45 +12:00
Daira Hopwood d47676fe00 Refer to altitude instead of height for history tree peaks 2020-04-10 19:47:45 +12:00
Homu 3033b8a0ec Auto merge of #4402 - oxarbitrage:issue4326, r=str4d
Add -lightwalletd experimental option

Similar to `-insightexplorer` but loading less indexes.

After testing and code review this should be able to close https://github.com/zcash/zcash/issues/4326
2020-04-10 03:42:54 +00:00
Dimitris Apostolou 298acc15fc
Point at support community on Discord 2020-04-10 06:38:39 +03:00
Homu 7534c77f63 Auto merge of #4434 - rex4539:remove-stale-comment, r=str4d
Remove stale comment about soft-fork upgrades

Closes https://github.com/zcash/zcash/issues/4433.
2020-04-10 02:30:21 +00:00
Homu 780554e53a Auto merge of #4426 - oxarbitrage:issue4372, r=str4d
Return address info in z_importviewingkey

Closes https://github.com/zcash/zcash/issues/4372
2020-04-10 00:20:40 +00:00
Jack Grigg 2ad84e8564 Comment tweaks and cleanups
Co-Authored-By: Daira Hopwood <daira@jacaranda.org>
2020-04-10 09:53:30 +12:00
Homu 6fcfe529d9 Auto merge of #4430 - str4d:build-fixes, r=str4d
Rust build fixes

Fixes cross-compilation, along with some minor adjustments to the Makefile integration.
2020-04-09 21:40:23 +00:00
Alfredo Garcia a43f5daff8 add -lightwalletd experimental option 2020-04-09 11:05:21 -03:00
Homu e7fbdf532c Auto merge of #4424 - oxarbitrage:patch-4, r=str4d
multiple debug categories documentation

The command line help is not clear on how to execute multiple but specific debug categories. Failed with stuff like `-zcashd -debug=category1, category2`, etc to find how to do it after some time.

The proposed line addition should help with that.
2020-04-09 13:43:23 +00:00
Dimitris Apostolou 78ecb9a681
Remove stale comment 2020-04-09 11:03:48 +03:00
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
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