Commit Graph

26 Commits

Author SHA1 Message Date
fanquake 24d5cf9314
Merge bitcoin/bitcoin#27425: test: move remaining rand code from util/setup_common to util/random
1cd45d4e08 test: move random.h include header from setup_common.h to cpp (Jon Atack)
1b246fdd14 test: move remaining random test util code from setup_common to random (jonatack)

Pull request description:

  and drop the `util/random` dependency on `util/setup_common`.  This improves code separation and allows `util/setup_common` to call `util/random` functions without creating a circular dependency, thereby addressing https://github.com/bitcoin/bitcoin/pull/26940#issuecomment-1497266140 by glozow (thanks!)

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 1cd45d4e08 🌂

Tree-SHA512: 6ce63d9103ba9b04eebbd8ad02fe9aa79e356296533404034a1ae88e9b7ca0bc9a5c51fd754b71cf4e7b55b18bcd4d5474b2d588edee3851e3b3ce0e4d309a93
2023-07-19 10:26:11 +01:00
MarcoFalke fa086248e5
test: Use same timeout for all index sync 2023-06-28 12:45:36 +02:00
jonatack 1b246fdd14 test: move remaining random test util code from setup_common to random
and drop the util/random dependency on util/setup_common.

This improves code separation and avoids creating a circular dependency if
setup_common needs to call the util/random functions.
2023-06-14 08:28:33 -06:00
Martin Leitner-Ankerl b8401c3281 Add pool based memory resource & allocator
A memory resource similar to std::pmr::unsynchronized_pool_resource, but
optimized for node-based containers.

Co-Authored-By: Pieter Wuille <pieter@wuille.net>
2023-03-23 19:38:38 +01:00
Andrew Chow a245429d68
Merge bitcoin/bitcoin#26940: test: create random and coins utils, add amount helper, dedupe add_coin
4275195606 De-duplicate add_coin methods to a test util helper (Jon Atack)
9d92c3d7f4 Create InsecureRandMoneyAmount() test util helper (Jon Atack)
81f5ade2a3 Move random test util code from setup_common to random (Jon Atack)

Pull request description:

  - Move random test utilities from `setup_common` to a new `random` file, as many tests don't use this code.

  - Create a helper to generate semi-random CAmounts up to `MONEY_RANGE` rather than only uint32, and use the helper in the unit tests.

  - De-duplicate a shared `add_coin` method by extracting it to a `coins` test utility.

ACKs for top commit:
  pinheadmz:
    ACK 4275195606
  achow101:
    ACK 4275195606
  john-moffett:
    ACK 4275195606

Tree-SHA512: 3ed974251149c7417f935ef2f8865aa0dcc33b281b47522b0f96f1979dff94bb8527957f098fe4d210f40d715c00f29512f2ffe189097102229023b7284a3a27
2023-02-17 17:28:14 -05:00
fanquake 1e0198b6c1
Merge bitcoin/bitcoin#26153: Reduce wasted pseudorandom bytes in ChaCha20 + various improvements
511aa4f1c7 Add unit test for ChaCha20's new caching (Pieter Wuille)
fb243d25f7 Improve test vectors for ChaCha20 (Pieter Wuille)
93aee8bbda Inline ChaCha20 32-byte specific constants (Pieter Wuille)
62ec713961 Only support 32-byte keys in ChaCha20{,Aligned} (Pieter Wuille)
f21994a02e Use ChaCha20Aligned in MuHash3072 code (Pieter Wuille)
5d16f75763 Use ChaCha20 caching in FastRandomContext (Pieter Wuille)
38eaece67b Add fuzz test for testing that ChaCha20 works as a stream (Pieter Wuille)
5f05b27841 Add xoroshiro128++ PRNG (Martin Leitner-Ankerl)
12ff72476a Make unrestricted ChaCha20 cipher not waste keystream bytes (Pieter Wuille)
6babf40213 Rename ChaCha20::Seek -> Seek64 to clarify multiple of 64 (Pieter Wuille)
e37bcaa0a6 Split ChaCha20 into aligned/unaligned variants (Pieter Wuille)

Pull request description:

  This is an alternative to #25354 (by my benchmarking, somewhat faster), subsumes #25712, and adds additional test vectors.

  It separates the multiple-of-64-bytes-only "core" logic (which becomes simpler) from a layer around which performs caching/slicing to support arbitrary byte amounts. Both have their uses (in particular, the MuHash3072 code can benefit from multiple-of-64-bytes assumptions), plus the separation results in more readable code. Also, since FastRandomContext effectively had its own (more naive) caching on top of ChaCha20, that can be dropped in favor of ChaCha20's new built-in caching.

  I thought about rebasing #25712 on top of this, but the changes before are fairly extensive, so redid it instead.

