fuzz: Add fuzzing harness for node eviction logic#19972
fuzz: Add fuzzing harness for node eviction logic#19972maflcko merged 1 commit intobitcoin:masterfrom
Conversation
|
Concept ACK, thanks for working on this. Will review. |
be31739 to
c57cabd
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
jonatack
left a comment
There was a problem hiding this comment.
ACK c57cabdea44cab2a9dd2f0443f7a6b28cb41e7b4 code review, ran the fuzzer up to 10M execs, ran bitcoind grepping the net logging and observing the peer conns. Consider maybe running clang-format on the changes.
#10750687 REDUCE cov: 1502 ft: 7161 corp: 469/821Kb lim: 4096 exec/s: 527 rss: 631Mb L: 2188/4091 MS: 1 EraseBytes-
#10761148 REDUCE cov: 1502 ft: 7161 corp: 469/821Kb lim: 4096 exec/s: 527 rss: 642Mb L: 1430/4091 MS: 1 EraseBytes-
#10761655 REDUCE cov: 1502 ft: 7161 corp: 469/821Kb lim: 4096 exec/s: 527 rss: 642Mb L: 3142/4091 MS: 2 PersAutoDict-EraseBytes- DE: "_\xb0\x00\x8d\x8d\x8d\x8d\x8d\x8d\x8d\x8d\x8d"-
#10770237 REDUCE cov: 1502 ft: 7161 corp: 469/821Kb lim: 4096 exec/s: 527 rss: 642Mb L: 2961/4091 MS: 2 ChangeBinInt-EraseBytes-
#10778939 REDUCE cov: 1502 ft: 7161 corp: 469/821Kb lim: 4096 exec/s: 527 rss: 643Mb L: 3266/4091 MS: 2 ChangeByte-EraseBytes-
|
(am running the node with this logging) +++ b/src/net.cpp
@@ -972,6 +972,7 @@ bool CConnman::AttemptToEvictConnection()
const Optional<NodeEvictionCandidate> node_to_evict = SelectNodeToEvict(vEvictionCandidates);
if (!node_to_evict) {
+ LogPrintf("ATEC: no node to evict returned by SelectNodeToEvict()\n");
return false;
}
const NodeId evicted = node_to_evict->id;
@@ -979,9 +980,12 @@ bool CConnman::AttemptToEvictConnection()
for (CNode* pnode : vNodes) {
if (pnode->GetId() == evicted) {
pnode->fDisconnect = true;
+ LogPrintf("ATEC: node to evict FOUND in vEvictioncandidates and disconnected: %s\n", evicted);
return true;
}
}
+ LogPrintf("ATEC: node to evict selected but not found in vEvictioncandidates: %s\n", evicted);
+
return false;
} |
|
A month has passed since reviewing, so a gentle bump for reviewers. |
1533813 to
0b236f9
Compare
|
Marking this as draft since it depends on the changes in #20477 ("test/net: Add unit testing of node eviction logic") :) |
0b236f9 to
d041f2f
Compare
c6f0bc1 to
1c03aa6
Compare
1c03aa6 to
42321f4
Compare
|
Rebased on top of This PR is now touches only the fuzz tests and should hopefully be easy to review :) |
maflcko
left a comment
There was a problem hiding this comment.
Aren't the code paths already exercised through the unit test?
42321f4 to
5a9ee08
Compare
There are differences: the unit test clamp the eviction candidate parameters (like Also the unit testing performs a couple of thousand test eviction rounds whereas the fuzzing test runs indefinitely :) I think it makes sense to both unit test and fuzz test |
|
cr ACK 5a9ee08 |
5a9ee08 tests: Add fuzzing harness for node eviction logic (practicalswift) Pull request description: Add fuzzing harness for node eviction logic. See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the [Bitcoin Core fuzzing corpus repo](https://github.com/bitcoin-core/qa-assets). Happy fuzzing :) ACKs for top commit: MarcoFalke: cr ACK 5a9ee08 Tree-SHA512: c2401d22134867e23dab1ba94ae7ef36fdf52aa0588fdc4705d9cb765ddf979fd775fdf153ce2359f1bc1787cf60bf0ebcd47c7aa29c672e6a253fa58cac292d
| fuzzed_data_provider.ConsumeBool(), | ||
| fuzzed_data_provider.ConsumeIntegral<uint64_t>(), | ||
| fuzzed_data_provider.ConsumeBool(), | ||
| fuzzed_data_provider.ConsumeBool(), |
Add fuzzing harness for node eviction logic.
See
doc/fuzzing.mdfor information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the Bitcoin Core fuzzing corpus repo.Happy fuzzing :)