Commit Graph

7575 Commits

Author SHA1 Message Date
Ariel 7245f32835
update SignatureHash according to Overwinter spec
with help from str4d
2018-02-20 04:22:21 +00:00
Ariel 132dc81f7d
add blake2b writer 2018-02-20 04:22:21 +00:00
Jack Grigg d55e5e778b
Cleanup: Wrap function arguments 2018-02-20 04:22:21 +00:00
Jack Grigg be12669982
Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter
We do not need to be able to calculate multiple SignatureHash versions for a
single transaction format; instead, we use the transaction format to determine
the SigVersion.

The consensus branch ID *does* need to be passed in from the outside, as only
the caller knows the context in which the SignatureHash is being calculated
(ie. mempool acceptance vs. block validation).

JoinSplit signature verification has been moved into ContextualCheckTransaction,
where the consensus branch ID can be obtained.

The argument to the sign command for zcash-tx has been modified to take a height
in addition to the optional sigtype flags.
2018-02-20 04:22:20 +00:00
Pieter Wuille 6514771a44
Rename to PrecomputedTransactionData 2018-02-20 04:22:20 +00:00
Nicolas DORIER 90285e7b81
Unit test for sighash caching
Zcash: Modified to use P2PKH.
2018-02-20 04:22:20 +00:00
Pieter Wuille f762d44973
Precompute sighashes
Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.

Edited for Zcash by Ariel Gabizon and Jack Grigg
2018-02-20 04:22:20 +00:00
Jorge Timón 722d811f89
Mempool: Use Consensus::CheckTxInputs direclty over main::CheckInputs 2018-02-20 04:22:20 +00:00
Jack Grigg e005ff83ab
Remove P2WPKH and P2WSH from signing logic
Separated from the previous commit for ease of review.
2018-02-20 04:22:19 +00:00
Pieter Wuille 157a5d0d9c
BIP143: Signing logic 2018-02-20 04:22:19 +00:00
Pieter Wuille c86a1cb86e
BIP143: Verification logic
Includes simplifications by Eric Lombrozo.

Edited for Zcash merge by Ariel Gabizon.
2018-02-20 04:22:19 +00:00
Pieter Wuille 2d42e1a993
Refactor script validation to observe amounts
This is a preparation for BIP143 support.

Edited for Zcash merge by Ariel Gabizon.
2018-02-20 04:22:19 +00:00
Jonas Nick ffda7e01a5
Reduce unnecessary hashing in signrawtransaction 2018-02-20 04:22:18 +00:00
21E14 8cb98d9105
Remove obsolete reference to CValidationState from UpdateCoins. 2018-02-20 04:22:18 +00:00
Pieter Wuille 838e7a29cc
Report non-mandatory script failures correctly 2018-02-20 04:22:10 +00:00
Homu 49274558c6 Auto merge of #2940 - str4d:nu-activation-mempool-expiry, r=str4d
Mempool improvements, branch ID awareness

Whenever the local chain tip is updated, transactions in the mempool which commit to an
unmineable branch ID (for example, just before a network upgrade activates, where the
next block will have a different branch ID) will be removed.

Includes commits cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6654
  - Only the mempool index change.
- bitcoin/bitcoin#6776
- bitcoin/bitcoin#7020
- bitcoin/bitcoin#6915

Part of #2074.
2018-02-19 19:00:30 -08:00
Jack Grigg 34a64fe0a2
Remove mempool transactions which commit to an unmineable branch ID 2018-02-20 02:57:44 +00:00
Suhas Daftuar 233c9eb635
Fix removeForReorg to use MedianTimePast 2018-02-20 02:57:44 +00:00
Suhas Daftuar e52ba51bda
Don't call removeForReorg if DisconnectTip fails 2018-02-20 02:57:44 +00:00
Suhas Daftuar a4b2518068
Track coinbase spends in CTxMemPoolEntry
This allows us to optimize CTxMemPool::removeForReorg.
2018-02-20 02:57:44 +00:00
Matt Corallo fe5cef0555
removeForReorg calls once-per-disconnect-> once-per-reorg 2018-02-20 02:57:44 +00:00
Matt Corallo 5aa165d557
Make indentation in ActivateBestChainStep readable 2018-02-20 02:57:44 +00:00
Matt Corallo c944d161fd
Fix comment in removeForReorg 2018-02-20 02:57:43 +00:00
Matt Corallo f5b35d2305
Fix removal of time-locked transactions during reorg 2018-02-20 02:57:43 +00:00
Jack Grigg cb580c7241
Add rollback limit to block index rewinding
This will prevent users from starting their nodes if they switch between
software versions that implement different network upgrades. It will also
prevent users from using the testnet if they have more than MAX_REORG_LIMIT
post-upgrade blocks, and the upgrade point is shifted in a newer software
version.
2018-02-19 16:32:45 +00:00
Jack Grigg 57e6ecda5a
Implement roll-back limit for reorganisation
Closes #713.
2018-02-19 16:32:42 +00:00
Simon fa78211ed7 Add test to check malformed v1 transaction against Overwinter tx parser 2018-02-16 15:42:04 -08:00
Jack Grigg 46d3762a90 Update SignatureHash tests for transaction format changes
The test uses randomly-generated transactions, some of which fell outside the
actual consensus rules.
2018-02-16 10:10:35 -08:00
Simon 072099d788 Implementation of Overwinter transaction format ZIP 202. 2018-02-16 10:10:15 -08:00
Homu d527116d46 Auto merge of #2923 - str4d:sighash-tests-env-bug, r=str4d
Use JoinSplitTestingSetup for Boost sighash tests

Symptom: When running all tests, the test suite passed. But when running the
sighash tests on their own, the test suite segfaulted.

