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

descriptors: fix max satisfaction weight for Taproot multisig primary path spends #1451

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jp1ac4
Copy link
Collaborator

@jp1ac4 jp1ac4 commented Nov 8, 2024

This is a fix to #1371 and the related #1322.

As per #1371 (comment), this adds the varint length for the script and control block elements of a Taproot primary path spend.

I think this is what caused #1322 and so I have reverted the change from #1323.

This includes the sizes of the script and control block elements.
This reverts commit 74a53ba.

I also removed the extra sats being added in the functional test.
Comment on lines +284 to +288
// We need to calculate the size manually before calculating the varint length.
// See https://docs.rs/miniscript/11.0.0/src/miniscript/util.rs.html#35-36.
Placeholder::TapScript(s) => varint_len(s.len()),
Placeholder::TapControlBlock(cb) => varint_len(cb.serialize().len()),
_ => 0,
Copy link
Member

Choose a reason for hiding this comment

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

So any stack item but the leaf script and control block account for the varint length? This is incredibly confusing, it'd be worth opening an issue there. (And if they fix it it would be nice to also fix rust-bitcoin/rust-miniscript#701.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It appears so. I did some debugging to inspect all the elements and their sizes against an actual transaction and the sizes of these two placeholder elements didn't include the varint lengths.

I've created rust-bitcoin/rust-miniscript#771 to track this.

@darosior
Copy link
Member

darosior commented Nov 8, 2024

light-ACK. The code looks correct to me but i haven't reviewed the test nor reviewed in depth but from a quick skim of their codebase it seems correct.

@edouardparis
Copy link
Member

From Andrew Poelstra comment: rust-bitcoin/rust-miniscript#771, the issue is acknowledged and it seems you are on the good track. I am okay to proceed to merge these changes.

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

Successfully merging this pull request may close these issues.

4 participants