BIP446 "OP_TEMPLATEHASH" implementation#100
BIP446 "OP_TEMPLATEHASH" implementation#100darosior wants to merge 5 commits intobitcoin-inquisition:29.xfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
2101fe0 to
afcf99f
Compare
afcf99f to
c6f9c9a
Compare
This introduces a new Script operation exclusively available in Tapscript context: OP_TEMPLATEHASH. This operation pushes the hash of the spending transaction on the stack. See BIP 446 for details. This operation is introduced as replacing OP_SUCCESS206 (0xce). Co-Authored-By: Greg Sanders <gsanders87@gmail.com>
Sanity check the template hash by using it to commit to the transaction that must spend an output. Malleating committed fields must lead to a consensus failure, and changing non-committed fields is fine. We also add the option to generate test vectors from this unit test.
We introduce one specialized target focused on exercising the new `GetTemplateHash()` logic introduced for OP_TEMPLATEHASH, and one broader fuzz target which exercises using OP_TEMPLATEHASH on a variety of transactions while asserting invariants.
This leverages the extensive feature_taproot.py test framework to generate coverage for the numerous scenarii and mutations exercised there. Additionally, a separate feature_templatehash.py functional test is introduced for end-to-end testing of the commit-to-next-transaction use case, which does not fit nicely into the feature_taproot.py framework (assumes input independence).
c6f9c9a to
b42e4a4
Compare
|
will review this soon |
instagibbs
left a comment
There was a problem hiding this comment.
ACK b42e4a4
Matches expectation. Checked for consensus consistency. My implementation includes some more (pre)activation testing, along with testing non-disconnection on discouragement whereas this branch treats it as always active.
Now I can't recall why I have a separate disconnection test in my branch... instagibbs@412adad#diff-fdd47fbcee05f351b2f1e813122030ca34a3cff6c5048c3ab5685ab61667571bR59
This implements
OP_TEMPLATEHASH, as defined in BIP446, for Inquisition. The corresponding Binana PR is available here.Unit tests are included, that are used to derive test vectors for the proposal. We also included two fuzz targets and end-to-end checks through the functional tests framework.
The original implementation, which this PR ports to Inquisition, is available here.