Cause: The sighash tests depend on the proving parameters being accessible, but
BasicTestingSetup doesn't load them.
2018-02-15 05:41:18 -08:00
Alex Morcos f41775b2c8
Implement helper class for CTxMemPoolEntry constructor
This is only for unit tests.
2018-02-09 18:35:25 +00:00
Pieter Wuille 934fd19744
Support -checkmempool=N, which runs checks on average once every N transactions 2018-02-09 18:35:25 +00:00
Ashley Holman e328fa32b3
TxMemPool: Change mapTx to a boost::multi_index_container
Indexes on:
- Tx Hash
- Fee Rate (fee-per-kb)
2018-02-09 18:35:25 +00:00
Homu e6850571dd Auto merge of #2898 - str4d:2286-nu-activation-mechanism, r=str4d
Network upgrade activation mechanism

Implements ZIP 200.

Integration with `CChainParams` inspired by https://github.com/bitcoin/bitcoin/pull/7575.

Includes block index rewinding logic cherry-picked from https://github.com/bitcoin/bitcoin/pull/8149.

Closes #2286. Part of #2905.
2018-02-07 02:33:42 -08:00
Jack Grigg cad27eb77f
Update quote from ZIP 200 2018-02-06 23:18:56 +00:00
Jack Grigg 5009136dc3
Change UI/log status message for block rewinding 2018-02-06 22:49:08 +00:00
Jack Grigg 828940b163
Use a boost::optional for nCachedBranchId
This enables us to distinguish between it being unset vs. being set to zero.
2018-02-06 22:42:18 +00:00
jc 15fb13f629
read hashReserved from disk block index 2018-02-04 21:40:14 -05:00
Jack Grigg 149d69e36b
Add method for fetching the next activation height after a given block height 2018-02-04 22:58:42 +00:00
Jack Grigg 548683767c
Add Overwinter to upgrade list 2018-02-04 22:58:42 +00:00
Jack Grigg 9e851450ab
Adjust rewind logic to use the network upgrade mechanism 2018-02-04 22:58:42 +00:00
Pieter Wuille 89f20450c2
Add rewind logic to deal with post-fork software updates
Includes logic for dealing with pruning by Suhas Daftuar.
2018-02-04 22:58:42 +00:00
Jack Grigg f52da91139
Test network upgrade logic
Also demonstrates how to specify a network upgrade.
2018-02-04 22:58:39 +00:00
Jack Grigg b174b7e330
Allow changing network upgrade parameters on regtest
Derived from upstream commit 56c87e92110f05d7452f1e85bf755246ffc77206:
    Allow changing BIP9 parameters on regtest
2018-02-04 22:57:59 +00:00
Jack Grigg 780f526bc9
Network upgrade activation mechanism 2018-02-04 22:57:56 +00:00
Homu a0a010c85c Auto merge of #2839 - arcalinea:add_deprecation_alert, r=bitcartel
Add getdeprecationinfo RPC method to return deprecation block height

Closes #2828

Returns:
```
{
  "version": xxxxx,                      (numeric) the server version
  "subversion": "/MagicBean:x.y.z[-v]/",     (string) the server subversion string
  "deprecationheight": xxxxx,            (numeric) the deprecation block height
}
```
2018-02-02 10:23:37 -08:00
Jack Grigg 35d64c1fde
Use JoinSplitTestingSetup for Boost sighash tests
Symptom: When running all tests, the test suite passed. But when running the
sighash tests on their own, the test suite segfaulted.

Cause: The sighash tests depend on the proving parameters being accessible, but
BasicTestingSetup doesn't load them.
2018-01-31 15:31:51 +00:00
Jay Graber df46562f26 Make applicable only on mainnet 2018-01-29 12:19:19 -08:00
Homu 70109a74e9 Auto merge of #2902 - bitcartel:2901_remove_unused_noblks_constants, r=daira
Remove unused NOBLKS_VERSION_{START,END} constants from version.h

Closes #2901. Backport from upstream PR https://github.com/bitcoin/bitcoin/pull/7662.
2018-01-25 04:37:33 -08:00
Pavel Vasin 20bfa355a0 remove unused NOBLKS_VERSION_{START,END} constants 2018-01-23 15:44:35 -08:00
Homu a4a020de7b Auto merge of #2217 - str4d:2074-chainparams, r=str4d
Bitcoin 0.12 chainparams cleanups

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6222
- bitcoin/bitcoin#6381
- bitcoin/bitcoin#6473
- bitcoin/bitcoin#6242

Part of #2074.
2018-01-22 15:22:24 -08:00
Homu d11230be73 Auto merge of #2886 - bitcartel:2885_cleanup_node_getutxo, r=str4d
Remove redundant service flag NODE_GETUTXO meant for Bitcoin XT.

For #2885. This frees up a service bit.  Zcash has never used this flag
and upstream Bitcoin Core does not support this flag, although
it did reserve it for compatibility with Bitcoin XT.
2018-01-22 08:38:49 -08:00
Jack Grigg 40ebf08ff8
Add viewing key prefix to regtest parameters 2018-01-22 15:32:52 +00:00
Jack Grigg ff145dfe32
Add missing namespace for boost::get 2018-01-22 10:30:41 -05:00
Cory Fields 91690d6e84
chainparams: don't use std namespace 2018-01-22 10:30:41 -05:00
Cory Fields 47b71cec5d
chainparams: move CCheckpointData into chainparams.h
This unties CChainParams from its dependency on checkpoints. Instead, now it
only depends on the raw checkpoint data.
2018-01-22 10:30:41 -05:00
Daniel Kraft a97308c5d4
Clean up chainparams some more.
Clean up the code in chainparams a bit more after the recent
refactorings.  In particular, make sure the structure of the "RegTest"
params matches the structure of the other classes.  This makes the code
clearer to read.

Also remove redundant values of the genesis block in always-specified
optional arguments and mark variable/argument as "const".
2018-01-22 10:30:41 -05:00
Jorge Timón 54ab3b3183
Chainparams: CTestNetParams and CRegTestParams extend directly from CChainParams
...instead of CMainParams and CTestNetParams respectively

