Skip to content

Conversation

Christewart
Copy link
Contributor

@Christewart Christewart commented Feb 2, 2024

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
Copy link
Contributor

DrahtBot commented Feb 2, 2024

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/29371.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK theStack, achow101, scgbckbone
Stale ACK edilmedeiros, itornaza

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

No conflicts as of last run.

@DrahtBot DrahtBot added the Tests label Feb 2, 2024
@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from 778c65e to fe53feb Compare February 2, 2024 16:55
@Christewart Christewart marked this pull request as ready for review February 2, 2024 18:54
@edilmedeiros
Copy link
Contributor

edilmedeiros commented Feb 5, 2024

Tested ACK fe53feb

I've run test/functional/feature_taproot.py and test/functional/wallet_taproot.py.

The changes make sense in preparation for future expansions, as said.
They don't alter current test logic.

Copy link

@scgbckbone scgbckbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from fe53feb to 25dc427 Compare February 6, 2024 15:07
@Christewart
Copy link
Contributor Author

Christewart commented Feb 6, 2024

I believe this CI failure is spurious: https://github.com/bitcoin/bitcoin/pull/29371/checks?check_run_id=21277712706

Could someone restart the job ( 🙏 ) or I can push an empty commit to restart everything.

@theStack
Copy link
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
Copy link
Contributor Author

Christewart commented Mar 12, 2024

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 👎 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
Copy link
Contributor

itornaza commented Apr 10, 2024

tested ACK 1ccd751

  • Did a code review and everything lgtm
  • 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.

Copy link

@scgbckbone scgbckbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK (I'm pro default function parameter)

@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from 1ccd751 to ac5d855 Compare May 13, 2024 18:28
@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from ed4febd to 6a0406b Compare October 29, 2024 14:28
Copy link
Member

@achow101 achow101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

Please cleanup your commit message, it contains message fragments from squashed commits.

@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from 6a0406b to 6ffdabd Compare November 5, 2024 14:28
@Christewart
Copy link
Contributor Author

Concept ACK

Please cleanup your commit message, it contains message fragments from squashed commits.

Done in 6ffdabd

Copy link
Contributor

@itornaza itornaza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re ACK 6ffdabd

Copy link

@scgbckbone scgbckbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@MainS2020 MainS2020 mentioned this pull request Nov 27, 2024
@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from 6ffdabd to fca0367 Compare February 8, 2025 14:51
@Christewart
Copy link
Contributor Author

Rebased

Copy link
Contributor

@itornaza itornaza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rtACK fca0367

@DrahtBot DrahtBot requested a review from scgbckbone February 25, 2025 09:45
@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from fca0367 to e6c1026 Compare March 17, 2025 18:00
@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from e6c1026 to 4560189 Compare April 15, 2025 22:03
@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from 4560189 to 2eacaa2 Compare April 15, 2025 22:09
@Christewart
Copy link
Contributor Author

Rebased

@Christewart Christewart force-pushed the 2024-02-01-scriptpy-leafver branch from 4194b44 to 3b8b612 Compare May 9, 2025 16:42
Copy link

@scgbckbone scgbckbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants