#36254 bench: add and use undo-data for BlockToJsonVerbosity3 bench
https://github.com/bitcoin/bitcoin/pull/36254 · · +21/-0 in 3 files, 1 commits · labels: Tests
Goal
- Make the block-to-JSON verbosity 3 benchmark test its intended code path
- Provide accurate performance measurements for serializing block fee and prevout data
This PR adds 136 KB of raw block undo data (`block413567_undo.raw`) to the benchmark suite and writes it to block storage during benchmark setup. Previously, without undo data available, `blockToJSON` could not extract prevout details or fees, causing `BlockToJsonVerbosity3` to perform identical work to `BlockToJsonVerbosity2`.
Problem: The `BlockToJsonVerbosity3` benchmark did not actually exercise verbosity 3 logic (prevouts and fees) due to missing undo data, rendering the benchmark unrepresentative of real-world RPC execution.
Category: Test infrastructure (#7 of 45)
P3 · test coverage
- P3 because it fixes a misleading benchmark that failed to exercise its target code path
- Provides an accurate performance baseline for profiling high-verbosity block RPC logic
P3 because it fixes a misleading benchmark that failed to test its intended execution path. The author demonstrated that 'BlockToJsonVerbosity2 and BlockToJsonVerbosity3 times were the same' before this patch, and providing the undo data gives an accurate signal for profiling verbosity 3 block serialization.
Membership: Changes benchmark setup and raw data files in src/bench/
Factors: security/stability 0, bug 1, performance 0, user value 0, leverage 1
Reviewability: Ready
- Ready for review with passing CI and a small code diff
The PR is small (+21/-0 plus raw data), CI is passing, and it has already received a verified tested ACK.
Author status: active
Agreement: Strong
- Strong support with no open objections
- Verified by reproducing benchmark numbers and validating raw undo data (ismaelsadeeq)
Strong: tested ACK verifying benchmark reproduction and undo data (ismaelsadeeq)
Reviewer ismaelsadeeq confirmed reproducibility and verified the raw undo data checksum, with no objections raised.
- ismaelsadeeq gave a Tested ACK reproducing the benchmark numbers and verifying the undo data blob
Review verdicts (DrahtBot): 1
- ACK: ismaelsadeeq
Dependencies
Enables:
Files
21 lines under test/bench/ci.
- src/bench/rpc_blockchain.cpp +20/-0
- src/bench/CMakeLists.txt +1/-0
- src/bench/data/block413567_undo.raw +None/-None
Card
Adds raw undo data for block 413567 to `src/bench/` and loads it during benchmark initialization. Previously, `blockToJSON` lacked undo data in the benchmark context, causing `BlockToJsonVerbosity3` to skip prevout and fee calculation and measure identical work to verbosity 2. This fixes an inaccurate benchmark for developers optimizing verbose `getblock` serialization. The PR has a verified Tested ACK from ismaelsadeeq and is ready for merge.