Christewart
commented at 4:46 PM on February 2, 2024:
contributor
This PR adds a leaf_version parameter to taproot_tree_helper(). Previously the leaf version was hard coded, because we only currently support 1 leaf version.
Proposed soft forks such as #29221 require new leaf versions to be allocated. This PR allows the test framework to accomodate new leaf versions. This commit is also included in #29221, but in the policy of trying to avoid mega-PRs, I carved this out into a separate PR that can be merged.
This PR does not alter any test functionality, just adds a parameter and uses it across the codebase rather than hard coding the value inside of taproot_tree_helper().
DrahtBot
commented at 4:46 PM on February 2, 2024:
contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Christewart
commented at 7:44 PM on February 5, 2024:
here is where the previous hard coded value was that the parameter is replacing.
edilmedeiros
commented at 8:28 PM on February 5, 2024:
I see that you don't change the hardcoded value 0xc0, just pass it with function calls.
It does make sense to generalize taproot_tree_helper and taproot_construct.
edilmedeiros
commented at 8:31 PM on February 5, 2024:
I'm not familiar with taproot, but do you think it does make sense to add a test to check if someone is passing the correct version constants to the functions (maybe in a new PR, since this one is more like refactoring code)?
Christewart
commented at 9:38 PM on February 5, 2024:
I think you probably need to understand Taproot at least a bit to understand why we aren't changing the hard coded constant 0xc0 for now. I would recommend taking a look at #29221 to understand what a new using a new leaf version looks like.
scgbckbone
commented at 10:00 AM on February 6, 2024:
this line should be removed and only leaf_version function argument should be used in the function. Both version and leaf_version will point to the same object anyways. Same with all possible future leaf versions even 0xc0..0xfe
Christewart
commented at 3:08 PM on February 6, 2024:
Done in 25dc427e6c755b4c0d68599966caf95ada3565f7 , thank you for the review.
scgbckbone approved
scgbckbone
commented at 10:01 AM on February 6, 2024:
none
utACK
Christewart force-pushed on Feb 6, 2024
Christewart
commented at 3:53 PM on February 6, 2024:
contributor
Could someone restart the job ( :pray: ) or I can push an empty commit to restart everything.
DrahtBot added the label CI failed on Feb 6, 2024
DrahtBot removed the label CI failed on Feb 6, 2024
Christewart force-pushed on Feb 22, 2024
DrahtBot added the label CI failed on Feb 22, 2024
Christewart force-pushed on Mar 6, 2024
DrahtBot removed the label CI failed on Mar 6, 2024
Christewart force-pushed on Mar 9, 2024
theStack
commented at 4:34 PM on March 12, 2024:
contributor
Concept ACK
In order to avoid changes in functional tests and keep the patch small and simple, it probably would makes sense to set LEAF_VERSION_TAPSCRIPT as default value for parameter leaf_version for taproot_construct()?
Christewart
commented at 7:26 PM on March 12, 2024:
contributor
In order to avoid changes in functional tests and keep the patch small and simple, it probably would makes sense to set LEAF_VERSION_TAPSCRIPT as default value for parameter leaf_version for taproot_construct()?
This is more philsophical, but I really prefer not to provide default parameters to critical test code like this. It is SO easy to just forget to pass a parameter and have your test cases not test all possible branches of code! In this case, when dealing with consensus critical test cases, I think it should be required that the developer of the unit test pass in the tapscript version they are intending to test rather than us just assuming they want to test LEAF_VERSION_TAPSCRIPT.
Please see #29221 for examples of this. For instance if I forgot to pass LEAF_VERSION_TAPSCRIPT_64BIT in a specific spot I believe my tests would trivially pass because it is a soft fork!
Reasonable minds can differ of course, for future readers of the PR leave a comment or give me a :-1: if you disagree and would like to see the default parameter used in this case. If it is clear that I'm in the minority, I will change it.
itornaza
commented at 5:29 PM on April 10, 2024:
contributor
Built the PR with --with-incompatible-bdb and --enable-surpress-external-warnings
Run unit tests with make check and alll tests pass
Run functional tests with no extra flags and all tests pass
Run extended functional tests with --extended all tests pass
Reasonable minds can differ of course, for future readers of the PR leave a comment or give me a 👎 if you disagree and would like to see the default parameter used in this case. If it is clear that I'm in the minority, I will change it.
Who am I to say, but I philosophically agree with your reasoning on not passing default parameters in critical test code.
DrahtBot requested review from edilmedeiros on Apr 10, 2024
DrahtBot requested review from scgbckbone on Apr 10, 2024
DrahtBot requested review from theStack on Apr 10, 2024
scgbckbone
commented at 1:01 PM on April 27, 2024:
none
re-ACK (I'm pro default function parameter)
DrahtBot added the label Needs rebase on May 13, 2024
Christewart force-pushed on May 13, 2024
DrahtBot removed the label Needs rebase on May 13, 2024
DrahtBot added the label CI failed on May 14, 2024
Christewart force-pushed on May 21, 2024
Christewart force-pushed on May 21, 2024
DrahtBot removed the label CI failed on May 21, 2024
itornaza
commented at 4:49 PM on May 27, 2024:
contributor
trACK 3d4dda0b26d3e003d282be1e30e64055750a792e
DrahtBot requested review from scgbckbone on May 27, 2024
Christewart force-pushed on Jun 3, 2024
DrahtBot added the label Needs rebase on Jul 26, 2024
Christewart force-pushed on Aug 23, 2024
DrahtBot removed the label Needs rebase on Aug 23, 2024
achow101 removed review request from scgbckbone on Oct 15, 2024
achow101 removed review request from edilmedeiros on Oct 15, 2024
achow101 requested review from achow101 on Oct 15, 2024
DrahtBot added the label CI failed on Oct 20, 2024
DrahtBot removed the label CI failed on Oct 25, 2024
Christewart force-pushed on Oct 29, 2024
in
test/functional/test_framework/script.py:929
in
6a0406bed8outdated
925 | @@ -927,7 +926,7 @@ def taproot_construct(pubkey, scripts=None, treat_internal_as_infinity=False):
926 | if scripts is None:
927 | scripts = []
928 |
929 | - ret, h = taproot_tree_helper(scripts) 930 | + ret, h = taproot_tree_helper(scripts,leaf_version)
achow101
commented at 10:40 PM on November 4, 2024:
nit:
add a space after the comma.
achow101
commented at 10:40 PM on November 4, 2024:
member
Concept ACK
Please cleanup your commit message, it contains message fragments from squashed commits.
Christewart force-pushed on Nov 5, 2024
Christewart
commented at 2:29 PM on November 5, 2024:
contributor
Concept ACK
Please cleanup your commit message, it contains message fragments from squashed commits.
Done in 6ffdabd
itornaza approved
itornaza
commented at 5:40 PM on November 18, 2024:
contributor
re ACK6ffdabd4a00bf5578f975d0ed60c27adabf36c0b
DrahtBot requested review from achow101 on Nov 18, 2024
DrahtBot requested review from edilmedeiros on Nov 18, 2024
DrahtBot requested review from scgbckbone on Nov 18, 2024
scgbckbone approved
scgbckbone
commented at 11:54 AM on November 27, 2024:
none
ACK
Christewart force-pushed on Feb 8, 2025
Christewart
commented at 2:52 PM on February 8, 2025:
contributor
Rebased
itornaza
commented at 9:45 AM on February 25, 2025:
contributor
rtACK fca0367d9a6f8a4296d41cc9b344c94b93ef136b
DrahtBot requested review from scgbckbone on Feb 25, 2025
Christewart force-pushed on Mar 17, 2025
Christewart force-pushed on Apr 15, 2025
DrahtBot added the label Needs rebase on Apr 15, 2025
Christewart force-pushed on Apr 15, 2025
Christewart
commented at 10:10 PM on April 15, 2025:
contributor
Rebased
DrahtBot added the label CI failed on Apr 15, 2025
Christewart force-pushed on Apr 15, 2025
DrahtBot removed the label Needs rebase on Apr 16, 2025
DrahtBot removed the label CI failed on Apr 16, 2025
DrahtBot added the label Needs rebase on May 6, 2025
test: Add leaf_version parameter to taproot_tree_helper()3b8b612962
Christewart force-pushed on May 9, 2025
DrahtBot removed the label Needs rebase on May 9, 2025
scgbckbone
commented at 1:41 PM on June 27, 2025:
none
ACK
achow101 removed review request from edilmedeiros on Oct 22, 2025
achow101 requested review from ajtowns on Oct 22, 2025
achow101 requested review from instagibbs on Oct 22, 2025
instagibbs
commented at 3:28 PM on October 22, 2025:
member
Previously the leaf version was hard coded, because we only currently support 1 leaf version.
I missed this and you are correct. I modified the code base to remove the default version in taproot_tree_helper(), here is what the change looks like through the codebase. This shouldn't be necessary until there is another leaf version being used on the network.
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-04-14 21:13 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me