-
Notifications
You must be signed in to change notification settings - Fork 37.7k
fuzz: Add fuzzing harness for node eviction logic #19972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK c57cabd 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
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 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 5a9ee08
fuzzed_data_provider.ConsumeBool(), | ||
fuzzed_data_provider.ConsumeIntegral<uint64_t>(), | ||
fuzzed_data_provider.ConsumeBool(), | ||
fuzzed_data_provider.ConsumeBool(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add fuzzing harness for node eviction logic.
See
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.Happy fuzzing :)