Repository navigation
backport: bitcoin#24148 #7758
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
Closed
Closed
backport: bitcoin#24148 #7758
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π΄ Blocking: Complete the P2SH adaptation of Miniscript resource validation
IsSane() does not enforce the limits required by the new P2SH context, and neither MiniscriptDescriptor::MakeScripts nor SHDescriptor::MakeScripts adds them. With distinct compressed keys, sh(and_v(v:pk(K0),multi(1,K1,...,K15))) passes getdescriptorinfo, deriveaddresses, and importdescriptors but produces a 548-byte redeemScript. I independently funded this descriptor and constructed a signed spend: even with nonstandard transactions enabled, testmempoolaccept rejects it with 'mandatory-script-verify-flag-failed (Push value size limit exceeded)'. The corresponding 514-byte, 14-key case succeeds. P2SH must push the entire redeemScript through scriptSig, so the oversized output is permanently unspendable.
The same admission gap also affects relay policy below 520 bytes. A nested or_i with 16 distinct pkh branches produces a 445-byte redeemScript whose spend fails with 'bad-txns-nonstandard-inputs' because AreInputsStandard() counts all 16 sigops against MAX_P2SH_SIGOPS=15. An and_v chain requiring 15 pkh signatures produces a 375-byte redeemScript but a 1980-byte scriptSig in the reproduction, rejected as 'scriptsig-size' against the 1650-byte limit. Both policy cases succeed with nonstandard transactions enabled.
Validate the actual P2SH redeemScript size, static sigop count, and satisfaction scriptSig-size bounds before exposing these receiving descriptors, and add accepted/rejected boundary coverage. Account for the uncompressed keys allowed by this adaptation rather than relying only on Miniscript's compressed-key ScriptSize() estimate.
source:
gpt-6-astra(phase2-reviewer: general, backport-reviewer, dash-core-commit-history)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed: upstream relies on P2WSH limits inside IsValid()/CheckStackSize() (script size, stack items), which Dash's bitcoin#24147 backport dropped, and moving Miniscript into sh() added no P2SH equivalent. A 1-of-15 multi plus pk() gives a 548-byte redeemScript, over the 520-byte push limit, so the output is unspendable. The fix needs new Dash-specific P2SH limits (redeemScript size, 15-sigop limit, 1650-byte scriptSig, uncompressed keys) that upstream never designed, so a maintainer must decide whether to write those checks or drop bitcoin#24148 from this batch. bitcoin#24148 has had its repair lane and is being dropped from this branch.
π€ backportsys, on behalf of the Dash backport pipeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm comfortable with dropping bitcoin#24148 from this batch rather than introducing the P2SH validation here; my checkout is still
90ae2694b4e, so I'm acknowledging the deferral, not confirming that the removal has landed.Noted as intentionally deferred; I will not press it further here.