-
Notifications
You must be signed in to change notification settings - Fork 5.8k
BIP54: Consensus Cleanup test vectors #2015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
BIP54: Consensus Cleanup test vectors #2015
Conversation
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
$ ./build/bin/test_bitcoin --run_test=bip54_tests
Running 4 test cases...
*** No errors detected
$ ./build/test/functional/feature_bip54.py
2025-10-21T16:05:13.483000Z TestFramework (INFO): PRNG seed is: 80635940825195715
2025-10-21T16:05:13.483000Z TestFramework (INFO): Initializing test directory /var/folders/bz/mn3hr6td37bczwp7j89frs4w0000gn/T/bitcoin_func_test_dznr0x1z
2025-10-21T16:05:14.300000Z TestFramework (INFO): BIP54 tests before activation
2025-10-21T16:05:14.558000Z TestFramework (INFO): Activating BIP54
2025-10-21T16:05:14.745000Z TestFramework (INFO): BIP54 tests after activation
2025-10-21T16:05:15.296000Z TestFramework (INFO): Stopping nodes
2025-10-21T16:05:15.460000Z TestFramework (INFO): Cleaning up /var/folders/bz/mn3hr6td37bczwp7j89frs4w0000gn/T/bitcoin_func_test_dznr0x1z on exit
2025-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.
## BIP54 test vectors | ||
|
||
This folder contains a set of test vectors for each mitigation introduced in the BIP. This document | ||
presents them in more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
presents them in more details. | |
presents them in more detail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, see nit
genesis block), and whether this block chain is valid according to BIP54. All test cases are valid | ||
according to current Bitcoin's consensus rules, except one that features a block containing a | ||
coinbase transaction timelocked to a future block height. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there then perhaps also be a test case that has a coinbase transaction locked to a block height that is lower than required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There definitely was one but looks like i messed up somewhere in re-generating the vectors. Will re-add it, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, then i just checked and it still is in here! Link.
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.