Commit Graph

16807 Commits

Author SHA1 Message Date
furszy 8fb46c794e Rework Sprout and Sapling witnesses increment and cache workflow, so it does not loop over the entire wallet txs map indiscriminately.
From:
```
1) for-each tx in wallet : call CopyPreviousWitnesses.
2) for-each tx in block:
   a) for-each note in tx:
      a1) for-each tx in wallet : call AppendNoteCommitment.
      a2) if note is mine : call WitnessNoteIfMine.
3) for-each tx in wallet : call UpdateWitnessHeights.
```

To:

```
1) for-each tx in block:
   a) gather note commitments in vecComm.
   b) witness note if ours.
2) for-each shield tx in wallet:
   a) copy the previous witness.
   b) append vecComm notes commitment.
   c) Update witness last processed height.
```
2022-07-19 09:52:40 -06:00
furszy 54b55ebae6 Fix missing vector include and vector type definition 2022-07-19 07:22:24 -06:00
Kris Nuttycombe c1a18cab39
Merge pull request #6040 from nuttycom/test/persisted_sprout_chain
Add persistent test data to avoid needing to create new Sprout outputs in RPC tests.
2022-07-18 11:35:57 -06:00
Kris Nuttycombe 035a26b674 Replace setup_clean_chain with cache_behavior in rpc test init. 2022-07-18 09:00:34 -06:00
Kris Nuttycombe 6477c6165b Update getblocktemplate test to use persisted sprout chain 2022-07-18 09:00:34 -06:00
Kris Nuttycombe 91f62f4161 Update finalsaplingroot test to use persisted sprout chains. 2022-07-18 09:00:34 -06:00
Daira Hopwood dc7f3e74fb
Merge pull request #6084 from str4d/fix-connectblock-benchmarks
bench: Fix ConnectBlock large block benchmarks
2022-07-18 15:27:57 +01:00
Jack Grigg bd17ae588a bench: Fix ConnectBlock large block benchmarks
`zcbenchmark` internally loops within the same process to run the same
benchmark multiple times. This meant it was being caught up in the
global validity cache, giving faster results for every iteration except
the first. This was not noticeable for the historic slow transparent
block, but became noticeable once we started caching Sapling and Orchard
bundle validity in zcash/zcash#6073.

As the intention of the benchmarks is to measure the worst case where
the block in question has not had any of its transactions observed
before (as is the case for IBD), we now disable cache storage if calling
`ConnectBlock` from a slow block benchmark.
2022-07-16 14:04:03 +00:00
Wladimir J. van der Laan e657d91020 build: CRC32C build system integration
(cherry picked from commit bitcoin/bitcoin@9ebdf04757)
2022-07-16 11:47:21 +00:00
Wladimir J. van der Laan 49deefbc9d test: Add crc32c exception to various linters and generation scripts
(cherry picked from commit bitcoin/bitcoin@3a037d0067)

Zcash:
- Excludes linters and scripts we don't have.
- Re-adds leveldb to lint-includes.sh because of a false positive.
2022-07-16 11:47:21 +00:00
Wladimir J. van der Laan 6dcb678f3f test: Add crc32c to subtree check linter
(cherry picked from commit bitcoin/bitcoin@84ff1b2076)

Zcash: Excluding CI script change.
2022-07-16 12:02:08 +01:00
Wladimir J. van der Laan f0d57e8948 doc: Add crc32c subtree to developer notes
(cherry picked from commit bitcoin/bitcoin@7cf13a5134)
2022-07-16 12:01:22 +01:00
Wladimir J. van der Laan d39fac9931 build: Update build system for new leveldb
Upstream leveldb switched build systems, which means we need to define
a few different values.

