bench: add BIP-352 pubkey extraction benchmarks (standard + P2PKH worst-case) #36475

pull theStack wants to merge 2 commits into bitcoin:master from theStack:bip352-bench-pubkey_extraction changing 2 files +98 −0
  1. theStack commented at 2:30 PM on October 8, 2026: contributor

    As there are ongoing changes to the Silent Payments public key extraction function GetPubKeyFromInput (see recently merged #36338, upcoming #36417), it seems reasonable to add benchmarks for it. The first commit covers the standard shape of each eligible input type (P2PKH, P2SH-P2WPKH, P2WPKH and P2TR key-path spend; see BIP-352). The second adds a worst-case P2PKH input with a maximally malleated scriptSig, where every push has to be hashed during the scan.

    Results on my arm64 machine (as per $ ./build/bin/bench_bitcoin -filter='BIP352_.*'):

    ns/input input/s err% total benchmark
    3,034.12 329,584.35 0.2% 0.01 BIP352_GetPubKey_P2PKH
    69,868.20 14,312.66 0.1% 0.01 BIP352_GetPubKey_P2PKH_WorstCase
    2,841.35 351,945.44 0.1% 0.01 BIP352_GetPubKey_P2SH_P2WPKH
    2,768.00 361,272.01 0.1% 0.01 BIP352_GetPubKey_P2TR
    2,757.57 362,637.66 0.0% 0.01 BIP352_GetPubKey_P2WPKH
  2. bench: add benchmarks for BIP-352 pubkey extraction (standard inputs)
    Benchmark the public key extraction (`GetPubKeyFromInput`) for the
    standard shape of each Silent Payments eligible input type, i.e.
    P2PKH, P2SH-P2WPKH, P2WPKH and P2TR (key-path spend).
    e39c1b1549
  3. DrahtBot added the label Tests on Oct 8, 2026
  4. DrahtBot commented at 2:30 PM on October 8, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Concept ACK w0xlt

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. bench: add worst-case P2PKH benchmark for BIP-352 pubkey extraction
    Add a P2PKH input with a malleated scriptSig that prepends as many
    33-byte pushes as the consensus scriptSig size limit (MAX_SCRIPT_SIZE)
    allows, each of which has to be hashed during the scan, followed by the
    actual signature and public key. The input respects all other consensus
    limits (data pushes don't count towards MAX_OPS_PER_SCRIPT, the stack
    stays below MAX_STACK_SIZE), but is non-standard as it exceeds
    MAX_STANDARD_SCRIPTSIG_SIZE.
    
    Results on my arm64 machine:
    ```
    $ ./build/bin/bench_bitcoin -filter='BIP352_.*'
    [...]
    
    |            ns/input |             input/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |            3,034.12 |          329,584.35 |    0.2% |      0.01 | `BIP352_GetPubKey_P2PKH`
    |           69,868.20 |           14,312.66 |    0.1% |      0.01 | `BIP352_GetPubKey_P2PKH_WorstCase`
    |            2,841.35 |          351,945.44 |    0.1% |      0.01 | `BIP352_GetPubKey_P2SH_P2WPKH`
    |            2,768.00 |          361,272.01 |    0.1% |      0.01 | `BIP352_GetPubKey_P2TR`
    |            2,757.57 |          362,637.66 |    0.0% |      0.01 | `BIP352_GetPubKey_P2WPKH`
    
    ```
    747514aeb4
  6. theStack force-pushed on Oct 8, 2026
  7. DrahtBot added the label CI failed on Oct 8, 2026
  8. w0xlt commented at 5:52 PM on October 8, 2026: contributor

    Concept ACK


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-10-08 23:51 UTC

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