This PR reopens #28043. It’s a regression fuzz test for #26355 and a couple bugs that were addressed in #25717. This should help us move forward with the removal of mainnet checkpoints.
It seems like the main concern in #28043 was the global mock function for proof of work. This PR aims to be an improvement by replacing the previous approach with a fuzz build configured using FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
. This ensures that the simplified test code will never be in a release binary. If we agree this is the way to go, there are some other places (for future targets) where this method could be used.
In this target, PoW isn’t being tested, so the goal is to bypass the check and let the fuzzer do its thing. In the other harnesses where PoW is actually being fuzzed, CheckProofOfWork
is now CheckProofOfWorkImpl
. So, the only change to that function is in the name.
More about FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
can be found at https://llvm.org/docs/LibFuzzer.html#fuzzer-friendly-build-mode and https://github.com/AFLplusplus/AFLplusplus/blob/stable/docs/fuzzing_in_depth.md#d-modifying-the-target.