mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
db2d39f642fuzz: add subtest for re-downloading a previously pruned block (Eugene Siegel)45f5b2dac3fuzz: Add fuzzer for block index (Martin Zumsande)c011e3aa54test: Wrap validation functions with TestChainstateManager (Martin Zumsande) Pull request description: This adds a fuzz target for the block index and various events in validation that interact with it. It can create arbitrary tree-like structure of block indexes, simulating (so far) the following events: - Adding a header - Receiving the full block (may be valid or not) - `ActivateBestChain()` - Reorging the chain to a new chain tip (possibly encountering invalid blocks on the way) - Pruning a block in the best chain - Receiving a previously pruned block again (`getblockfrompeer`) It might be interesting / possible to extend this to more events, such as dealing with more than one chainstate (assumeutxo). The test skips all actual validation of header/ block / transaction data by just simulating the outcome, and also doesn't interact with the data directory. The main goal is to ensure the integrity of the block index tree in all fuzzed constellations, by calling `CheckBlockIndex()` at the end of each iteration. Compared to #29158 this approach has a more limited scope (by skipping all actual validation), but it is fast - it doesn't do a full init sequence on each iteration, but "cleans up" after itself by resetting the global validation state after each iteration. ACKs for top commit: Crypt-iQ: reACKdb2d39f642maflcko: review ACKdb2d39f642🍶 sedited: Re-ACKdb2d39f642Tree-SHA512: 76cd5f8f4d7d7258620b46d7438bad4508c3bdc98825b48b60f694b5a9838e2b2cf4967c0ead181f86f66f4939ddfe552471851b9d18f84f584c03dd7e09fc43
Test library
This contains files for the test library, which is used by the test binaries (unit tests, benchmarks, fuzzers, gui tests).
Generally, the files in this folder should be well-separated modules. New code should be added to existing modules or (when in doubt) a new module should be created.
The utilities in here are compiled into a library, which does not hold any state. However, the main file setup_common
defines the common test setup for all test binaries. The test binaries will handle the global state when they
instantiate the BasicTestingSetup (or one of its derived classes).