Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Comment on lines +27 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit: Slight preference for the old text that doesn't dictate specific lines).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will leave as-is for now, to not invalidate the 3 acks. Is there a reason why the first line could not be used for this with the current codebase in master?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was thinking there may creep up something else that also needs initializing really early and either is unaffected by randomness or somehow needs to affect randomness seeding (yes, contrived).

Then there is the idea to have a mixin seeding the randomness internally, which would change this part regardless.


"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
Loading