-
Notifications
You must be signed in to change notification settings - Fork 37.7k
addrman: Log too low compat value #24312
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
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. |
fa943a0
to
fac3277
Compare
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.
Code Review ACK fac3277
I wish we had a hidden RPC for:
write_addrman(peers_dat, lowest_compatible=-32)
I wish we don't. Generally I am not a fan of baking test code into the production system, unless there is a need for 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 fac3277
Changes since my last review:
- Instead of changing the type of
lowest_compatible
from unsigned to signed integer, a condition statement has been added, which removes the need for signedlowest_compatible
.
I think the wording of added failure message is correct and adequate. I experimented with several different values of the lowest_compatible
argument in the test, and each time the error message remained logical and consistent, with changing values of compat.
Note:
The test failed with lowest_compatible=-33
, as this would make compat=-1
, which is out of range, but I don't think this condition would ever arise in real-life situations.
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.
Is the first commit test: Remove no longer needed suppressions
related to the low compat issue? The commit message does not explain why the suppressions are no longer needed.
The test fails with |
A |
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 faaa6c2
What about #24312 (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.
Code Review ACK faaa6c2 - also did some light testing.
ACK fa0fb76 Only change: Rewording of the error message |
Also remove uint8_t{} casts from values that are already of the same type.
re-ACK fa097d0 |
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 fa097d0
Even better wording, thanks @mzumsande!
Summary: ``` Also remove uint8_t{} casts from values that are already of the same type. ``` Backport of [[bitcoin/bitcoin#24312 | core#24312]]. Depends on D12348. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D12349
Before this patch, when writing a negative
lowest_compatible
value, it would be read as a positive value. For example-32
will be read as224
. There is generally nothing wrong with that. Though, similarly there shouldn't be anything wrong with refusing to read a negative value. I find the code after this patch more logical than before. Also, this allows dropping a file-wide sanitizer suppression.In practice none of this should ever happen. Bitcoin Core would never write a negative
lowest_compatible
in normal operation, unless the file storage is later corrupted by external influence.