#36580 refactor: Use util::log::FormatString in BaseIndex::FatalErrorf and LogConnectFailure
| Reviewability | Reviews | Agreement | Size | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| #36580 refactor: Use util::log::FormatString in BaseIndex::FatalErrorf and LogConnectFailure | Ready | 1 | Positive | 6 | ||||||
|
|
|
|
| ||||||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | ||||||||||
Goal
Replaces util::ConstevalFormatString with util::log::FormatString in BaseIndex::FatalErrorf and LogConnectFailure. This enables compile-time verification that format strings passed to these logging helper functions do not contain redundant trailing newlines.
Problem: Functions that format strings for logging without using util::log::FormatString can accept trailing newlines, which causes logging sanitization to output escaped \x0a characters.
Evidence of importance:
- PR description: "Both functions format a message that is ultimately logged, so it must not contain a redundant trailing newline. Otherwise, it could lead to escaped \x0a inside log messages. This continues https://github.com/bitcoin/bitcoin/pull/36397"
Risk of a mistake: low (other). A mistake in format string types would fail at compile time and carries no runtime or consensus risk.
Changed since the previous assessment: Now includes the complete patch for the single commit; the approach and touched call sites are unchanged.
Reviewability
Ready
Nothing known that would invalidate a review now.
Waiting on (from the thread read):
- nothing
Agreement
Positive
support without stated reasons, no open objection (stickies-v)
Thread notes: Initial record. stickies-v provided an ACK without comments. / Initial record. stickies-v gave an ACK with no rationale.
Objections, suggestions, and questions: none recorded.
Support:
- stickies-v (member) (ACK, 2026-10-21): (no reason given) [not substantive]
Participants:
- stickies-v (member, support, 1 statements 2026-10-21 to 2026-10-21): ACKed commit hash
Files
0 lines under test/bench/ci.
- src/index/base.h +3/-3
- src/netbase.cpp +2/-2
- src/index/base.cpp +1/-2
Card
The short text the ranking pass compares across PRs.
Switches format string parameters in BaseIndex::FatalErrorf and LogConnectFailure from util::ConstevalFormatString to util::log::FormatString. This enforces compile-time checks preventing redundant trailing newlines that would otherwise be rendered as escaped \x0a sequences in log files. The author notes this continues cleanup from PR 36397.
Data
thread read through 2026-10-21 (1 statements), head fafbcadc1b
labels: Refactoring
Categories
Indexes
P4 · cleanup
Adopts `util::log::FormatString` to enforce compile-time checks against trailing newlines in index fatal error logging. This is a minor internal code cleanup with no impact on index correctness or performance.
Membership: Modifies `BaseIndex::FatalErrorf` in `src/index/base.h` and `src/index/base.cpp`.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 0
P2P
P4 · cleanup
Switches `LogConnectFailure` to use `util::log::FormatString` to disallow redundant trailing newlines. This is an internal formatting guard that does not affect P2P networking logic or connection reliability.
Membership: Modifies `LogConnectFailure` in `src/netbase.cpp`, part of the connection handling infrastructure.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 0