Do the same for CBaseChainParams.
The inheritance was only reducing readibility in this case
2018-01-22 10:30:41 -05:00
Jorge Timón 90b6ee6ce5
Chainparams: Introduce CreateGenesisBlock() static function 2018-01-22 10:30:41 -05:00
Mark Friedenbach fe53749dc9
Explicitly set tx.nVersion for the genesis block and mining tests
If/when CTransaction::CURRENT_VERSION is incremented, this will break CChainParams and the miner tests. This fix sets the transaction version explicitly where we depend on the hash value (genesis block, proof of work checks).
2018-01-22 10:30:41 -05:00
Simon 03a61ed87c Remove redundant service flag NODE_GETUTXO meant for Bitcoin XT.
This frees up a service bit.  Zcash has never used this flag
and upstream Bitcoin Core does not support this flag, although
it did reserve it for compatibility with Bitcoin XT.
2018-01-19 17:22:54 -08:00
Simon 5befbed4bc Fixes #2793. Backport commit f33afd3 to increase dbcache default. 2018-01-15 23:17:34 -08:00
Homu b2a114a8c9 Auto merge of #2771 - syd0:fix-snark-dep-build, r=str4d
Fix libsnark dependency build.

This changes libsnark to build in-place, instead of copying first to
a build directory. Previously, modifications made to the original
sources wouldn't get rebuilt without a 'make clean' because users
would be pointing to the copies.

This closes #2689.
2018-01-04 17:06:33 -08:00
Homu 8dbe11451a Auto merge of #2770 - syd0:remove-some-cruft, r=str4d
Remove OSX and Windows files from Makefile + share directory.

These are stale holdovers from bitcoin.

This closes #2169.
2018-01-04 16:02:27 -08:00
syd b6a990def0
Remove OSX and Windows files from Makefile + share directory.
These are stale holdovers from bitcoin.

This closes #2169.
2018-01-04 22:50:17 +00:00
Homu db9f6f0485 Auto merge of #2821 - str4d:2335-scope-ecdsa-constants, r=str4d
Scope the ECDSA constant sizes to CPubKey / CKey classes

Cherry-picked from https://github.com/bitcoin/bitcoin/pull/10657, upstreaming our patches from #2335.
2018-01-04 14:47:50 -08:00
Jack Grigg 2091cf23ae
make-release.py: Versioning changes for 1.0.14. 2018-01-03 23:44:51 +01:00
Jay Graber 9d2974ed5b Add getdeprecationinfo rpc call to return current version and deprecation block height. 2018-01-02 11:38:39 -08:00
Jack Grigg 275f21ad4b
make-release.py: Versioning changes for 1.0.14-rc1. 2017-12-22 09:59:01 +00:00
kozyilmaz bf69507cb5 Fix test/gtest bugs caught by latest macOS clang 2017-12-21 12:35:16 +03:00
Homu 1683c2d5bf Auto merge of #2143 - str4d:1997-viewing-keys, r=str4d
Implement incoming viewing keys

Closes #1997.
2017-12-20 14:11:05 -08:00
Jack Grigg c4c7c6630b
Scope the ECDSA constant sizes to CPubKey / CKey classes 2017-12-20 17:28:13 +00:00
Jack Grigg 2bbfe6c4e8
Add cautions to z_getbalance and z_gettotalbalance help text about viewing keys 2017-12-20 11:24:51 +00:00
Jack Grigg bec2235148
Cleanup: Add braces for clarity 2017-12-20 11:18:59 +00:00
Jack Grigg 7b8d4f87ec
Modify zcrawkeygen RPC method to set "zcviewingkey" to the viewing key
The "zcviewingkey" field has never been documented before, and the method itself
is deprecated; this just ensures it is consistent with the rest of the RPC.
2017-12-20 00:46:41 +00:00
Jack Grigg 44e37656bf
Add watch-only support to Zcash RPC methods
Balance totals do not include spends linked to viewing key addresses, as
nullifiers cannot be calculated and therefore spends cannot be detected.
2017-12-20 00:46:37 +00:00
Jack Grigg 9a2b8ae57f
Update wallet logic to account for viewing keys
The wallet code previously assumed that an unlocked wallet would always
have a spending key associated with a note decryptor. Viewing keys break
this assumption.
2017-12-20 00:46:37 +00:00
Jack Grigg e85b33a52e
Add RPC methods for exporting/importing viewing keys 2017-12-20 00:46:37 +00:00
Jack Grigg 167cd33374
Implement viewing key storage in the wallet 2017-12-20 00:46:37 +00:00
Jack Grigg 49cf707d2c
Add Base58 encoding of viewing keys 2017-12-20 00:46:33 +00:00
syd a55c186a74 Fix libsnark dependency build.
This changes libsnark to build in-place, instead of copying first to
a build directory. Previously, modifications made to the original
sources wouldn't get rebuilt without a 'make clean' because users
would be pointing to the copies.

This closes #2689.
2017-12-16 15:52:08 -05:00
Homu 7888624f74 Auto merge of #2795 - str4d:2351-sprout-circuit-value, r=str4d
Track net value entering and exiting the Sprout circuit

Delta values will be stored for new blocks; old blocks can be filled in by
re-indexing. The net value currently in the Sprout circuit is only calculated
when delta values for all previous blocks are present.

Part of #2351.
2017-12-16 02:09:40 -08:00
Jack Grigg e365ca1c53
Remove nSproutValue TODO from CDiskBlockIndex
Block indices are flushed to disk when they are marked as dirty, and this
happens via enough distinct pathways that it would be sufficiently complex to
update nSproutValue via all of them. Thus it is necessary to be able to
serialize "no value" for writes by upgraded clients.
2017-12-16 10:01:26 +00:00
Homu 2a48fa62bf Auto merge of #2780 - str4d:1272-secp256k1, r=daira
Merge current secp256k1 subtree