(cherry picked from commit bitcoin/bitcoin@24d02a9ac0)
2022-07-16 11:59:09 +01:00
Wladimir J. van der Laan e46f243348 Import crc32c using subtree merge as as 'src/crc32c' 2022-07-16 11:50:42 +01:00
Jack Grigg ab0d4aace5 Squashed 'src/crc32c/' content from commit 224988680f
git-subtree-dir: src/crc32c
git-subtree-split: 224988680f7673cd7c769963d4035cb315aa3388
2022-07-16 11:49:57 +01:00
Wladimir J. van der Laan 8471b136fe Update to leveldb upstream using subtree merge
Zcash: Removes our C++17 change and a static assert we added, as the
modified files were removed upstream.
2022-07-16 11:47:36 +01:00
Jack Grigg 8cdc10be0c Squashed 'src/leveldb/' changes from f545dfabff..f8ae182c1e
f8ae182c1e Adds unicode support to Windows environment.
92ae82c78f Increase maximum read-only mmap()s used from 1000 to 4096 on 64-bit systems
d42e63d49d Do not crash if filesystem can't fsync
bf2c2090b7 Add filename to corruption errors
0c40829872 Remove redundant PROJECT_SOURCE_DIR usage from CMake config.
5abdf4c019 Fix installed target definition.
cf4d9ab23d Test CMake installation on Travis.
95d0ba1cb0 Renamed local variable in DBImpl::Write.
657ba51429 Added return in Version::Get::State::Match to quiet warning.
370d532a00 Using CMake's check_cxx_compiler_flag to check support for -Wthread-safety.
45ee61579c Update Travis CI configuration.
60db170a43 Fix tsan problem in env_test.
21304d41f7 Merge pull request #698 from neal-zhu:master
5e921896ee drop fileds in State that are duplicates of fileds in Saver and fix typo
53e280b568 Simplify unlocking in DeleteObsoleteFiles.
046216a7ca Add "leveldb" subdirectory to public include paths.
9ee91ac747 Ending sentences with periods in README.md.
e0d5f83a4f Align EnvPosix and EnvWindows.
69061b464a Disable exceptions and RTTI in CMake configuration.
107a75b62c cache Saver in State object
76ca116276 fix bug(uninitialized options pointer in State)
f668239bb2 remove TODO in Version::ForEachOverlapping
177cd08629 format
8fa7a937ee fix bug
6a90bb91ee use ForEachOverlapping to impl Get
4cb80b7ddc Merge pull request #386 from ivanabc:master
72a38ff7f2 Replace "> >" with ">>"
863f185970 unsigned char -> uint8_t
a3b71c1ff6 Use GCC 9 on Travis CI
ae49533210 Add explicit typecasts to avoid compiler warning.
63d5315e1c Merge branch 'master' into master
c00e177f36 Guard DBImpl::versions_ by mutex_.
1d0b101165 Converted two for-loops to while-loops.
28e6d238be Switch to using C++ 11 override specifier.
85cd40d108 Added unit test for InternalKey::DecodeFrom with empty string.
1aae5c9f29 Merge pull request #411 from proller:assert1
b7b86baec9 Using std::ostringstream in key DebugString.
3e6c000e18 Merge pull request #457 from jellor:patch-2
1d94fe2f4d Merge branch 'master' into patch-2
27dc99fb26 Fix EnvPosix tests on Travis CI.
9521545b06 Formatting changes for prior O_CLOEXEC fix.
900f7d37eb Merge pull request #624 from adam-azarchs:master
a7528a5d2b Clean up util/coding.{h,cc}.
142035edd4 Initialize Stats::start_ before first use in Stats::Start().
e22b1cec6e Merge pull request #365 from allangj:c-strict-prototypes
cd1ec032cd Add argument definition for void c functions.
4bd052d7e8 Consolidate benchmark code to benchmarks/.
506b1722ef Convert missed virtual -> override in db_test.cc.
24424a1ef2 Style cleanup.
9a56c49ed4 Merge pull request #679 from smartxworks:optimize-readseq
abf441b657 Merge pull request #278 from wankai:master
78b39d68c1 Bump the version number from 1.21 to 1.22.
9bd23c7676 Correct class/structure declaration order.
c784d63b93 Moved port/README to port/README.md.
297e66afc1 Format all files IAW the Google C++ Style Guide.
3724030179 Update Travis CI configuration.
d3d1c8a0f4 don't check current key in DBIter::Next()
3dc9202f78 [leveldb] Specifically export the WriteBatch::Handler inner class for Windows link
2ccb45c33a Check for possibly invalid offset in test.
7b11745190 Changed Windows specific highlighting from bash to cmd.
2f008ac19e Initialize class members to default values in constructors.
ffabb1ae86 Merge pull request #665 from cheng-chang:coding
7da571cf2b Merge pull request #669 from pavel-pimenov:fix-readme-windows-mkdir
df4a323aaf Merge pull request #472 from zhoudayang:patch-1
5a2a472741 Fixed missing std namespaces and make_unique.
08e771901f Simplify issue320_test.
65e86f75ea Fix formatting of recent snapshot compaction fix.
7711e76766 Merge pull request #339 from richcole-at-amazon:master
71ed7c401e Fixed typo in comment in version_set.h.
09fa8868db Align version/soversion CMake setup closer with other repositories.
20fb601aa9 Fix snapshot compaction bug
37300aa54b Restore soname versioning with CMake build
952be04df6 Fix mkdir (windows)
56178ddaf4 Update the version to 1.21 in preparation for a new release.
35619d248d Project import generated by Copybara.
416344de2f leveldb: Register in copybara whitelist.
da94ac67e9 leveldb: Minor cleanup in ports.
bd24b96306 leveldb: Silence unused argument warnings in MSVC.
6188a54ce9 leveldb: Add tests for empty keys and values.
cf1b5f4732 Remove unnecessary bit operation.
7035af5fc3 Two small fixes for the Windows implementation (#661)
6571279d6d fix a typo in the comment of skiplist_test.cc (#664)
15e2278966 Use override consistently in leveldb::test::ErrorEnv.
ea49b27d06 Switch corruption_test to use InMemEnv.
ce399ac28a Always copy bytes to scratch buffer when reading w/MemEnv.
201f77d137 Inline defaults in options.
9ce30510d4 Deleted dangling reference to deleted atomic_pointer.h.
7d8e41e49b leveldb: Replace AtomicPointer with std::atomic.
dd906262fd Make InMemoryEnv more consistent with filesystem based Env's.
cf1d1ab255 leveldb: Remove unused file port/win/stdint.h.
a20508dc6a Fix typo (#565)
04470825ac Add AppVeyor (Windows CI) badge to README.
ed76289b25 Align windows_logger with posix_logger.
808e59ec6a Improve CI configuration.
c69d33b0ec Added native support for Windows.
75fceae700 Add O_CLOEXEC to open calls.
fe4494804f leveldb: Make WriteBatch::ApproximateSize() const.
296de8d5b8 leveldb: Fix PosixWritableFile::Sync() on Apple systems.
b70493ca85 Fix fdatasync() feature detection in opensource build.
af7abf06ea Add back space to POSIX Logger.
58d70545af Update Travis CI configuration.
1cb3840881 Clean up env_posix.cc.
a7dc502e9f Rework once initialization in env_posix.cc.
c43565dd39 C++11 cleanup for util/mutexlock.h.
0145a94ab6 Update .gitignore.
73d5834ece Rework threading in env_posix.cc.
05709fb43e Remove InitOnce from the port API.
bb88f25115 Clean up PosixWritableFile in env_posix.cc.
7b945f2003 Clean up posix_logger.h.
89af27bde5 Remove ssize_t from code that is not POSIX-specific.
03064cbbb2 Simplify Limiter in env_posix.cc.
9b44da73d9 Clarify comments for leveldb::Env file reading methods.
0ef2310f67 Remove GCC on OSX from the Travis CI matrix.
16a2b8bb3a Expose WriteBatch::Append in the C API.
f7b0e1d901 Expose WriteBatch::Append().
6caf73ad9d Clean up Iterator.
6a6bdafcf1 Corrected typo in docs: "cache" to "block_cache".
1868398150 Clean up SnapshotImpl.
e7840de9f3 Fix documentation for log file growth.
bc23e00f95 Update default log file size in doc.
4de9594f6f Add move constructor to Status.
d177a0263c Replace port_posix with port_stdcxx.
14cce848e7 Fix sign mismatch warnings in GCC.
8046a51b21 Add forgotten <limits> header to util/logging.cc.
a0008deb67 Reimplement ConsumeDecimalNumber.
1f7dd5d5f6 Add tests for ConsumeDecimalNumber.
1cc8b10b82 Document the building process.
09217fd067 Replace NULL with nullptr in C++ files.
6a3b915166 Remove PLATFORM_IS_LITTLE_ENDIAN from port/posix.h.
260655b4c2 Define LEVELDB_HAS_PORT_CONFIG_H for old compilers.
6fa4566670 Rename CMake project / targets from Leveldb to leveldb.
0db30413a4 leveldb: Add more thread safety annotations.
04f39105c5 Take <atomic> for granted in port/atomic_pointer.h.
74f032ff6f leveldb: Require C++11.
8e75db8623 Remove build configuration for make.
df9a841a4f Add export.h to CMakeLists.txt
50fbc87e8c Replace SIZE_MAX with std::numeric_limits.
739c25100e Add CMake build support.
0fa5a4f7b1 Extend thread safety annotations.
8143c12f3f Fix includes in util/testharness.h.
aece2068d7 Remove extern from function declarations.
ddab751002 Add tests for {Old}InfoLogFileName().
7fd7c00721 Remove unused function ExtractValueType.
594cc987af Bypass OSMemoryBarrier() warning on Mac.
49f35d3fc9 leveldb: Update Travis CI configuration for open source build.
623d014a54 Expose Env::GetTempDirectory() for use in C test.
8c8024ea33 Switch HAVE_ library detection macros to 0/1.
41172a2401 Enable thread safety annotations in open source version.
47cb9e2a21 Add leveldb_options_set_max_file_size to the C API.
b5d4a22e64 Fixed style guide link in CONTRIBUTING.md
3da4d8b989 Deleted unused assignments in Reader.
0509414f85 leveldb::DestroyDB will now delete empty directories.
23162ca1c6 Fix typo (forgotten reference operator) in test.
5c39524f36 Replace SSE-optimized CRC32C in POSIX port with external library.
ca216e493f leveldb: Rename SNAPPY to HAVE_SNAPPY.
25767d066c leveldb: Remove *_unlocked feature detection from POSIX port.
4a7e7f50dc Add LEVELDB_EXPORT macro to export public symbols.
542590d2a8 leveldb: Include <algorithm> in util/env_test.cc.
8ae7998aab Fix FD leak in POSIX Env.
d9a9e02edf leveldb: Add tests for CL 170769101.
4447f9cace Remove handling for unused LRUHandle representation special case.
2372ac574f Fix file writing bug in CL 170738066.
1c75e88055 Fix use of uninitialized value in LRUHandle.
7e12c00ecf Fix issue 474: a race between the f*_unlocked() STDIO calls in env_posix.cc and concurrent application calls to fflush(NULL).
bcd9a8ea4a Use portable CRC32C from google/crc32c.
ea0a7586b8 Remove confusing and unnecessary if.
141e767135 Simplify Table::Open() flow and remove a delete call.
09a3c8e741 Switched variable type from int to uint64_t in ConsumeDecimalNumber.
2964b803b8 leveldb: Fix alignment code in SSE4.2-optimized CRC32C.
02f43c0fcd Remove dead code.
0b402e96a7 Use __APPLE__ instead of OS_MACOS. The former is compiler-provided.
8415f00eee leveldb: Report missing CURRENT manifest file as database corruption.
69e2bd224b LevelDB: Add WriteBatch::ApproximateSize().
471f0b84ec fix comment
5b817400a0 fix comment
7d060117fa broken db: fix assertion in leveldb::InternalKey::Encode, mark base as corrupt
2883fcd849 set const property
e5f0a51fa4 reduce lock's range in DeleteObsoleteFiles
dd598676cd block_builder header file dependency fixed
REVERT: f545dfabff Merge #18: Use utf-8 to decode filename
REVERT: f8e797a058 Use utf-8 to decode filename
REVERT: 2fc114812a Merge #14: Fixes to allow building with msvc.
REVERT: 524b7e36a8 Merge #19: Increase maximum read-only mmap()s used from 1000 to 4096 on 64-bit systems
REVERT: 4874cb8d3e Increase maximum number of read-only mmap()s used from 1000 to 4096 on 64 bit systems.
REVERT: 64052c76c5 Merge #15: Add filename to corruption errors
REVERT: 135ed0fb4e Add filename to corruption errors
REVERT: d6eab93138 Fixes to allow building with msvc.
REVERT: c521b3ac65 Merge #11: fixup define checks. Cleans up some oopses from #5.
REVERT: 8b1cd3753b fixup define checks. Cleans up some oopses from #5.
REVERT: 6b1508d6d5 Merge #6: Fixes typo
REVERT: fceb805426 Merge #10: Clean up compile-time warnings (gcc 7.1)
REVERT: 0ec2a343f3 Clean up compile-time warnings (gcc 7.1)
REVERT: d4c268a357 Merge #5: Move helper functions out of sse4.2 object
REVERT: 8d4eb08470 Add HasAcceleratedCRC32C to port_win.h
REVERT: 77cfbfd250 crc32: move helper functions out of port_posix_sse.cc
REVERT: 4c1e9e0168 silence compiler warnings about uninitialized variables
REVERT: 4953164851 Merge #2: Prefer std::atomic over MemoryBarrier
REVERT: 2953978ef8 Fixes typo
REVERT: f134284a1c Merge #1: Merge upstream LevelDB 1.20
REVERT: 196962ff01 Add AcceleratedCRC32C to port_win.h
REVERT: ba8a445fda Prefer std::atomic over MemoryBarrier
REVERT: 1bdf1c34c5 Merge upstream LevelDB v1.20
REVERT: d31721eb0a Merge #17: Fixed file sharing errors
REVERT: fecd449021 Fixed file sharing error in Win32Env::GetFileSize(), Win32SequentialFile::_Init(), Win32RandomAccessFile::_Init() Fixed error checking in Win32SequentialFile::_Init()
REVERT: 5b7510f1b7 Merge #14: Merge upstream LevelDB 1.19
REVERT: 0d969fd570 Merge #16: [LevelDB] Do no crash if filesystem can't fsync
REVERT: c8c029b5b5 [LevelDB] Do no crash if filesystem can't fsync
REVERT: a31c8aa408 Add NewAppendableFile for win32 environment
REVERT: d40bc3fa5a Merge #13: Typo
REVERT: ebbd772d33 Typo
REVERT: 1913d718ef Merge upstream LevelDB 1.19
REVERT: 20ca81f08f Merge pull request #9
REVERT: 7aa105e1a3 leveldb: Win32WritableFile without memory mapping
REVERT: 7d41e6f89f Merge upstream LevelDB 1.18
REVERT: 42dcc7edfc Merge upstream LevelDB 1.17.
REVERT: e991315d7f Merge upstream LevelDB 1.15.
REVERT: 02ac9f170b Merge upstream LevelDB 1.14.
REVERT: 936b4613ea Merge upstream LevelDB 1.13.
REVERT: be1b0ff1fc On Mac OS X fsync does not guarantee write to disk. Use fcntl F_FULLFSYNC instead.
REVERT: a02ddf9b14 Added GNU/kFreeBSD kernel name (TARGET_OS)
REVERT: 848746862c CondVar::SignalAll was broken, leading to deadlocks on Windows builds. http://code.google.com/p/leveldb/issues/detail?id=149
REVERT: f6d84d1baf Allow files to be opened for reading multiple times
REVERT: cb8e3f7adf Checking whether closing succeeds
REVERT: d5317e8eda Print actual Win32 error that occurred on file creation failure.
REVERT: 907f308499 Port leveldb to MinGW32
REVERT: 9def2bfbf1 Mingw support for Windows LevelDB port
REVERT: 0a7b0748c7 Pre-Vista leveldb::port::InitOnce implementation
REVERT: 31a2b09985 Native Windows LevelDB port
REVERT: 058a0357cd Remove Snappy support

git-subtree-dir: src/leveldb
git-subtree-split: f8ae182c1e5176d12e816fb2217ae33a5472fdd7
2022-07-16 11:45:42 +01:00
Pieter Wuille c4e9e1c134 Avoid non-trivial global constants in SHA-NI code
Zcash: Also includes unused include cleanup from bitcoin/bitcoin#16659.

(cherry picked from commit bitcoin/bitcoin@8508473094)
2022-07-16 10:21:52 +00:00
Luke Dashjr b88687b35c configure: Initialise assembly enable_* variables
(cherry picked from commit bitcoin/bitcoin@4207c1b35c)
2022-07-16 10:13:26 +00:00
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