#35368 tracing: add block header and compact block tracepoints
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #35368 tracing: add block header and compact block tracepoints | Needs rebase | 0 | Strong | 99 + 270 tests | |||
|
|
|
| ||||
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
Adds two USDT tracepoints to P2P processing: `net:block_header`, which triggers when a new valid header arrives via a `headers` or `cmpctblock` message, and `net:compact_block_reconstructed`, which fires when a compact block is successfully reconstructed before validation. It encapsulates compact block reconstruction statistics into a helper struct on `PartiallyDownloadedBlock` and adds functional BPF test coverage.
Problem: Compact block relay performance and diagnostics rely on string-based debug logs (`BCLog::CMPCTBLOCK`), which are awkward to parse reliably in external tooling, cannot easily be monitored continuously in production without log parsing overhead, and make attributing relay efficiency to specific peers difficult.
Evidence of importance:
- PR description notes that whether a node reconstructs a block without round trips depends on mempool overlap, extra transaction pool usefulness, and peer behavior, but today 'this information is mostly available only through debug logs, which are string-based, less precise for tooling, and not ideal for continuous measurement.'
Scope: None.
Risk of a mistake: low (p2p, tooling, tests, docs). USDT tracepoints are inactive when unprobed, and the refactor only reads existing counters when assembling reconstruction statistics.
Changed since the previous assessment: Rebased onto recent master without substantive changes to the tracepoint interface or implementation.
Reviewability
Ready · Needs rebase
Conflicts with master; review the logic now, the rebase is mechanical.
Waiting on (from the thread read):
- reviewer: maflcko to review the author's response regarding IPC tracing in #35142 2026-10-22
Agreement
Strong
substantive support, no open objection (0xB10C)
Thread notes: Updated maflcko's suggestion (c:6211154559) to answered after author replied pointing to their comment in the IPC tracing issue thread.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| m4ycon (none) | suggestion, interface | pass all missing txids (vtx_missing) through the tracepoint | answered · 0xB10C explained that tracepoints do not easily support passing lists or sets | answered | by others | 2026-05-24: 'it makes me think if this isn't an interesting information to pass through tracepoints: all the txids from vtx_missing.' Status from: 2026-05-25: 0xB10C: 'It's rather impractical to pass lists or sets via tracaepoints, they don't really support it.' |
| stickies-v (member) | suggestion, approach | clarify the IPC tracing approach (#35142) before adding more tracepoints | answered · author explained why USDT tracepoints are useful now and that IPC tracing is not a drop-in replacement | answered | yes | 2026-05-26: 'I agree it would make more sense to clarify that first before adding more tracepoints.' Status from: 2026-05-27: w0xlt: 'I don't think the IPC tracing discussion should block this functionality, assuming there is demand for it.' |
| maflcko (member) | suggestion, usefulness | explain why this code should be added if it will be removed soon anyway via #35142, and whether there are active users who want it | answered · author replied directing to their comment on issue #35142 | answered | yes | 2026-10-16: 'Not sure about adding code that will be removed soon anyway?' Status from: 2026-10-22: w0xlt: 'Thanks for the feedback. Added my two cents in the thread: https://github.com/bitcoin/bitcoin/issues/35142#issuecomment-6346952054' |
Support:
- 0xB10C (member) (Concept ACK, 2026-05-24) [read]: Generally in favor of having a way of exposing data about this in a non-logging way. Especially since fast compact block relay and reconstructions seem to be somewhat of a share priority by contributors
- m4ycon (none) (Concept ACK, 2026-05-24): Concept ACK [not substantive]
Participants:
- 0xB10C (member, support, 4 statements 2026-05-24 to 2026-05-25): Concept ACK on exposing compact block data via tracepoints instead of brittle debug logs
- m4ycon (none, support, 2 statements 2026-05-24 to 2026-05-24): Concept ACK and suggested including missing txids in the tracepoint
- stickies-v (member, neutral, 1 statements 2026-05-26 to 2026-05-26): suggested clarifying the IPC tracing approach (#35142) before adding more tracepoints
- sedited (member, neutral, 2 statements 2026-08-27 to 2026-10-08): asked for a rebase
- maflcko (member, neutral, 1 statements 2026-10-16 to 2026-10-16): questioned adding code that might soon be removed for IPC tracing and asked if active users want it
Files
272 lines under test/bench/ci.
- test/functional/interface_usdt_net.py +257/-2
- src/net_processing.cpp +42/-1
- doc/tracing.md +30/-0
- src/blockencodings.cpp +15/-3
- src/test/blockencodings_tests.cpp +13/-0
- src/blockencodings.h +12/-0
Card
The short text the ranking pass compares across PRs.
Adds `net:block_header` and `net:compact_block_reconstructed` USDT tracepoints to Bitcoin Core to emit structured compact block reconstruction and header arrival metrics. This solves an observability limitation for telemetry tools and network researchers who currently must scrape text-based debug logs to measure mempool overlap, peer reconstruction success, and extra transaction pool utility. The tracepoints provide low-overhead, disjoint transaction source counts and peer IDs without adding overhead to the hot path when probes are disabled.
Data
thread read through 2026-10-22 (14 statements), head ef3121b6e0
labels: Needs rebase
Categories
P2P
P3 · new feature (ranking pass: Diagnostic tooling, below the behaviour-changing PRs in the band.)
Adds USDT observability for block header arrivals and compact block reconstruction to avoid reliance on string-based debug logs. Reviewers noted value in exposing compact block data in a non-logging way for relay performance measurement, but this is non-critical diagnostic instrumentation that is reasonably deferrable.
Membership: Adds tracepoints in src/net_processing.cpp and blockencodings helper structs to observe header and compact block reconstruction events.
Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 1