Commit Graph

9481 Commits

Author SHA1 Message Date
practicalswift 4ddfb216ee Fix missing or inconsistent include guards 2020-10-27 23:05:02 +00:00
Dan Raviv 36463d42c0 Fix header guards using reserved identifiers
Identifiers beginning with an underscore followed immediately by an uppercase letter are reserved.
2020-10-27 23:05:02 +00:00
Philip Kaufmann 70e1e116af [Trivial] ensure minimal header conventions
- ensure header namespaces and end comments are correct
- add missing header end comments
- ensure minimal formatting (add newlines etc.)
2020-10-27 23:05:02 +00:00
therealyingtong f10cf663bc make-release.py: Versioning changes for 4.1.0-rc1. 2020-10-28 02:32:03 +08:00
Homu 5009f219e6 Auto merge of #4830 - daira:rename-bp-funding-stream, r=daira
Rename the FS_ZIP214_ECC funding stream to FS_ZIP214_BP

See also https://github.com/zcash/zips/pull/412 .

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-27 15:06:57 +00:00
Daira Hopwood d54dda736d Rename the FS_ZIP214_ECC funding stream to FS_ZIP214_BP.
See also https://github.com/zcash/zips/pull/412 .

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-27 13:27:19 +00:00
Homu d6012677ea Auto merge of #4826 - str4d:4823-static-assert, r=daira
Replace BOOST_STATIC_ASSERT with static_assert

