aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2024-12-19 10:06:17 -0500
committerRyan Ofsky <ryan@ofsky.org>2024-12-19 10:23:27 -0500
commitbb57017b2945d5e0bbd95c7f1a9369a8ab7c6fcd (patch)
treec432b8b7b3267b246503dfd9958c9e64eb30fed6 /src/test
parent5bbbc0d0eeb882bd9677ac3fe7d8b26b91eaa6d9 (diff)
parentfadd568931a2d21e0f80e1efaf2281f5164fa20e (diff)
Merge bitcoin/bitcoin#31521: fuzz: Fix misplaced SeedRand::ZEROS
fadd568931a2d21e0f80e1efaf2281f5164fa20e fuzz: Fix misplaced SeedRand::ZEROS (MarcoFalke) Pull request description: After commit fae63bf13033adec80c7e6d73144a21ea3cfbc6d this must be placed even before test_setup. This is nice, because it makes the usage consistently appear in the first line. The change is moving a `SeedRandomForTest(SeedRand::ZEROS)` to happen earlier. This is fine, because it will either have no effect, or make the code more deterministic, because after commit fae63bf, no other re-seeding other than `ZEROS` can happen in fuzz tests. ACKs for top commit: marcofleon: Re ACK fadd568931a2d21e0f80e1efaf2281f5164fa20e brunoerg: code review ACK fadd568931a2d21e0f80e1efaf2281f5164fa20e hodlinator: ACK fadd568931a2d21e0f80e1efaf2281f5164fa20e Tree-SHA512: 54eadf19a1e850157a280fb252ece8797f37a9a50d3b0a01aa2c267bacbe8ef4ddea6cf3faadcbaa4ab9f53148edf08e3cee5dfb3eae928db582adf8373a5206
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/util/check_globals.cpp6
-rw-r--r--src/test/fuzz/utxo_total_supply.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/test/fuzz/util/check_globals.cpp b/src/test/fuzz/util/check_globals.cpp
index 4b74ddedd6..fbc5a55598 100644
--- a/src/test/fuzz/util/check_globals.cpp
+++ b/src/test/fuzz/util/check_globals.cpp
@@ -24,12 +24,12 @@ struct CheckGlobalsImpl {
"The current fuzz target used the global random state.\n\n"
"This is acceptable, but requires the fuzz target to call \n"
- "SeedRandomStateForTest(SeedRand::ZEROS) at the beginning \n"
- "of processing the fuzz input.\n\n"
+ "SeedRandomStateForTest(SeedRand::ZEROS) in the first line \n"
+ "of the FUZZ_TARGET function.\n\n"
"An alternative solution would be to avoid any use of globals.\n\n"
- "Without a solution, fuzz stability and determinism can lead \n"
+ "Without a solution, fuzz instability and non-determinism can lead \n"
"to non-reproducible bugs or inefficient fuzzing.\n\n"
<< std::endl;
std::abort(); // Abort, because AFL may try to recover from a std::exit
diff --git a/src/test/fuzz/utxo_total_supply.cpp b/src/test/fuzz/utxo_total_supply.cpp
index 8dfc6c8e57..84d82f71e2 100644
--- a/src/test/fuzz/utxo_total_supply.cpp
+++ b/src/test/fuzz/utxo_total_supply.cpp
@@ -21,6 +21,7 @@ using node::BlockAssembler;
FUZZ_TARGET(utxo_total_supply)
{
+ SeedRandomStateForTest(SeedRand::ZEROS);
/** The testing setup that creates a chainman only (no chainstate) */
ChainTestingSetup test_setup{
ChainType::REGTEST,
@@ -28,7 +29,6 @@ FUZZ_TARGET(utxo_total_supply)
.extra_args = {"-testactivationheight=bip34@2"},
},
};
- SeedRandomStateForTest(SeedRand::ZEROS); // Can not be done before test_setup
// Create chainstate
test_setup.LoadVerifyActivateChainstate();
auto& node{test_setup.m_node};