ACKs for top commit:
  ajtowns:
    ut reACK 511aa4f1c7
  dhruv:
    tACK crACK 511aa4f1c7

Tree-SHA512: 3aa80971322a93e780c75a8d35bd39da3a9ea570fbae4491eaf0c45242f5f670a24a592c50ad870d5fd09b9f88ec06e274e8aa3cefd9561d623c63f7198cf2c7
2023-02-15 14:58:47 +00:00
Jon Atack 4275195606 De-duplicate add_coin methods to a test util helper 2023-02-09 15:03:36 -08:00
Jon Atack 81f5ade2a3 Move random test util code from setup_common to random
as many of the unit tests don't use this code
2023-02-06 12:26:04 -08:00
Martin Leitner-Ankerl 5f05b27841 Add xoroshiro128++ PRNG
Xoroshiro128++ is a fast non-cryptographic random generator.
Reference implementation is available at https://prng.di.unimi.it/

Co-Authored-By: Pieter Wuille <pieter@wuille.net>
2023-01-30 18:12:21 -05:00
Hennadii Stepanov 7a820cee0e
test, build: Separate `read_json` function into its own module 2023-01-27 09:26:29 +00:00
furszy ee7a984f85
refactor: unify test/util/wallet.h with wallet/test/util.h
files share the same purpose, and we shouldn't have wallet code
inside the test directory.

This later is needed to use wallet util functions in the bench
and test binaries without be forced to duplicate them.
2022-11-21 17:30:00 -03:00
MacroFake fad7f2239c
test: Remove unused txmempool include from tests 2022-10-18 14:02:09 +02:00
fanquake 4b656b9ed3
build: remove unused libevent cppflags 2022-09-15 09:30:26 +01:00
fanquake afce044bb6
build: remove unused natpmp / upnp cppflags
Their inclusion is likely just the result of copy-paste.

The only place upnp/natpmpflags  should be used is `libbitcoin_node`
(mapport.cpp).
2022-09-15 09:30:26 +01:00
fanquake 12de8f6262
build: extract $(BOOST_CPPFLAGS) from $(BITCOIN_INCLUDES)
This leaves $(BITCOIN_INCLUDES) as internal dependencies, and gives
finer control over Boost includes.
2022-09-13 17:15:17 +01:00
Carl Dong 1392e8e2d8 build: Don't add unrelated libs to LIBTEST_*
This was used to, in effect, manually emulate --start-group/--end-group.
However, we can just order the libraries correctly and avoid specifying
libraries multiple times on the link line.

Note: lld (not ld.bfd) knows how to resolve out-of-order references and
      doesn't seem to need the reodering
2022-04-11 16:56:34 -04:00
Russell Yanofsky 172096e9dd scripted-diff: Rename libbitcoin_server.a to libbitcoin_node.a
Goal along with namespacing PR #23497 is to have src/node/ code in
node:: namespace in libbitcoin_node.a library

-BEGIN VERIFY SCRIPT-
bash -c ' # Bash shell needed for brace expansion {a,b}
git mv build_msvc/libbitcoin_{server,node}
git mv build_msvc/libbitcoin_node/libbitcoin_{server,node}.vcxproj.in
ren() { git grep -l "$1" src build_msvc | xargs sed -i "s/$1/$2/g"; }
ren LIBBITCOIN_{SERVER,NODE}
ren libbitcoin_{server,node}
'
-END VERIFY SCRIPT-
2021-12-20 10:53:01 -05:00
James O'Beirne 071200993f
move-only: unittest: add test/util/chainstate.h
and move `CreateAndActivateUTXOSnapshot()` into it for reuse
in future test modules.
2021-09-15 15:46:48 -04:00
MarcoFalke fa4926cca6
fuzz: [refactor] Use IsValidFlagCombination in signature_checker fuzz target
Can be reviewed with --color-moved=dimmed-zebra
2021-03-30 10:42:45 +02:00
fanquake 7af25024e9
build: compile libnatpmp with -DNATPMP_STATICLIB on Windows
This fixes linking issues and mirrors what we do with miniupnpc.
2021-03-04 12:34:46 +08:00
MarcoFalke 22220ef6d5
test: Move P2WSH_OP_TRUE to shared test library 2021-02-17 11:36:30 +01:00
MarcoFalke fa4234d877
test: Mock IBD in net_processing fuzzers 2020-11-07 07:50:59 +01:00
MarcoFalke fa6a008434
fuzz: Add process_messages harness 2020-04-05 10:46:24 +08:00
Martin Zumsande 78e283e656 [test] move wallet helper functions into test library 2019-11-25 16:40:09 +01:00
Martin Zumsande f613e5dfda [test] move mining helper functions into test library 2019-11-25 16:40:03 +01:00
Harris a2e581de94
build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00