This PR adds fuzz target for local address functions - (AddLocal, RemoveLocal, SeenLocal, IsLocal)
fuzz: add target for local address stuff #29495
pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2024-02-fuzz-local changing 1 files +37 −0-
brunoerg commented at 7:41 PM on February 27, 2024: contributor
-
DrahtBot commented at 7:41 PM on February 27, 2024: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
- DrahtBot added the label Tests on Feb 27, 2024
-
in src/test/fuzz/net.cpp:84 in 348a4c0ca8 outdated
76 | @@ -77,3 +77,33 @@ FUZZ_TARGET(net, .init = initialize_net) 77 | (void)node.HasPermission(net_permission_flags); 78 | (void)node.ConnectedThroughNetwork(); 79 | } 80 | + 81 | +FUZZ_TARGET(local_address, .init = initialize_net) 82 | +{ 83 | + FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); 84 | + SetMockTime(ConsumeTime(fuzzed_data_provider));
dergoegge commented at 11:05 PM on February 27, 2024:Is this really necessary?
brunoerg commented at 10:46 AM on February 28, 2024:Not necessary, just removed it.
in src/test/fuzz/net.cpp:97 in 348a4c0ca8 outdated
88 | + fuzzed_data_provider, 89 | + [&] { 90 | + service = ConsumeService(fuzzed_data_provider); 91 | + }, 92 | + [&] { 93 | + const bool added{AddLocal(service, fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 5))};
dergoegge commented at 11:07 PM on February 27, 2024:This harness will be non-deterministic and run out of memory since local addresses are stored in a global map. You'll need to reset
mapLocalHosteach iteration.
brunoerg commented at 10:46 AM on February 28, 2024:Done.
in src/test/fuzz/net.cpp:114 in 348a4c0ca8 outdated
102 | + [&] { 103 | + (void)SeenLocal(service); 104 | + }, 105 | + [&] { 106 | + (void)IsLocal(service); 107 | + });
dergoegge commented at 11:11 PM on February 27, 2024:How about adding coverage for
GetLocalas well?dergoegge changes_requestedbrunoerg force-pushed on Feb 28, 2024brunoerg commented at 10:48 AM on February 28, 2024: contributorForce-pushed addressing: #29495 (review) #29495 (review) #29495 (review)
Thanks, @dergoegge
in src/test/fuzz/net.cpp:112 in 36efe6bb55 outdated
107 | + }, 108 | + [&] { 109 | + (void)IsLocal(service); 110 | + }, 111 | + [&] { 112 | + auto peer{ConsumeNode(fuzzed_data_provider)};
dergoegge commented at 5:36 PM on February 28, 2024:Probably better to not consume a whole
CNodeeach time, maybe do what you did with the service.
brunoerg commented at 6:32 PM on February 28, 2024:Even not being able to overload, sgtm to not consume each time, addressing it.
brunoerg force-pushed on Feb 28, 2024brunoerg commented at 6:33 PM on February 28, 2024: contributorForce-pushed addressing #29495 (review)
in src/test/fuzz/net.cpp:97 in fe4e38c257 outdated
92 | + fuzzed_data_provider, 93 | + [&] { 94 | + service = ConsumeService(fuzzed_data_provider); 95 | + }, 96 | + [&] { 97 | + const bool added{AddLocal(service, fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 5))};
vasild commented at 1:06 PM on February 29, 2024:Maybe use
LOCAL_MAXhere instead of hardcoding5:const bool added{AddLocal(service, fuzzed_data_provider.ConsumeIntegralInRange<int>(0, LOCAL_MAX - 1))};
brunoerg commented at 5:17 PM on February 29, 2024:Nice. Done.
vasild approvedvasild commented at 1:09 PM on February 29, 2024: contributorACK fe4e38c25738356a227dc8e84b6a24d837ba8215
fuzz: add target for local addresses 25eab52389brunoerg force-pushed on Feb 29, 2024brunoerg commented at 5:18 PM on February 29, 2024: contributorForce-pushed addressing #29495 (review). Thanks, @vasild.
dergoegge approveddergoegge commented at 5:20 PM on February 29, 2024: memberACK 25eab523897e790f4f4d7b49cdbf19d13e3b0fcc
DrahtBot requested review from vasild on Feb 29, 2024vasild approvedvasild commented at 7:29 AM on March 1, 2024: contributorACK 25eab523897e790f4f4d7b49cdbf19d13e3b0fcc
DrahtBot added the label Needs rebase on Mar 1, 2024DrahtBot commented at 3:14 PM on March 1, 2024: contributor<!--cf906140f33d8803c4a75a2196329ecb-->
🐙 This pull request conflicts with the target branch and needs rebase.
fanquake commented at 3:15 PM on March 1, 2024: memberThis has been merged.
fanquake closed this on Mar 1, 2024fanquake referenced this in commit ae4165f7bc on Mar 1, 2024bitcoin locked this on Mar 1, 2025
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-05-01 03:13 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me