Skip to content

scriptpubkeyman fuzz target TopUp is slow #30476

Closed

Description

@maflcko

Seems wasteful to spend time in TopUp while fuzzing, so my recommendation would be to limit TopUp iterations a bit.

Context: https://cirrus-ci.com/task/6178647134961664?logs=ci#L4357

Run scriptpubkeyman with args ['/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/fuzz', '-runs=1', PosixPath('/ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/scriptpubkeyman')]INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3840853548
INFO: Loaded 1 modules   (623498 inline 8-bit counters): 623498 [0x5572c2e0a518, 0x5572c2ea28a2), 
INFO: Loaded 1 PC tables (623498 PCs): 623498 [0x5572c2ea28a8,0x5572c3826148), 
INFO:     8841 files found in /ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/scriptpubkeyman
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 924704 bytes
INFO: seed corpus: files: 8841 min: 1b max: 924704b total: 49718183b rss: 173Mb
#128	pulse  cov: 12139 ft: 24855 corp: 125/930b exec/s: 25 rss: 191Mb
#256	pulse  cov: 15522 ft: 49362 corp: 251/2416b exec/s: 4 rss: 286Mb
#512	pulse  cov: 19356 ft: 64381 corp: 483/6374b exec/s: 3 rss: 448Mb
Slowest unit: 18 s:
artifact_prefix='./'; Test unit written to ./slow-unit-c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
Base64: dHIoJTI5LzMvKicpXCUprSlUVO3t/e3t7e3tra2t7e0=
#1024	pulse  cov: 21215 ft: 88717 corp: 877/17Kb exec/s: 2 rss: 610Mb
#2048	pulse  cov: 21835 ft: 104559 corp: 1467/57Kb exec/s: 2 rss: 653Mb
#4096	pulse  cov: 23163 ft: 120057 corp: 2005/171Kb exec/s: 2 rss: 694Mb
#8192	pulse  cov: 24591 ft: 135480 corp: 2490/1045Kb exec/s: 3 rss: 849Mb
#8844	INITED cov: 24681 ft: 137958 corp: 2568/7024Kb exec/s: 3 rss: 1001Mb
#8844	DONE   cov: 24681 ft: 137958 corp: 2568/7024Kb lim: 793168 exec/s: 3 rss: 1001Mb
Done 8844 runs in 2763 second(s)
$ FUZZ=scriptpubkeyman perf record -g --call-graph dwarf  ./src/test/fuzz/fuzz -runs=10 ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
$ hotspot  ./perf.data 

Screenshot from 2024-07-18 10-08-21

Activity

  1. brunoerg commented on Jul 19, 2024

    @brunoerg
    Contributor

    Instead of calling TopUp every time we call AddDescriptorKey, maybe it could be done just one time per iteration. I can see it.

    Also, there are other functions, GetNewDestination, MarkUnusedAddresses and AddWalletDescriptor that internally call TopUp().

  2. brunoerg commented on Jul 20, 2024

    @brunoerg
    Contributor

    Instead of calling TopUp every time we call AddDescriptorKey, maybe it could be done just one time per iteration. I can see it.

    Also, there are other functions, GetNewDestination, MarkUnusedAddresses and AddWalletDescriptor that internally call TopUp().

    Forget, reducing keypool size should be enough. Just opened #30494.

  3. added a commit that references this issue on Jul 22, 2024
    8754d05
  4. locked and limited conversation to collaborators on Jul 22, 2025
  5. added 6 commits that reference this issue on Nov 16, 2026
    1c0bf51
    7c36048
    445ab51
    faed38e
    bebb6fc
    24cb742
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions