fuzz: Create a block template in tx_pool targets #21798

pull MarcoFalke wants to merge 4 commits into bitcoin:master from MarcoFalke:2104-fuzzMempool changing 4 files +80 −31
  1. MarcoFalke commented at 6:55 PM on April 28, 2021: member

    Relatively simple check to ensure a block can always be created from the mempool

  2. fuzz: Allow to pass min/max to ConsumeTime fae2c8bc54
  3. fuzz: Use correct variant of ConsumeRandomLengthString instead of hardcoding a maximum size
    This is technically a breaking change.
    
    This allows the fuzz engine to pick the right size,
    also larger sizes, if needed.
    fab646b8ea
  4. fuzz: Limit mocktime to MTP in tx_pool targets
    This is needed for the next commit to generate blocks.
    
    Also, apply the same mocking strategies to both targets.
    fa61ce5cf5
  5. DrahtBot added the label Tests on Apr 28, 2021
  6. practicalswift commented at 6:11 AM on April 29, 2021: contributor

    Concept ACK

    Touches only src/test/fuzz/

  7. MarcoFalke commented at 12:03 PM on April 29, 2021: member

    Looks like ci fails due to:

    policy/feerate.cpp:26:34: runtime error: signed integer overflow: 1887171891083620 * 5555 cannot be represented in type 'long'
        [#0](/bitcoin-bitcoin/0/) 0x560eb0295c97 in CFeeRate::GetFee(unsigned long) const policy/feerate.cpp:26:34
        [#1](/bitcoin-bitcoin/1/) 0x560eafb6409b in BlockAssembler::addPackageTxs(int&, int&) miner.cpp:378:43
        [#2](/bitcoin-bitcoin/2/) 0x560eafb60c86 in BlockAssembler::CreateNewBlock(CScript const&) miner.cpp:150:5
        [#3](/bitcoin-bitcoin/3/) 0x560eafa21cae in (anonymous namespace)::Finish(FuzzedDataProvider&, (anonymous namespace)::MockedTxPool&, CChainState&) test/fuzz/tx_pool.cpp:89:41
        [#4](/bitcoin-bitcoin/4/) 0x560eafa1e237 in (anonymous namespace)::tx_pool_standard_fuzz_target(Span<unsigned char const>) test/fuzz/tx_pool.cpp:272:5
        
    ...
    
    SUMMARY: UndefinedBehaviorSanitizer: signed-integer-overflow policy/feerate.cpp:26:34 in 
    
  8. MarcoFalke commented at 5:50 AM on April 30, 2021: member

    (ci now green)

  9. adamjonas commented at 5:53 PM on May 5, 2021: member

    Tested fa03232 with DEBUG=1 and observed some nice coverage increases.

    My setup is still showing the CI's UB error both in faf3e9d and fa03232, but that just might be due to my own lack of understanding or a compile issue on my part.

  10. fuzz: Create a block template in tx_pool targets fa03d0acd6
  11. MarcoFalke force-pushed on May 5, 2021
  12. MarcoFalke commented at 6:12 PM on May 5, 2021: member

    squashed the commits. bisecting should now work again.

  13. practicalswift commented at 9:39 PM on May 5, 2021: contributor

    Tested ACK fa03d0acd6bd8bb6d3d5227512f042ff537ad993

    As expected the coverage achieved by the tx_pool fuzzing harness is dramatically improved with this patch applied.

    Nice work!

  14. MarcoFalke merged this on May 6, 2021
  15. MarcoFalke closed this on May 6, 2021

  16. MarcoFalke deleted the branch on May 6, 2021
  17. sidhujag referenced this in commit 3101af3087 on May 6, 2021
  18. gwillen referenced this in commit b2376cfef6 on Jun 1, 2022
  19. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me