Skip to content

Return script errors for invalid tapscript signature operations - #22

Open
adrienlacombe wants to merge 2 commits into
BitVM:masterfrom
adrienlacombe:codex/tapscript-signature-errors
Open

adrienlacombe wants to merge 2 commits into
BitVM:masterfrom
adrienlacombe:codex/tapscript-signature-errors

Conversation

@adrienlacombe

Copy link
Copy Markdown

Invalid 32-byte x-only public keys and executed Tapscript CHECKMULTISIG/CHECKMULTISIGVERIFY currently panic. Return the existing SchnorrSig and TapscriptCheckMultiSig errors instead. Skipped multisig opcodes remain ignored.

Keep signature size and hash-type validation ahead of public-key point verification. In particular, SIGHASH_SINGLE without a corresponding output returns SchnorrSigHashtype for both ordinary SINGLE and SINGLE|ANYONECANPAY. Match only TaprootError::SingleMissingOutput; malformed caller-supplied transaction context remains distinct from script rejection. Legacy/Segwit multisig implementation and the public method's 32-byte key precondition are outside this change.

Validation: all 20 tests pass with cargo test --locked, including eight new groups covering valid-signature controls, all three signature opcodes, invalid key points, signature size/type precedence, missing SINGLE outputs, malformed-prevout distinction, and executed/skipped multisig. Three initial regression groups panic on the unchanged upstream code. The SINGLE error mapping additionally follows Core's pinned signature checker.

A separate funded Taproot experiment validates six original panic cases and their controls against Core v30.3 (49faec4f), checking exact rejection diagnostics. All match after integration. The missing-SINGLE-output case has local regression coverage and Core source inspection; it is not part of that 20-transaction Core corpus.

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.

1 participant