addrman: Log too low compat value #24312
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
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. |
shaavan
left a comment
There was a problem hiding this comment.
ACK fac32775c8e451527b48e855aebd13b7ed0e820d
Changes since my last review:
- Instead of changing the type of
lowest_compatiblefrom 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.
vasild
left a comment
There was a problem hiding this comment.
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 |
vasild
left a comment
There was a problem hiding this comment.
ACK faaa6c2af56eedaf8d50b33015d98c7bc289c2f4
What about #24312 (review)?
mzumsande
left a comment
There was a problem hiding this comment.
Code Review ACK faaa6c2af56eedaf8d50b33015d98c7bc289c2f4 - also did some light testing.
|
ACK fa0fb76b7772eda83ec9c7030911a63331f590c5 Only change: Rewording of the error message |
Also remove uint8_t{} casts from values that are already of the same
type.
|
re-ACK fa097d0 |
vasild
left a comment
There was a problem hiding this comment.
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_compatiblevalue, it would be read as a positive value. For example-32will 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_compatiblein normal operation, unless the file storage is later corrupted by external influence.