Luke Dashjr
7a4f0b6f76
configure: Skip assembly support checks, when assembly is disabled
...
(cherry picked from commit bitcoin/bitcoin@afe0875577 )
2022-07-16 10:13:26 +00:00
Luke Dashjr
80a3174354
configure: Invert --enable-asm help string since default is now enabled
...
(cherry picked from commit bitcoin/bitcoin@d8ab8dc12d )
2022-07-16 10:13:26 +00:00
Chun Kuan Lee
dccce97efc
Use __cpuid_count for gnu C to avoid gitian build fail.
...
(cherry picked from commit bitcoin/bitcoin@63c16ed507 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
ece6a37698
Use immintrin.h everywhere for intrinsics
...
(cherry picked from commit bitcoin/bitcoin@66b2cf1ccf )
2022-07-16 10:13:26 +00:00
Pieter Wuille
3dd25777f4
Add SHA256 implementation using using Intel SHA intrinsics
...
(cherry picked from commit bitcoin/bitcoin@4c935e2eee )
2022-07-16 10:13:26 +00:00
Pieter Wuille
f87cbe3341
[Refactor] CPU feature detection logic for SHA256
...
(cherry picked from commit bitcoin/bitcoin@268400d318 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
dd44cde8ac
For AVX2 code, also check for AVX, XSAVE, and OS support
...
(cherry picked from commit bitcoin/bitcoin@32d153fa36 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
a86a50fb88
Improve coverage of SHA256 SelfTest code
...
(cherry picked from commit bitcoin/bitcoin@1e1eb6367f )
2022-07-16 10:13:26 +00:00
Pieter Wuille
f78a601898
Enable double-SHA256-for-64-byte code on 32-bit x86
...
(cherry picked from commit bitcoin/bitcoin@57ba401abc )
2022-07-16 10:13:26 +00:00
Pieter Wuille
6fc711d0d5
[MOVEONLY] Move unused Merkle branch code to tests
...
Zcash: Also includes some minor changes from scripted diffs that
occurred between backported PRs.
(cherry picked from commit bitcoin/bitcoin@4defdfab94 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
ae3dc3f134
8-way AVX2 implementation for double SHA256 on 64-byte inputs
...
(cherry picked from commit bitcoin/bitcoin@4437d6e1f3 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
25dc154eef
4-way SSE4.1 implementation for double SHA256 on 64-byte inputs
...
(cherry picked from commit bitcoin/bitcoin@230294bf5f )
2022-07-16 10:13:26 +00:00
Pieter Wuille
3a75a55573
Use SHA256D64 in Merkle root computation
...
Zcash: Excluding change to `BlockWitnessMerkleRoot` as we don't have
SegWit (deploying non-malleable txs via ZIP 244 instead).
(cherry picked from commit bitcoin/bitcoin@1f0e7ca09c )
2022-07-16 10:13:26 +00:00
Pieter Wuille
fb70e9286a
Specialized double sha256 for 64 byte inputs
...
Zcash: Commented out second BENCHMARK argument as we haven't backported
the benchmark refactor that adds it.
(cherry picked from commit bitcoin/bitcoin@d0c9632883 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
c7631651e5
Refactor SHA256 code
...
(cherry picked from commit bitcoin/bitcoin@57f34630fb )
2022-07-16 10:13:26 +00:00
Pieter Wuille
93e2b632e6
Benchmark Merkle root computation
...
Zcash: Commented out second BENCHMARK argument as we haven't backported
the benchmark refactor that adds it.
(cherry picked from commit bitcoin/bitcoin@0df017889b )
2022-07-16 10:13:26 +00:00
Wladimir J. van der Laan
eea55eedbe
build: Mention use of asm in summary
...
(cherry picked from commit bitcoin/bitcoin@538cc0ca8b )
2022-07-16 10:13:26 +00:00
Wladimir J. van der Laan
22b28e2e30
build: Rename --enable-experimental-asm to --enable-asm and enable by default
...
Now that 0.15 is branched off, enable assembler SHA256 optimizations by default.
(cherry picked from commit bitcoin/bitcoin@ce5381e7fe )
2022-07-16 10:13:26 +00:00
Cory Fields
32bd3908dd
build: always attempt to enable targeted sse42 cxxflags
...
This avoids a counter-intuitive drop in performance when manually adjusting the
flags.
(cherry picked from commit bitcoin/bitcoin@9baca41985 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
7b93eb28fa
Protect SSE4 code behind a compile-time flag
...
(cherry picked from commit bitcoin/bitcoin@6b8d872e5e )
2022-07-16 10:13:26 +00:00
Pieter Wuille
b16c6bf897
Add selftest for SHA256 transform
...
(cherry picked from commit bitcoin/bitcoin@fa9be909c9 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
c9b583bc0d
Add SSE4 based SHA256
...
(cherry picked from commit bitcoin/bitcoin@c1ccb15b0e )
2022-07-16 10:13:26 +00:00
Pieter Wuille
2d1e63c45a
Add SHA256 dispatcher
...
(cherry picked from commit bitcoin/bitcoin@2991c91d88 )
2022-07-16 10:13:26 +00:00
Pieter Wuille
1e7d105b3f
Support multi-block SHA256 transforms
...
Extracted from a patch by Wladimir van der Laan.
(cherry picked from commit bitcoin/bitcoin@4d50f38fe0 )
2022-07-16 10:13:26 +00:00
str4d
3213527141
Merge pull request #6079 from str4d/fastrandom-backports
...
Use FastRandomContext for all tests
2022-07-16 11:09:47 +01:00
Pieter Wuille
101d19fe17
scripted-diff: Use new naming style for insecure_rand* functions
...
-BEGIN VERIFY SCRIPT-
sed -i 's/\<insecure_randbits(/InsecureRandBits(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randbool(/InsecureRandBool(/g' src/test/*.cpp src/test/*.h src/gtest/*.cpp src/wallet/test/*.cpp
sed -i 's/\<insecure_randrange(/InsecureRandRange(/g' src/test/*.cpp src/test/*.h src/gtest/*.cpp src/wallet/test/*.cpp
sed -i 's/\<insecure_randbytes(/InsecureRandBytes(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand256(/InsecureRand256(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand(/InsecureRand32(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<seed_insecure_rand(/SeedInsecureRand(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
-END VERIFY SCRIPT-
(cherry picked from commit bitcoin/bitcoin@e945848582 )
2022-07-15 22:10:23 +00:00
Pieter Wuille
3e6b2edc74
scripted-diff: Use randbits/bool instead of randrange where possible
...
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_randbits(1)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(2)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(2)/insecure_randbool()/g' src/gtest/test_*.cpp
sed -i 's/insecure_randrange(4)/insecure_randbits(2)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(32)/insecure_randbits(5)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(256)/insecure_randbits(8)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
Zcash: Added gtests to script.
(cherry picked from commit bitcoin/bitcoin@2fcd9cc86b )
2022-07-15 22:10:23 +00:00
Pieter Wuille
008fb745c5
Use randbits instead of ad-hoc emulation in prevector tests
...
(cherry picked from commit bitcoin/bitcoin@2ada678521 )
2022-07-15 22:10:23 +00:00
Pieter Wuille
722d1c4c64
Replace rand() & ((1 << N) - 1) with randbits(N)
...
Zcash: Excluding changes to tests we don't have.
(cherry picked from commit bitcoin/bitcoin@5f0b04eedc )
2022-07-15 22:10:23 +00:00
Pieter Wuille
05c60b2b7e
Replace more rand() % NUM by randranges
...
Zcash: Excluding changes to tests we don't have.
(cherry picked from commit bitcoin/bitcoin@3ecabae363 )
2022-07-15 22:10:23 +00:00
Pieter Wuille
5a1c450496
scripted-diff: use insecure_rand256/randrange more
...
-BEGIN VERIFY SCRIPT-
sed -i "s/\<GetRandHash(/insecure_rand256(/" src/test/*_tests.cpp
sed -i "s/\<GetRand(/insecure_randrange(/" src/test/*_tests.cpp src/test/test_bitcoin.cpp
sed -i 's/\<insecure_rand() % \([0-9]\+\)/insecure_randrange(\1)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
Zcash: Excludes changes to files we don't have.
(cherry picked from commit bitcoin/bitcoin@efee1db21a )
2022-07-15 22:10:23 +00:00
Pieter Wuille
eab53622f4
Add various insecure_rand wrappers for tests
...
(cherry picked from commit bitcoin/bitcoin@1119927df0 )
2022-07-15 22:10:23 +00:00
Pieter Wuille
f7a23218d1
Merge test_random.h into test_bitcoin.h
...
Zcash: Excludes changes to files we don't have, and removes the
duplicate definitions in `src/gtest/utils.h`.
(cherry picked from commit bitcoin/bitcoin@124d13a58c )
2022-07-15 22:10:23 +00:00
Pieter Wuille
0ef7ce2c61
scripted-diff: Rename cuckoo tests' local rand context
...
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_rand/local_rand_ctx/g' src/test/cuckoocache_tests.cpp
-END VERIFY SCRIPT-
(cherry picked from commit bitcoin/bitcoin@90620d66c9 )
2022-07-15 22:10:23 +00:00
Pieter Wuille
c9a9691a2f
Add FastRandomContext::rand256() and ::randbytes()
...
FastRandomContext now provides all functionality that the real Rand* functions
provide.
(cherry picked from commit bitcoin/bitcoin@37e864eb9f )
2022-07-15 22:10:23 +00:00
Kris Nuttycombe
420f8dfe38
Merge pull request #6078 from nuttycom/bug/osx_missing_chrono_header
...
Add missing <chrono> header to util/time.h
2022-07-15 14:05:27 -06:00
Kris Nuttycombe
33d2dce183
Add missing <chrono> header to util/time.h
2022-07-15 12:54:37 -06:00
Kris Nuttycombe
95bbfd09aa
Update feature_zip239 test to use persisted sprout chains.
2022-07-15 08:23:57 -06:00
Kris Nuttycombe
b2fc56c24a
Update sprout_sapling_migration test to use persisted sprout chains.
2022-07-15 08:23:57 -06:00
Kris Nuttycombe
afea5c386d
Add RPC test initialization using the persisted Sprout chains.
2022-07-15 08:23:57 -06:00
Kris Nuttycombe
532017e74e
Remove the temporary test that was used for setup of the cached Sprout fixtures.
2022-07-15 08:23:57 -06:00
Kris Nuttycombe
5d44ce318e
Add persistent Sprout test data.
...
This is in preparation for removing the ability to generate
Sprout outputs from z_shieldcoinbase. Once that is complete,
we will no longer be able to use `z_shieldcoinbase` for test
setup for uses of Sprout funds; instead, the persisted blockchain
state created in this commit will be used for tests that require
the use of Sprout funds.
This brings the test framework into line with how Sprout funds
are now used on mainnet and testnet; existing Sprout funds may
be spent, and Sprout change may be created, but no funds may
be transfered into the Sprout pool, since the activation of
ZIP 211.
2022-07-15 08:23:57 -06:00
Kris Nuttycombe
40df3d402e
Merge pull request #6042 from nuttycom/feature/clock_capability
...
Add a clock for testing with an offset from the system clock.
2022-07-15 08:23:23 -06:00
Kris Nuttycombe
0a4f3a3df0
Apply suggestions from code review
...
Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-07-14 19:59:52 -06:00
str4d
0260b7e40b
Merge pull request #6073 from str4d/cache-proof-and-sig-validity
...
Cache Sapling and Orchard bundle validation
2022-07-15 01:34:27 +01:00
str4d
4689c59f3e
Improve bundlecache documentation
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-07-15 00:22:31 +01:00
Kris Nuttycombe
e7922af588
Add a clock for testing with an offset from the system clock.
...
This change improves clock management for zcashd by ensuring
that all clock methods (obtaining seconds, milliseconds, and
microseconds since the epoch) agree under testing conditions
using `-mocktime`, and also adds a feature that allows tests
to specify an offset to the system clock; this is useful to
allow comprehensive testing of the "timejacking attack mitigation"
consensus rules.
2022-07-14 16:33:54 -06:00
Jack Grigg
ebb37770a8
Move explicit instantiations for `BundleValidityCache` into `zcash/cache.cpp`
...
Also cleans them up a bit using the typedef.
2022-07-14 19:35:50 +00:00
str4d
e75213ff65
Merge pull request #6069 from str4d/prune-witnesses-for-definitely-spent-notes
...
wallet: Prune witnesses for notes spent more than 100 blocks ago
2022-07-14 20:19:49 +01:00
Kris Nuttycombe
aa6dbba5d2
Merge pull request #6074 from nuttycom/NO_zmq
...
Update documentation to refer to the actual two-hyphen `--nozmq` flag
2022-07-14 13:13:03 -06:00