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
fuzz: call lookup functions before calling Ban
#27935
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee 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. |
LookupSubNet
before calling Ban
LookupSubNet
before calling Ban
with a subnet
c6a72ad
to
ecffb66
Compare
ecffb66
to
33a82fc
Compare
Could rebase on master to remove |
Sure. |
33a82fc
to
790fe71
Compare
Force-pushed to remove "--exclude banman" in Mac |
790fe71
to
def9f75
Compare
Rebased. |
This still crashes for me on the following input |
I'm investigating it. |
def9f75
to
f4bd8f2
Compare
LookupSubNet
before calling Ban
with a subnetBan
Thanks for reviewing, @dergoegge. I noted that we also need to call Also, this way we're closer to the reality (following what RPC does to set it). |
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 f4bd8f2
Happy to re-ack if you take the suggestion.
f4bd8f2
to
c92a377
Compare
c92a377
to
f107b60
Compare
I guess there are two possible approaches:
Maybe do 1. for 26.0 and 2. for 27.0? |
Looks like this can't be merged/backported as-is either way, due to the silent conflict caused by the rafactor (7be62df)? |
Gonna check it |
One more consideration wrt to changing Lines 1005 to 1008 in 4458ae8
|
f107b60
to
8adbd44
Compare
Rebased and changed the approach in fuzz to call |
Are you still working on this? |
Yes, will push an update soon |
8adbd44
to
7e64430
Compare
Force-pushed:
|
Would be good to explain this a bit more, to make sure this is not a bug. |
I think fuzz can generate subnets with a zone identifier, like: "676:c962:7962:b787:b392:fed8:7058:c500%2038004089/121", which is a valid one. However, the lookup call might change the zone identifier. In my machine (macOS), "676:c962:7962:b787:b392:fed8:7058:c500%2038004089/121" becomes "676:c962:7962:b787:b392:fed8:7058:c500%31097/121" after lookup and it makes the assertion fails. |
Ah ok. And about the efficiency, is it possible to keep the fuzz input format unchanged instead of using a string representation (Maybe via a string-lookup roundtrip)? I wonder if that'd be more efficient. |
Also, compare banmaps only if there are no invalid entries.
7e64430
to
fca0a89
Compare
Yes, force-pushed addressing it. Also, I think this way our seeds remain great. |
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 fca0a89
ACK fca0a89 |
Also, compare banmaps only if there are no invalid entries. Github-Pull: bitcoin#27935 Rebased-From: f9b2863
Github-Pull: bitcoin#27935 Rebased-From: fca0a89
Also, compare banmaps only if there are no invalid entries. Github-Pull: bitcoin#27935 Rebased-From: f9b2863
Fixes #27924
To not have any discrepancy, it's required to call lookup functions before calling
Ban
. If we don't do it, the assertionassert(banmap == banmap_read);
may fail becauseBanMapFromJson
will callLookupSubNet
and cause the discrepancy between the banned and the loaded one. It happens especially in MacOS (#27924).Also, calling lookup functions before banning is what RPC
setban
does.