Skip to content

Commit

Permalink
Merge bitcoin#31238: fuzz: Limit wallet_notifications iterations
Browse files Browse the repository at this point in the history
fa461d7 fuzz: Limit wallet_notifications iterations (MarcoFalke)

Pull request description:

  I don't think the fuzz target has ever found a real issue. The closest being bitcoin#25869

  It is also, by far, the slowest fuzz target. For example, looking at https://cirrus-ci.com/task/5533338067271680?logs=ci#L3974, it takes more than one hour:

  ```
  Run wallet_notifications with args ['/ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/src/test/fuzz/fuzz', '-runs=1', PosixPath('/ci_container_base/ci/scratch/qa-assets/fuzz_corpora/wallet_notifications')]INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 1096115652
  INFO: Loaded 1 modules   (625824 inline 8-bit counters): 625824 [0x5628396d9138, 0x562839771dd8),
  INFO: Loaded 1 PC tables (625824 PCs): 625824 [0x562839771dd8,0x56283a0fe7d8),
  INFO:     1287 files found in /ci_container_base/ci/scratch/qa-assets/fuzz_corpora/wallet_notifications
  INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1047827 bytes
  INFO: seed corpus: files: 1287 min: 1b max: 1047827b total: 11616898b rss: 172Mb
  #16pulse  cov: 14328 ft: 25341 corp: 14/239b exec/s: 5 rss: 204Mb
  #64pulse  cov: 19179 ft: 58412 corp: 61/3587b exec/s: 5 rss: 320Mb
  #128pulse  cov: 19692 ft: 85738 corp: 125/16Kb exec/s: 3 rss: 544Mb
  #256pulse  cov: 19923 ft: 107490 corp: 253/72Kb exec/s: 2 rss: 556Mb
  #512pulse  cov: 20107 ft: 124704 corp: 509/330Kb exec/s: 2 rss: 590Mb
  Slowest unit: 10 s:
  artifact_prefix='./'; Test unit written to ./slow-unit-9fa5f7d7e4afa1626622ef1b3c70a7563eecf11d
  #1024pulse  cov: 20360 ft: 136324 corp: 1009/2488Kb exec/s: 0 rss: 726Mb
  Slowest unit: 23 s:
  artifact_prefix='./'; Test unit written to ./slow-unit-5d99a20de2c2b6bedb0cbaf0ba3743ae3ba13c7c
  Slowest unit: 26 s:
  artifact_prefix='./'; Test unit written to ./slow-unit-8889ecb61bdc0650355e0d0d27c012f3239d07a4
  Slowest unit: 42 s:
  artifact_prefix='./'; Test unit written to ./slow-unit-d16c084282ac1a85fcdc43c48e49836b08446686
  #1289INITED cov: 20409 ft: 138281 corp: 1245/10323Kb exec/s: 0 rss: 880Mb
  #1289DONE   cov: 20409 ft: 138281 corp: 1245/10323Kb lim: 1047827 exec/s: 0 rss: 880Mb
  Done 1289 runs in 3813 second(s)
  ```

  Looking at the flame graphs, it looks like the slow runs spend most of their time in the Knapsack solver. This seems reasonable, because it may run 1000 inner Knapsack iterations 200 times. So reduce the fuzz iterations from 200 to 20 to avoid fuzz timeouts and wasted resources.

ACKs for top commit:
  brunoerg:
    code review ACK fa461d7
  dergoegge:
    lgtm ACK fa461d7

Tree-SHA512: bee707a3398ab0c729f335f00d8cad63135939831454dd863830fc957b4b51b27064224be0ed15eb76cfcc39de972e4e79b0802940934fbac516840ddc475ab9
  • Loading branch information
fanquake committed Nov 7, 2024
2 parents 564238a + fa461d7 commit c9e67e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wallet/test/fuzz/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ FUZZ_TARGET(wallet_notifications, .init = initialize_setup)
auto& [coins, block]{chain.back()};
coins.emplace(total_amount, COutPoint{Txid::FromUint256(uint256::ONE), 1});
}
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 200)
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 20)
{
CallOneOf(
fuzzed_data_provider,
Expand Down

0 comments on commit c9e67e2

Please sign in to comment.