Skip to content
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

Make miniscript GetWitnessSize accurate for tapscript #28651

Merged
merged 3 commits into from Oct 17, 2023

Conversation

sipa
Copy link
Member

@sipa sipa commented Oct 13, 2023

So far, the same algorithm is used to compute an (upper bound on) the maximum witness size for both P2WSH and P2TR miniscript. That's unfortunate, because it means fee estimations for P2TR miniscript will miss out on the generic savings brought by P2TR witnesses (smaller signatures and public keys, specifically).

Fix this by making the algorithm use script context specification calculations, and add tests for it. Also included is a cleanup for the tests to avoid mutable globals, as I found it hard to reason about what exactly was being tested.

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 13, 2023

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

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK darosior, achow101

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

@darosior
Copy link
Member

Concept ACK. Good catch. GetWitnessSize ended up being merged with #26567 but i forgot to update it in #27255.

@fanquake fanquake added this to the 26.0 milestone Oct 15, 2023
Copy link
Member

@darosior darosior left a comment

Choose a reason for hiding this comment

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

ACK b228108

Nice cleanup too.

@achow101
Copy link
Member

ACK b228108

@DrahtBot DrahtBot removed the request for review from achow101 October 17, 2023 22:22
@achow101 achow101 merged commit c2d4e40 into bitcoin:master Oct 17, 2023
16 checks passed
Frank-GER pushed a commit to syscoin/syscoin that referenced this pull request Oct 21, 2023
…cript

b228108 miniscript: make GetWitnessSize accurate for tapscript (Pieter Wuille)
8be9851 test: add tests for miniscript GetWitnessSize (Pieter Wuille)
7ed2b2d test: remove mutable global contexts in miniscript fuzzer/test (Pieter Wuille)

Pull request description:

  So far, the same algorithm is used to compute an (upper bound on) the maximum witness size for both P2WSH and P2TR miniscript. That's unfortunate, because it means fee estimations for P2TR miniscript will miss out on the generic savings brought by P2TR witnesses (smaller signatures and public keys, specifically).

  Fix this by making the algorithm use script context specification calculations, and add tests for it. Also included is a cleanup for the tests to avoid mutable globals, as I found it hard to reason about what exactly was being tested.

ACKs for top commit:
  achow101:
    ACK b228108
  darosior:
    ACK b228108

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

Successfully merging this pull request may close these issues.

None yet

5 participants