Skip to content

Commit

Permalink
fuzz: Fix misplaced SeedRand::ZEROS
Browse files Browse the repository at this point in the history
After commit fae63bf this must be
placed even before test_setup.
  • Loading branch information
MarcoFalke committed Dec 18, 2024
1 parent 477b357 commit fadd568
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/test/fuzz/util/check_globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/fuzz/utxo_total_supply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ 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,
{
.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};
Expand Down

0 comments on commit fadd568

Please sign in to comment.