Part of #1272.
2017-12-15 12:35:13 -08:00
Jack Grigg 9d0c70e9e7
Clarify operator precedence in serialization of nSproutValue 2017-12-15 18:36:05 +00:00
Homu f44a4cea42 Auto merge of #2790 - bitcartel:2746_payment_disclosure_prefix, r=str4d
Closes #2746. Payment disclosure blobs now use 'zpd:' prefix.
2017-12-15 10:31:58 -08:00
Homu b9c7d84990 Auto merge of #2800 - str4d:2788-libsnark-test-hardening, r=str4d
Fix buffer overflow in libsnark

Applies `-fstack-protector-all` to libsnark, and fixes an underlying bug. This bug was not triggerable in `zcashd` because the function in question was being inlined by the compiler.

Closes #2788.
2017-12-15 07:32:41 -08:00
Homu 83af270002 Auto merge of #2786 - str4d:2074-build, r=str4d
Build system improvements

Includes commits cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6978
  - Only the first commit (second is for QT)
- bitcoin/bitcoin#7059
- bitcoin/bitcoin#7603
  - Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT)
- bitcoin/bitcoin#7954
- bitcoin/bitcoin#8314
  - Only the second commit (first is for QT)
- bitcoin/bitcoin#8504
  - Only the first commit (second was undoing something we didn't have)
- bitcoin/bitcoin#8520
- bitcoin/bitcoin#8563
- bitcoin/bitcoin#8249
- bitcoin/bitcoin#9156
- bitcoin/bitcoin#9831
- bitcoin/bitcoin#9789
- bitcoin/bitcoin#10766

Part of #2074.
2017-12-15 05:04:44 -08:00
syd 4a617475ec
Fix libsnark test failure.
The shorten() method was copying too much into the destination
buffer, overflowing it and affecting neighboring data.
2017-12-15 10:37:07 +00:00
Jack Grigg d66bf190cb
Apply -fstack-protector-all to libsnark 2017-12-15 10:02:54 +00:00
Jack Grigg e319633435
Add Sprout value pool to getblock and getblockchaininfo 2017-12-14 22:06:15 +00:00
Jack Grigg ad6a36ad02
Track net value entering and exiting the Sprout circuit
Delta values will be stored for new blocks; old blocks can be filled in by
re-indexing. The net value currently in the Sprout circuit is only calculated
when delta values for all previous blocks are present.
2017-12-14 22:06:11 +00:00
Simon 61345ae703 Closes #2746. Payment disclosure blobs now use 'zpd:' prefix. 2017-12-07 10:11:43 -08:00
Homu 019c4bddc8 Auto merge of #2741 - bitcartel:stop_dumpwallet_overwriting, r=str4d
Prevent RPC calls dumpwallet and z_exportwallet from overwriting an existing file

Closes #2740
2017-12-04 09:41:52 -08:00
Jack Grigg 13933e4c13
Factor out common logic from CZCPaymentAddress and CZCSpendingKey 2017-12-04 17:17:18 +00:00
Jack Grigg aa666c9673
Implement viewing key storage in the keystore 2017-12-04 17:17:18 +00:00
Jack Grigg 642a1caf93
ViewingKey -> ReceivingKey per zcash/zips#117 2017-12-04 17:17:18 +00:00
Homu 28e0159707 Auto merge of #2724 - arcalinea:1020-add-examples-for-zrpc, r=str4d
Add examples for z_rpc calls

Adds missing cli and json-rpc examples for `z_` rpc calls

Closes #2723
(Accidentally named the branch being merged in with wrong issue number)
2017-12-04 08:39:20 -08:00
Cory Fields 5dd887fdf7
build: add --enable-werror option
This turns some compiler warnings into errors. Useful for c-i.
2017-12-01 14:10:17 +00:00
Jack Grigg ad96d74afe
build: Split hardening/fPIE options out in Zcash-specific binaries 2017-12-01 14:10:11 +00:00
Cory Fields c459de2f03
build: Split hardening/fPIE options out
This allows for fPIE to be used selectively.
2017-11-30 15:17:37 +00:00
Jack Grigg c6b39fbbd6
Include endian-ness compatibility layer in Equihash implementation 2017-11-29 17:28:44 +00:00
Jack Grigg d3096198c8
[libsnark] Use POSIX-compliant ar arguments 2017-11-29 17:28:44 +00:00
Jack Grigg daad2c2736
Check if OpenMP is available before using it 2017-11-29 17:28:44 +00:00
Cory Fields 4bfe8a744b
c++11: CAccountingEntry must be defined before use in a list
c++11ism. This fixes builds against libc++.
2017-11-29 17:24:59 +00:00
Cory Fields 4165af1b73
c++11: don't throw from the reverselock destructor
noexcept is default for destructors as of c++11. By throwing in reverselock's
destructor if it's lock has been tampered with, the likely result is
std::terminate being called. Indeed that happened before this change.

Once reverselock has taken another lock (its ctor didn't throw), it makes no
sense to try to grab or lock the parent lock. That is be broken/undefined
behavior depending on the parent lock's implementation, but it shouldn't cause
the reverselock to fail to re-lock when destroyed.

To avoid those problems, simply swap the parent lock's contents with a dummy
for the duration of the lock. That will ensure that any undefined behavior is
caught at the call-site rather than the reverse lock's destruction.

Barring a failed mutex unlock which would be indicative of a larger problem,
the destructor should now never throw.
2017-11-29 17:24:59 +00:00
Homu 37ffef4628 Auto merge of #2767 - syd0:cleanup-reserved-include-guards, r=str4d
Get rid of underscore prefixes for include guards.

This is because they may conflict with reserved names. Also took
this opportunity to make the guards in the zcash subdir a bit
more uniform by having them all conform to ZC_<...>_H_

This closes #1272
2017-11-29 06:52:52 -08:00
Homu 213ac8d1fe Auto merge of #2764 - syd0:remove-old-boost-defines, r=str4d
Remove Boost conditional compilation.

Boost is currently at version 106200 in the depends subsystem
so it is safe to remove code the refers to earlier versions.

This closes #2445
2017-11-28 12:19:27 -08:00
syd 4e4aa5b6ec Get rid of underscore prefixes for include guards.
This is because they may conflict with reserved names. Also took
this opportunity to make the guards in the zcash subdir a bit
more uniform by having them all conform to ZC_<...>_H_

This closes #1272
2017-11-28 14:57:58 -05:00
Jack Grigg 7a448d3fa5
Bump secp256k1 subtree 2017-11-28 16:43:13 +00:00
Jack Grigg cde23ac085
Squashed 'src/secp256k1/' changes from 84973d3..6ad5cdb
6ad5cdb Merge #479: Get rid of reserved _t in type names
d1dc9df Get rid of reserved _t in type names
0b70241 Merge #474: Fix header guards using reserved identifiers
ab1f89f Merge #478: Fixed multiple typos
8c7ea22 Fixed multiple typos
abe2d3e Fix header guards using reserved identifiers
f532bdc Merge #459: Add pubkey prefix constants to include/secp256k1.h
cac7c55 Merge #470: Fix wnaf_const documentation
768514b Fix wnaf_const documentation with respect to return value and number of words set
b8c26a3 Merge #458: Fix typo in API documentation
817fb20 Merge #440: Fix typos
12230f9 Merge #468: Remove redundant conditional expression
2e1ccdc Remove redundant conditional expression
bc61b91 add pubkey prefix constants to include/secp256k1.h
b0452e6 Fix typo in API documentation
4c0f32e Fix typo: "Agressive" → "Aggressive"
73aca83 Fix typo: "exectured" → "executed"

git-subtree-dir: src/secp256k1
git-subtree-split: 6ad5cdb42a1a8257289a0423d644dcbdeab0f83c
2017-11-28 16:42:12 +00:00
Homu 2ff8ab7dfb Auto merge of #2751 - syd0:upgrade-googletest-1.8.0, r=str4d
Upgrade googletest to 1.8.0

Closes #1432.
2017-11-28 07:37:20 -08:00
Jay Graber 9eb8089e98 Fix cli help result for z_shieldcoinbase 2017-11-27 20:06:36 -08:00
syd d52dcf5d0c InitGoogleMock instead of InitGoogleTest per CR 2017-11-27 11:08:34 -05:00
Homu 9ce4859459 Auto merge of #2766 - syd0:remove-fPowAllowMinDifficultyBlocks, r=str4d
Get rid of consensus.fPowAllowMinDifficultyBlocks.

This closes #1380
2017-11-27 04:06:27 -08:00
syd 5163fd9d07 Get rid of fp3 from libsnark, it is not used.
This is for #1544
2017-11-25 15:08:01 -05:00
syd a10c2f46a5 Add gtests to .gitignore 2017-11-25 11:05:01 -05:00
syd 7c591c6d2f Don't compile libgtest.a when building libsnark.
Previously libsnark would try to build libgtest if /usr/src/gtest
exists on the build machine. This caused issues because the
version of libgtest in /usr/src isn't necessarily the same as
the one that the rest of zcash's gtests were built with.
2017-11-25 10:58:37 -05:00
syd dffc025d38 Get rid of consensus.fPowAllowMinDifficultyBlocks.
This closes #1380
2017-11-23 12:20:50 -05:00
syd 6df5f51b7c Update to address @daira comments wrt fixing configure.ac
Since we're enforcing Boost >= 1.62, we no longer need HAVE_WORKING_BOOST_SLEEP_FOR.
2017-11-23 11:58:25 -05:00
syd c72a4732cc Remove Boost conditional compilation.
Boost is currently at version 106200 in the depends subsystem
so it is safe to remove code the refers to earlier versions.

This closes #2445
2017-11-23 00:05:21 -05:00
Homu df1c3debcc Auto merge of #2752 - syd0:fix-sec-hard-tests, r=daira
Get the sec-hard tests to run correctly.

This fixes the way arguments were passed to security-check, and also
a typo in how BIND_NOW was being searched for in a list.

Also fix how symbol-check is invoked although that script isn't
currently used.
2017-11-22 15:22:10 -08:00
Jack Grigg 0523d21d22
make-release.py: Versioning changes for 1.0.13. 2017-11-20 12:23:45 +00:00
syd 2d342736dc Get the sec-hard tests to run correctly.
This fixes the way arguments were passed to security-check, and also
a typo in how BIND_NOW was being searched for in a list.

Also fix how symbol-check is invoked although that script isn't
currently used.
2017-11-20 00:48:12 -05:00
Jay Graber 337a99a219 Add cli and rpc examples for z_sendmany 2017-11-17 13:17:51 -08:00
Jack Grigg e70c8d2ea3
make-release.py: Versioning changes for 1.0.13-rc2. 2017-11-17 17:49:28 +00:00
Simon ba1dbb3040 RPC dumpwallet and z_exportwallet updated to no longer allow
overwriting an existing file.
2017-11-16 22:29:37 -08:00
Jack Grigg fee8835388
Mark libsnark includes as library includes 2017-11-15 16:49:10 +00:00
Jack Grigg 8f23c734e6
Pass correct dependencies path to libsnark from both Gitian and build.sh 2017-11-15 15:30:21 +00:00
Jack Grigg 83bef3fcbe
Move libsnark from DIST_SUBDIRS into EXTRA_DIST 2017-11-15 11:10:19 +00:00
Jack Grigg 66a9fd8b72
Change auto-senescence cycle to 16 weeks
Closes #2686
2017-11-15 00:37:02 +00:00
Jack Grigg c5b04132bd
make-release.py: Versioning changes for 1.0.13-rc1. 2017-11-14 23:53:45 +00:00
Homu c8ecd49574 Auto merge of #2159 - bitcartel:1.0.7_payment_disclosure, r=str4d
Payment disclosure (experimental feature)
2017-11-14 14:06:22 -08:00
Simon 45232b1961 Add payment disclosure as experimental feature. 2017-11-14 13:29:05 -08:00
Homu 064600ec8a Auto merge of #2649 - bitcartel:2576_security_url, r=str4d
Closes #2576. Update link to security info on z.cash website.
2017-11-09 15:19:41 -08:00
Homu 6f9f09dfb0 Auto merge of #2670 - arielgabizon:lowmemprover, r=daira
Low memory prover

This PR integrates @ebfull 's low memory changes:  https://github.com/zcash/zcash/pull/2243/commits
on top of @str4d 's work bringing in libsnark as a subtree
4699d0eb36
2017-11-06 04:22:20 -08:00
Jack Grigg bef1b5ce1b
Fix NPE in rpc_wallet_tests 2017-11-05 12:02:21 -05:00
Simon c5dabd2b66 Closes #2639. Adds optional limit parameter with a default value of 50.
The new parameter is to satisfy the principle of least astonishment
by providing a sensible default for the maximum number of transparent
inputs to shield.  If users do not configure -mempooltxinputlimit
it is possible for them to create transactions with hundreds of
inputs which suffer from mining delay, due to the current state of
the network where some miners have configured -mempooltxinputlimit
as a way to deal with the problem of quadratic hashing.
2017-11-01 10:40:24 -07:00
Simon 1051242926 Closes #2576. Update link to security info on z.cash website. 2017-10-31 20:31:40 -07:00
Ariel Gabizon 4305a56221
boost::format -> tinyformat 2017-11-01 02:11:49 +13:00
Sean Bowe 394f41853b
Integrate low memory prover. 2017-11-01 02:11:49 +13:00
Sean Bowe c8a7f74753
Add streaming prover. 2017-11-01 02:11:49 +13:00
Sean Bowe abf4af12df
Refactor proof generation function. 2017-11-01 02:11:46 +13:00
Simon c2d3bafeaa Closes #2639. z_shieldcoinbase is now supported, no longer experimental.
This reverts commit 5023af7bd5.
2017-10-26 11:29:36 -07:00
Homu fb2f98e00b Auto merge of #2555 - jasondavies:fix-2554, r=str4d
Fix various thread assertion errors caused during shutdown.

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6719
- bitcoin/bitcoin#6990
- bitcoin/bitcoin#8421
  - Second commit only in this PR
- bitcoin/bitcoin#11006

I've cherry-picked the relevant commits, along with a note in each commit referring to the original Bitcoin commit ID (and the Zcash issue numbers where applicable).  I've tested each issue with/without these patches applied.

Closes #2214, #2334, and #2554.
2017-10-23 15:15:14 -07:00
João Barbosa d3c8109b41 Improve shutdown process
Zcash: cherry-picked from commit 793667af1c31835e0eefcdd283930bb89cfeda8f
2017-10-23 14:14:45 +01:00
Sean Bowe 1a9543d064 Remove crusty old "loadVerifyingKey"/"loadProvingKey" APIs and associated invariants. 2017-10-21 15:42:41 +03:00
Homu 4ca8f506d7 Auto merge of #2652 - str4d:820-libsnark-subtree, r=str4d
Move libsnark in-repo as a git subtree

This PR pulls in the libsnark subtree at the exact commit that we currently fetch via the depends system. To verify:

```
$ ./contrib/devtools/git-subtree-check.sh src/snark
src/snark in HEAD was last updated to upstream commit 9ada3f84ab484c57b2247c2f41091fd6a0916573 (tree c10a38c759)
src/snark in HEAD currently refers to tree 34e916d3f6
:100644 100644 427f4f4ce9 13e54da68b M	Makefile
:040000 040000 42f29e42d1 dd73536163 M	src
FAIL: subtree directory tree doesn't match subtree commit tree
```

This shows that there are changes relative to what we currently use, due to the later commits in the PR. If we exclude them, we see that the code is identical:

```
$ git checkout 26a8f68ea8
$ ./contrib/devtools/git-subtree-check.sh src/snark
src/snark in HEAD was last updated to upstream commit 9ada3f84ab484c57b2247c2f41091fd6a0916573 (tree c10a38c759)
src/snark in HEAD currently refers to tree c10a38c759
GOOD
```

Closes #820.
2017-10-17 20:41:11 -07:00
Jack Grigg d43b32bbfe
Remove OpenSSL libraries from libsnark LDLIBS
Unnecessary in the Zcash libsnark fork.
2017-10-17 20:33:28 -07:00
Jack Grigg 99ca5e1a22
Ensure that libsnark is built first, so its headers are available 2017-10-17 19:04:38 -07:00
Jack Grigg e2283742db
Add libsnark to "make clean" 2017-10-17 19:03:41 -07:00
Homu af549fe6ed Auto merge of #2650 - str4d:2645-listunspent-benchmark, r=str4d
Add benchmark for listunspent

Closes #2645.
2017-10-12 15:24:53 -07:00
Jack Grigg 8598c20d40
Changes to get test_r1cs_ppzksnark passing 2017-10-11 21:15:49 +01:00
Jack Grigg 82e839e4ff
Add "make libsnark-tests" that runs libsnark's "make check" 2017-10-11 15:22:24 +01:00
Jack Grigg 19f6668c27
Add "make check" to libsnark that runs the Google Tests 2017-10-11 15:21:44 +01:00
Jack Grigg 638e742f3f
Update libsnark LDLIBS
-lsodium is necessary as we altered libsnark to use libsodium's RNG.
2017-10-11 15:19:33 +01:00
Jack Grigg 4699d0eb36
Add alt_bn128 to QAP and Merkle tree gadget tests 2017-10-11 15:18:01 +01:00
Jack Grigg df3083fe4e
Remove test code corresponding to removed code 2017-10-11 14:59:51 +01:00
Jack Grigg 054ae60645
Migrate libsnark test code to Google Test 2017-10-11 14:54:42 +01:00
Jason Davies b30900a54b Replace "bitcoin" with "Zcash". 2017-10-05 18:10:15 +01:00
Simon 6de850120f Replace 'bitcoin address' with 'zcash address'. 2017-10-04 17:07:07 -07:00
Jay Graber c16528495c s/zcash/Zcash 2017-10-04 17:06:51 -07:00
Bruno Arueira d2c1e4a807 Removes out bitcoin mention in favor for zcash
Bitcoin Core => Zcash
bitcoin address => Zcash address
bitcoinaddress => zcashaddress

Closes #1756
2017-10-04 17:05:30 -07:00
Jack Grigg 99dd50c30c
Add benchmark for listunspent
Closes #2645.
2017-10-04 12:48:50 +01:00
Jack Grigg 0f49863acb
make-release.py: Versioning changes for 1.0.12. 2017-09-28 01:17:05 +01:00
Simon 5023af7bd5 Closes #2637. Make z_shieldcoinbase an experimental feature where it
can be enabled with: zcashd -experimentalfeatures -zshieldcoinbase.
2017-09-27 10:43:54 -07:00
Simon b85008e786 Update which lock to synchronize on when calling GetBestAnchor(). 2017-09-26 10:16:33 -07:00
Jack Grigg 39cb7df909
make-release.py: Versioning changes for 1.0.12-rc1. 2017-09-23 10:42:23 +01:00
Homu f34c60de37 Auto merge of #2615 - bitcartel:2448_shield_coinbase, r=bitcartel
Add RPC command shield_coinbase #2448.

Shield transparent coinbase funds by sending to a shielded z address. Closes #2448.
2017-09-22 12:04:31 -07:00
Simon 06c19063bb Implement RPC shield_coinbase #2448. 2017-09-21 15:04:12 -07:00
Homu 8f16b27304 Auto merge of #2616 - nathan-at-least:importprivkey-shows-address.4, r=str4d
Importprivkey shows address

Scratching an itch: make `importprivkey` output the corresponding address.

Without this PR, `importprivkey` shows no output. Because we're moving towards an "address-based" RPC interface, rather than "account-based", there's a gap when using `importprivkey` because there's no way to assign it to a specific account, but also no easy way to determine the address. This change fixes that wart.
2017-09-21 14:29:03 -07:00
Homu 60b4a79000 Auto merge of #2620 - bitcartel:2583_watch_only_fspendable, r=str4d
Closes #2583. Exclude watch-only utxos from coin selection.
2017-09-20 04:49:48 -07:00
Simon b17e1b4080 Closes #2583. Exclude watch-only utxos from z_sendmany coin selection. 2017-09-19 19:42:48 -07:00
Homu 6e9964ff70 Auto merge of #2613 - arielgabizon:load-wallet-benchmark, r=str4d
Add load-wallet benchmark

Closes #2518.
2017-09-19 01:52:22 -07:00
Ariel Gabizon 2e8aefdce1 add load-wallet benchmark 2017-09-18 21:54:53 +02:00
Homu 61d9c6745a Auto merge of #2545 - bhjortsberg:fixes-for-gcc-7, r=str4d
Fixes for gcc 7

This fixes a few issues when using a newer compiler (in my case gcc 7.1.1) available in for example Arch Linux.
Solves for example this issue: https://github.com/zcash/zcash/issues/2304

The first thing is an error when checking for boost_system and is solved by disabling that warning (wich is treated as an error and, hence, stops the build):

```
configure:22242: checking for exit in -lboost_system-mt
configure:22267: g++ -m64 -o conftest -std=c++11 -pipe -fPIC -O1 -fwrapv -fno-strict-aliasing -Werror -g  -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -fPIE ..<snip>... /x86_64-unknown-linux-gnu/share/../lib conftest.cpp -lboost_system-mt  -lanl  >&5
conftest.cpp:70:6: error: declaration of 'char exit()' conflicts with built-in declaration 'void exit(int)' [-Werror=builtin-declaration-mismatch]
 char exit ();
      ^~~~
cc1plus: all warnings being treated as errors

```

The second thing was to clean some code that is deprecated in C++11 which also lead to a warning treated as error. It could also be fixed with `-Wno-deprecated` but better to fix the issue in my opinion.
2017-09-18 11:45:24 -07:00
Homu e0bef1de56 Auto merge of #2564 - str4d:2074-currency-units, r=str4d
Rationalize currency unit to "ZEC"

Cherry-picked from the upstream PR bitcoin/bitcoin#6504

Part of #2074
2017-09-18 00:07:52 -07:00
Nathan Wilcox de422c066b [tests pass] Ensure `importprivkey` outputs the address in case key is already imported. 2017-09-18 15:30:42 +09:00
Nathan Wilcox d187317083 [tests pass] Output address on new key import. 2017-09-18 15:30:42 +09:00
Homu d1bba6f1b6 Auto merge of #2601 - str4d:2156-large-wallet-utxos, r=str4d
Benchmark time to call sendtoaddress with many UTXOs

Part of #2156.
2017-09-13 15:38:57 -07:00
Jack Grigg a76174b76b
Benchmark time to call sendtoaddress with many UTXOs 2017-08-31 02:15:06 +01:00
Jason Davies d6252a9473 Fix deprecation policy comment.
Thanks to @daira for spotting this and suggesting the correct policy.
2017-08-15 19:09:12 +01:00
Jack Grigg 2fd43c599f
make-release.py: Versioning changes for 1.0.11. 2017-08-15 09:52:36 +01:00
Jack Grigg 6dec2d0355
Rationalize currency unit to "ZEC" 2017-08-03 18:49:04 +01:00
Ross Nicoll 091b2116a0
Rationalize currency unit to "BTC"
Previously various user-facing strings have used inconsistent currency units "BTC",
"btc" and "bitcoins". This adds a single constant and uses it for each reference to
the currency unit.

Also adds a description of the unit for --maxtxfee, and adds the missing "amount"
field description to the (deprecated) move RPC command.
2017-08-03 16:32:41 +01:00
Jack Grigg 24d98cece0
Add libsnark compile flag to not copy DEPINST to PREFIX
This is useful for Zcash, where DEPINST is its depends folder, not libsnark's
internal dependency folder.
2017-08-02 15:53:51 +01:00
Sean Bowe 26a8f68ea8
Remove libsnark from depends system and integrate it into build system. 2017-08-02 15:49:30 +01:00
Jack Grigg a06446408c
Merge commit '51e448641d6cbcd582afa22cd8475f8c3086dad7' as 'src/snark' 2017-08-02 11:17:32 +01:00
Jack Grigg 51e448641d
Squashed 'src/snark/' content from commit 9ada3f8
git-subtree-dir: src/snark
git-subtree-split: 9ada3f84ab484c57b2247c2f41091fd6a0916573
2017-08-02 11:17:25 +01:00
Cory Fields c98b91b7c5 httpserver: explicitly detach worker threads
When using std::thread in place of boost::thread, letting the threads destruct
results in a std::terminate. According to the docs, the same thing should be
be happening in later boost versions:
http://www.boost.org/doc/libs/1_55_0/doc/html/thread/thread_management.html#thread.thread_management.thread.destructor

I'm unsure why this hasn't blown up already, but explicitly detaching can't
hurt.

Zcash: cherry-picked from commit d3773ca9aeb0d2f12dc0c5a0726778050c8cb455
This fixes #2554 (zcash-cli stop during getblocktemplate long poll
causes 'Assertion `!pthread_mutex_unlock(&m)' failed.')
2017-08-01 20:24:27 +01:00
Wladimir J. van der Laan c7f77e28f0 http: speed up shutdown
This continues/fixes #6719.

`event_base_loopbreak` was not doing what I expected it to, at least in
libevent 2.0.21.
What I expected was that it sets a timeout, given that no other pending
events it would exit in N seconds. However, what it does was delay the
event loop exit with 10 seconds, even if nothing is pending.

Solve it in a different way: give the event loop thread time to exit
out of itself, and if it doesn't, send loopbreak.

This speeds up the RPC tests a lot, each exit incurred a 10 second
overhead, with this change there should be no shutdown overhead in the
common case and up to two seconds if the event loop is blocking.

As a bonus this breaks dependency on boost::thread_group, as the HTTP
server minds its own offspring.

Zcash: cherry-picked from commit a264c32e3321ae909ca59cb8ce8bf5d812dbc4e1
2017-08-01 20:24:27 +01:00
Wladimir J. van der Laan 2abe8ef721 http: Force-exit event loop after predefined time
This makes sure that the event loop eventually terminates, even if an
event (like an open timeout, or a hanging connection) happens to be
holding it up.

Zcash: cherry-picked from commit ec908d5f7aa9ad7e3487018e06a24cb6449cc58b
2017-08-01 20:24:27 +01:00
Wladimir J. van der Laan dbf7057f7a http: Wait for worker threads to exit
Add a WaitExit() call to http's WorkQueue to make it delete the work
queue only when all worker threads stopped.

This fixes a problem that was reproducable by pressing Ctrl-C during
AppInit2:
```
/usr/include/boost/thread/pthread/condition_variable_fwd.hpp:81: boost::condition_variable::~condition_variable(): Assertion `!ret' failed.
/usr/include/boost/thread/pthread/mutex.hpp:108: boost::mutex::~mutex(): Assertion `!posix::pthread_mutex_destroy(&m)' failed.
```

I was assuming that `threadGroup->join_all();` would always have been
called when entering the Shutdown(). However this is not the case in
bitcoind's AppInit2-non-zero-exit case "was left out intentionally
here".

Zcash: cherry-picked from commit de9de2de361ab1355b976f17371d73e36fe3bf56
Fixes #2334 and #2214.
2017-08-01 20:24:27 +01:00
Wladimir J. van der Laan c0fe29370a Make HTTP server shutdown more graceful
Shutting down the HTTP server currently breaks off all current requests.
This can create a race condition with RPC `stop` command, where the calling
process never receives confirmation.

This change removes the listening sockets on shutdown so that no new
requests can come in, but no longer breaks off requests in progress.

Meant to fix bitcoin/#6717.

Zcash: cherry-picked from commit 5e0c22135600fe36811da3b78216efc61ba765fb
2017-08-01 20:24:27 +01:00
Ariel Gabizon fcf824e9f1 make-release.py: Versioning changes for 1.0.11-rc1. 2017-08-01 17:11:57 +02:00
Homu 10acd8a1fb Auto merge of #2484 - str4d:block-download-completion, r=daira
Add block download progress to metrics UI
2017-07-28 21:57:19 -07:00
Jack Grigg 92bfde0edf
Improve network height estimation 2017-07-28 10:50:07 +00:00
Jack Grigg 4a651837be
Correct and extend EstimateNetHeightInner tests
Corrections are to the median block times, which were generated by subtracting
CBlockIndex::nMedianTimeSpan / 2 from the block height and then multiplying by
the target spacing. GetMedianTimePast() takes an array sorted by std::sort() and
returns element CBlockIndex::nMedianTimeSpan / 2, meaning that if
CBlockIndex::nMedianTimeSpan is odd (which it is), there is an out-by-one error
in the subtraction.
2017-07-28 10:45:44 +00:00
Homu d6e6f51724 Auto merge of #2526 - bitcartel:2480_segfault_zeroconf_from_zaddr, r=daira
Fixes #2480 where missing map entry would cause a segfault.

`wtxHeight = mapBlockIndex[wtx.hashBlock]->nHeight;` results in undefined behaviour when the block hash is not present in the map, returning a null value which is dereferenced via `->nHeight`.  This error is triggered by a zero-conf wallet transaction which has not been mined yet.  As discussed in #2480, on some systems there is a segfault whilst on others there is a silent exit.  This makes it difficult to write a test, but the fix has been tested empirically to confirm an exception is thrown.  This PR fixes the segfault and complements #2525 which prevents a user from sending from a zaddr with minconf 0.
2017-07-27 22:42:59 -07:00
Jack Grigg 047aec1e0e
Add block download progress to metrics UI 2017-07-26 00:51:12 +00:00