Closes zcash/zcash#4823.
2020-10-27 11:46:00 +00:00
Jack Grigg d476537d86 scripted-diff: Remove BOOST_STATIC_ASSERT
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_STATIC_ASSERT(/static_assert(/' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include <boost\/static_assert.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2020-10-27 10:44:58 +00:00
Homu 1d5ed8fa2f Auto merge of #4744 - LarryRuane:4721-treestate, r=daira
add z_gettreestate RPC

Closes #4721.
2020-10-27 09:46:56 +00:00
Larry Ruane a91a7d37cf add z_gettreestate rpc 2020-10-26 23:08:47 -06:00
Homu b9a4f291ea Auto merge of #4812 - str4d:shielded-reqs-reject-reasons, r=str4d
Improve reject reasons for unmet shielded requirements

These reject messages end up bubbling up to users via the RPC interface.
Distinguishing between the various failure cases will help users figure
out why their transaction is being rejected.

Closes zcash/zcash#3114.
2020-10-27 01:35:14 +00:00
Jack Grigg 1b42734b9f tests: Update chained_joinsplits test for HaveShieldedRequirements API change 2020-10-26 23:46:19 +00:00
Jack Grigg 8f56306359 Add txid to "shielded requirements not met" messages 2020-10-26 14:12:57 +00:00
Homu 40d5f0aa57 Auto merge of #4805 - str4d:fs-abstraction, r=str4d
Lightweight abstraction of boost::filesystem

This is a refactor backport ahead of replacing most of our Boost dependencies with C++17 code.

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#7667
  - Removes merge conflicts.
- bitcoin/bitcoin#9902
- bitcoin/bitcoin@2300a5e13a
- bitcoin/bitcoin#10546
  - Only the changes to `src/fs.cpp`
2020-10-26 02:03:34 +00:00
Jack Grigg d7c80e760c utils: Remove unnecessary GetTempPath() 2020-10-26 02:02:18 +00:00
Homu fef4b911d1 Auto merge of #4804 - str4d:update-secp256k1-again, r=daira
Update secp256k1 again

This migrates us to the same dependency version that upstream Bitcoin
Core migrated to in bitcoin/bitcoin#20147.
2020-10-25 00:45:09 +00:00
Jack Grigg 6fa2d1b73e Add logging to CCoinsViewCache::HaveShieldedRequirements
Enable with -debug=consensus
2020-10-23 20:16:07 +01:00
Jack Grigg 47c0c65326 Improve reject reasons for unmet shielded requirements
These reject messages end up bubbling up to users via the RPC interface.
Distinguishing between the various failure cases will help users figure
out why their transaction is being rejected.

Uses operator* instead of std::optional::value because the latter was
introduced in macOS 10.14, and our current minimum is 10.12.

Closes zcash/zcash#3114.
2020-10-23 20:16:07 +01:00
Daira Hopwood f23528ddd0 Fix death gtests on macOS by switching to the threadsafe style.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-23 16:08:59 +01:00
practicalswift 3cf87df03c Remove unused Boost includes
Zcash: Only the changes to src/fs.cpp
2020-10-22 01:11:37 +01:00
Ahmad Kazi e2273f1011 [Trivial] Add BITCOIN_FS_H endif footer in fs.h 2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan 0d3bba071d Remove `namespace fs=fs`
Having these inside functions is silly and redundant now.
2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan 532a0c5c52 torcontrol: Use fs::path instead of std::string for private key path 2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan c0603a9fa6 Use fsbridge for fopen and freopen
Abstracts away how a path is opened to a `FILE*`.

Reduces the number of places where path is converted to a string
for anything else but printing.
2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan 73bc7a068d Replace uses of boost::filesystem with fs
Step two in abstracting away boost::filesystem.

To repeat this, simply run:
```
git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g'
```
2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan 7044e39a57 Replace includes of boost/filesystem.h with fs.h
This is step one in abstracting the use of boost::filesystem.
2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan 082f530d6e Add fs.cpp/h 2020-10-22 01:11:37 +01:00
Mustafa dafc0d35eb Move GetTempPath() to testutil. 2020-10-22 01:11:37 +01:00
Mustafa 42929fae9d Add a source file for unit test utils. 2020-10-22 01:11:37 +01:00
Jack Grigg eec9e2dcac Update libsecp256k1 subtree to latest master 2020-10-22 00:42:47 +01:00
Jack Grigg 52ac87242d Squashed 'src/secp256k1/' changes from 8ab24e8da..c6b6b8f1b
c6b6b8f1b Merge #830: Rip out non-endomorphism code + dependencies
c582abade Consistency improvements to the comments
63c6b7161 Reorder comments/function around scalar_split_lambda
2edc514c9 WNAF of lambda_split output has max size 129
4232e5b7d Rip out non-endomorphism code
ebad8414b Check correctness of lambda split without -DVERIFY
fe7fc1fda Make lambda constant accessible
9d2f2b44d Add tests to exercise lambda split near bounds
9aca2f7f0 Add secp256k1_split_lambda_verify
acab934d2 Detailed comments for secp256k1_scalar_split_lambda
76ed922a5 Increase precision of g1 and g2
6173839c9 Switch to our own memcmp function
63150ab4d Merge #827: Rename testrand functions to have test in name
c5257aed0 Merge #821: travis: Explicitly set --with-valgrind
bb1f54280 Merge #818: Add static assertion that uint32_t is unsigned int or wider
a45c1fa63 Rename testrand functions to have test in name
5006895bd Merge #808: Exhaustive test improvements + exhaustive schnorrsig tests
4eecb4d6e travis: VALGRIND->RUN_VALGRIND to avoid confusion with WITH_VALGRIND
66a765c77 travis: Explicitly set --with-valgrind
d7838ba6a Merge #813: Enable configuring Valgrind support
7ceb0b761 Merge #819: Enable -Wundef warning
8b7dcdd95 Add exhaustive test for extrakeys and schnorrsig
08d7d8929 Make pubkey parsing test whether points are in the correct subgroup
87af00b51 Abstract out challenge computation in schnorrsig
63e1b2aa7 Disable output buffering in tests_exhaustive.c
39f67dd07 Support splitting exhaustive tests across cores
e99b26fcd Give exhaustive_tests count and seed cmdline inputs
49e6630bc refactor: move RNG seeding to testrand
b110c106f Change exhaustive test groups so they have a point with X=1
cec7b18a3 Select exhaustive lambda in function of order
78f6cdfaa Make the curve B constant a secp256k1_fe
d7f39ae4b Delete gej_is_valid_var: unused outside tests
8bcd78cd7 Make secp256k1_scalar_b32 detect overflow in scalar_low
c498366e5 Move exhaustive tests for recovery to module
be3179154 Make group order purely compile-time in exhaustive tests
e73ff3092 Enable -Wundef warning
c0041b5cf Add static assertion that uint32_t is unsigned int or wider
4ad408faf Merge #782: Check if variable=yes instead of if var is set in travis.sh
412bf874d configure: Allow specifying --with[out]-valgrind explicitly
34debf7a6 Modify .travis.yml to explictly pass no in env vars instead of setting to nothing
a0e99fc12 Merge #814: tests: Initialize random group elements fully
5738e8622 tests: Initialize random group elements fully
c9939ba55 Merge #812: travis: run bench_schnorrsig
a51f2af62 travis: run bench_schnorrsig
ef37761fe Change travis.sh to check if variables are equal to yes instead of not-empty. Before this, setting `VALGRIND=wat` was considered as true, and to make it evaluate as false you had to unset the variable `VALGRIND=` but not it checks if `VALGRIND=yes` and if it's not `yes` then it's evaluated to false

git-subtree-dir: src/secp256k1
git-subtree-split: c6b6b8f1bb044d7d1aa065ebb674adde98a36a8e
2020-10-22 00:41:56 +01:00
Homu cafc622a22 Auto merge of #4757 - str4d:update-secp256k1, r=str4d
Update secp256k1

This migrates us to the same dependency version that upstream Bitcoin
Core migrated to in bitcoin/bitcoin#19944.

Also enables the endomorphism optimization now that the patents have
expired.
2020-10-21 16:55:47 +00:00
Jack Grigg d0cb0b74aa Switch from std::random_shuffle to std::shuffle
std::random_shuffle is removed in C++17; it is replaced by std::shuffle,
which was introduced in C++11. The new ZcashRandomEngine class provides
the Uniform Random Number Generator interface, as inferred from
std::random_device.
2020-10-20 13:58:23 +01:00
Jack Grigg 9d1a11a0e4 build: Require and build with C++ 17 2020-10-20 13:55:14 +01:00
Homu de5c28b4b7 Auto merge of #4613 - str4d:claaaaaang, r=daira
Pin Clang for all compilation

fixes #2513, fixes #4697, fixes #4698, fixes #4699. refs #4607, #4292
2020-10-20 11:15:47 +00:00
Homu 8fa19fd50d Auto merge of #4794 - LarryRuane:allow-getaddressutxos, r=daira
allow getaddressutxos if -lightwalletd

The wallets need to be able to retrieve, via lightwalletd, the UTXO set for a given address, see https://github.com/zcash/lightwalletd/issues/312. The `getaddressutxos` rpc that was added for Insight Explorer is perfect for this, but this rpc is disabled when only `-lightwalletd` is enabled (that is, it requires `-insightexplorer`, which is a superset of `-lightwalletd`). However, the `DB_ADDRESSUNSPENTINDEX` index that supports this rpc is present when only `-lightwalletd` is enabled. This was probably a (fortuitous, as it turns out) oversight. So all that's required is to allow this rpc when `-lightwalletd` is enabled.
2020-10-20 09:31:39 +00:00
Homu 0dc05a7722 Auto merge of #4790 - therealyingtong:add-addresses-getblocksubsidy, r=daira
Add funding stream addresses to getblocksubsidy RPC output

Closes #4728.
2020-10-20 08:18:01 +00:00
Homu 162de8b260 Auto merge of #4800 - daira:contextualchecktx-cleanups, r=str4d
Comment and error message cleanups for transaction checks

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-19 19:14:03 +00:00
Larry Ruane 083a05b04f allow getaddressutxos if -lightwalletd 2020-10-19 11:26:16 -06:00
therealyingtong 0940bc0c23 Remove void declaration of ScriptPubKeyToJSON() 2020-10-19 23:41:13 +08:00
Daira Hopwood 72a0107708 Comment and error message cleanups for transaction checks.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-19 14:56:59 +01:00
Daira Hopwood e0b3913356 Rename `time` to `duration` in `DisplayDuration`.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-19 12:05:47 +01:00
Daira Hopwood a6822edfd8 Fix integer types in DisplayDuration.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-19 11:51:55 +01:00
therealyingtong 6f3c29e9b7 Only return address instead of CScript 2020-10-19 10:04:19 +08:00
Daira Hopwood 7a1ed861c2 log(x)/log(2.0) can be written as log2(x).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-18 15:03:30 +01:00
ying tong e60c2bf17c
Apply suggestions from code review
Co-authored-by: Larry Ruane <larry@z.cash>
2020-10-17 13:27:38 +08:00
therealyingtong 4e50b700e9 Minor cleanups 2020-10-17 03:13:19 +08:00
therealyingtong 719c117f1c Handle shielded address case 2020-10-17 03:08:37 +08:00
therealyingtong 6c41d1da05 Fix CScript encoding 2020-10-17 02:35:39 +08:00
therealyingtong cec67e90c5 Add funding stream addresses to getblocksubsidy RPC output 2020-10-16 23:57:04 +08:00