Skip to content

Commit bb57017

Browse files
committed
Merge bitcoin#31521: fuzz: Fix misplaced SeedRand::ZEROS
fadd568 fuzz: Fix misplaced SeedRand::ZEROS (MarcoFalke) Pull request description: After commit fae63bf 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 fadd568 brunoerg: code review ACK fadd568 hodlinator: ACK fadd568 Tree-SHA512: 54eadf19a1e850157a280fb252ece8797f37a9a50d3b0a01aa2c267bacbe8ef4ddea6cf3faadcbaa4ab9f53148edf08e3cee5dfb3eae928db582adf8373a5206
2 parents 5bbbc0d + fadd568 commit bb57017

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/test/fuzz/util/check_globals.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ struct CheckGlobalsImpl {
2424
"The current fuzz target used the global random state.\n\n"
2525

2626
"This is acceptable, but requires the fuzz target to call \n"
27-
"SeedRandomStateForTest(SeedRand::ZEROS) at the beginning \n"
28-
"of processing the fuzz input.\n\n"
27+
"SeedRandomStateForTest(SeedRand::ZEROS) in the first line \n"
28+
"of the FUZZ_TARGET function.\n\n"
2929

3030
"An alternative solution would be to avoid any use of globals.\n\n"
3131

32-
"Without a solution, fuzz stability and determinism can lead \n"
32+
"Without a solution, fuzz instability and non-determinism can lead \n"
3333
"to non-reproducible bugs or inefficient fuzzing.\n\n"
3434
<< std::endl;
3535
std::abort(); // Abort, because AFL may try to recover from a std::exit

src/test/fuzz/utxo_total_supply.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ using node::BlockAssembler;
2121

2222
FUZZ_TARGET(utxo_total_supply)
2323
{
24+
SeedRandomStateForTest(SeedRand::ZEROS);
2425
/** The testing setup that creates a chainman only (no chainstate) */
2526
ChainTestingSetup test_setup{
2627
ChainType::REGTEST,
2728
{
2829
.extra_args = {"-testactivationheight=bip34@2"},
2930
},
3031
};
31-
SeedRandomStateForTest(SeedRand::ZEROS); // Can not be done before test_setup
3232
// Create chainstate
3333
test_setup.LoadVerifyActivateChainstate();
3434
auto& node{test_setup.m_node};

0 commit comments

Comments
 (0)