bench: replace embedded raw block with configurable block generator #32554

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/bench-block-generator changing 9 files +294 −47
  1. l0rinc commented at 9:39 pm on May 18, 2025: contributor

    Problem

    The hardcoded benchmark block 413567 has several issues:

    • embeds 1.1MB of binary data in the repository
    • mined in 2016, predates SegWit v0, Taproot, and modern script types
    • benchmarks cannot test different transaction patterns or script mixes
    • updating to a newer block (e.g., #32457) would still add binary bloat and would remain inflexible

    Fix

    Added configurable bench/block_generator.{h,cpp} that builds fully valid blocks at runtime providing blocks or raw serialized stream.

    Note that HexStrBench was simplified to work with random data - it doesn’t need to be block-related.


    This supersedes #32457 by eliminating the need for any hardcoded block data while enabling flexible benchmark scenarios.

  2. DrahtBot commented at 9:39 pm on May 18, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32554.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK laanwj, yuvicc, Raimo33

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34208 (bench: add fluent API for untimed setup steps in nanobench by l0rinc)
    • #32729 (test,refactor: extract script template helpers & widen sigop count coverage by l0rinc)
    • #31682 ([IBD] specialize CheckBlock’s input & coinbase checks by l0rinc)

    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.

  3. laanwj commented at 9:18 am on May 19, 2025: member
    Concept ACK
  4. l0rinc marked this as ready for review on May 21, 2025
  5. l0rinc renamed this:
    RFC: bench: replace embedded raw block with configurable block generator
    bench: replace embedded raw block with configurable block generator
    on May 21, 2025
  6. DrahtBot added the label Tests on May 21, 2025
  7. yuvicc commented at 3:44 pm on June 29, 2025: contributor

    Concept ACK

    This one is pretty useful as I can test with up-to date test_data.

  8. Raimo33 commented at 2:37 pm on October 19, 2025: contributor
    Concept ACK for more realistic benchmarks
  9. bench: replace hardcoded block with configurable generator
    Remove the bundled `block413567.raw` fixture and replace with runtime block generation via `bench/block_generator.{h,cpp}`.
    
    Expose `GetBlock()`/`GetBlockData()` with `ScriptRecipe` presets (`kLegacy`, `kWitness`) and deterministic seeding for reproducible benchmarks.
    0fbbefd017
  10. l0rinc force-pushed on Dec 20, 2025
  11. l0rinc commented at 11:19 pm on December 20, 2025: contributor
    Rebased and applied the new block everywhere, removing the binary of block 413567 embedded in the benchmarks. Let me know what you think.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-11 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me