BIP54: Consensus Cleanup test vectors #2015

pull darosior wants to merge 3 commits into bitcoin:master from darosior:2509_consensus_cleanup_test_vectors changing 6 files +26112 −1
  1. darosior commented at 12:56 pm on October 21, 2025: member

    This introduces test vectors for BIP54. There is one set of vectors per each of the 4 mitigations.

    The vectors were generated using the BIP54 implementation against Bitcoin Inquisition available here, as well as a custom miner as a Bitcoin Core unit test available here. Documentation is provided with more details about each set of test vectors and describing how to use them.

  2. bip-0054: add a reference implementation section 89dfe03a64
  3. bip-0054: add test vectors for each mitigation
    This introduces a set of test vectors for each of the 4 mitigations in the BIP. The sigops and
    transaction size vectors were generated using the unit tests included with the Bitcoin Core
    implementation of BIP54, available at https://github.com/darosior/bitcoin/tree/2509_inquisition_consensus_cleanup.
    The timestamps and coinbases required mainnet blocks for maximum compatibility, and were generated
    by two dedicated unit tests not included with the Bitcoin Core implementation above but available at
    https://github.com/darosior/bitcoin/tree/bip54_miner.
    30b0084808
  4. bip-0054: document the test vectors 2fead0c179
  5. jonatack added the label Proposed BIP modification on Oct 21, 2025
  6. in bip-0054/test_vectors/README.md:4 in 2fead0c179
    0@@ -0,0 +1,102 @@
    1+## BIP54 test vectors
    2+
    3+This folder contains a set of test vectors for each mitigation introduced in the BIP. This document
    4+presents them in more details.
    


    jonatack commented at 3:54 pm on October 21, 2025:
    0presents them in more detail.
    
  7. jonatack commented at 4:13 pm on October 21, 2025: member

    Concept ACK, successfully built the test branch at https://github.com/darosior/bitcoin/blob/2509_inquisition_consensus_cleanup and ran the unit and functional tests.

    0$ ./build/bin/test_bitcoin --run_test=bip54_tests
    1Running 4 test cases...
    2
    3*** No errors detected
    
    0$ ./build/test/functional/feature_bip54.py     
    12025-10-21T16:05:13.483000Z TestFramework (INFO): PRNG seed is: 80635940825195715
    22025-10-21T16:05:13.483000Z TestFramework (INFO): Initializing test directory /var/folders/bz/mn3hr6td37bczwp7j89frs4w0000gn/T/bitcoin_func_test_dznr0x1z
    32025-10-21T16:05:14.300000Z TestFramework (INFO): BIP54 tests before activation
    42025-10-21T16:05:14.558000Z TestFramework (INFO): Activating BIP54
    52025-10-21T16:05:14.745000Z TestFramework (INFO): BIP54 tests after activation
    62025-10-21T16:05:15.296000Z TestFramework (INFO): Stopping nodes
    72025-10-21T16:05:15.460000Z TestFramework (INFO): Cleaning up /var/folders/bz/mn3hr6td37bczwp7j89frs4w0000gn/T/bitcoin_func_test_dznr0x1z on exit
    82025-10-21T16:05:15.460000Z TestFramework (INFO): Tests successful
    

    Are the functional tests worth mentioning in the test_vectors README? Perhaps with some of the content in the commit message:

    The previously introduced unit tests extensively test the specific implementation of each
    mitigation. This functional test complements them by sanity checking all mitigations in a "black
    box" manner. For the added timestamp constraints, it mimicks how they would get exploited (by
    implementing pseudo timewarp and Murch-Zawy attacks) and demonstrates those exploits are not
    possible anymore after BIP54 activates.
    
  8. in bip-0054/test_vectors/README.md:88 in 2fead0c179
    83+The [`coinbases.json`](./coinbases.json) file contains test cases exercising the new restrictions on
    84+coinbase transactions introduced in BIP54 to prevent duplicate coinbase transactions without
    85+resorting to BIP30 validation. Each test case contains a chain of mainnet blocks (including the
    86+genesis block), and whether this block chain is valid according to BIP54. All test cases are valid
    87+according to current Bitcoin's consensus rules, except one that features a block containing a
    88+coinbase transaction timelocked to a future block height.
    


    murchandamus commented at 7:53 am on October 22, 2025:
    Should there then perhaps also be a test case that has a coinbase transaction locked to a block height that is lower than required?

    darosior commented at 8:37 am on October 22, 2025:
    There definitely was one but looks like i messed up somewhere in re-generating the vectors. Will re-add it, thank you.

    murchandamus commented at 8:24 am on October 23, 2025:
    Just to be clear, I was just looking at the description, I did not check the test vectors, so it might just be the description that is off.

    darosior commented at 12:46 pm on October 23, 2025:
    Oh, then i just checked and it still is in here! Link.
  9. murchandamus commented at 7:57 am on October 22, 2025: contributor
    Looks good, see nit

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-10-23 18:10 UTC

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