Repository navigation
Description
Summary
0.1.x has one independent default OP_CHECKSIGPQC P2MR witness vector, but it only covers the no-annex path. Annex-present P2MR script-path spends change the committed sighash transcript: the P2MR sighash sets the low annex bit in spend_type and commits the serialized annex hash.
Current tests prove annex-present P2MR script-path acceptance, and fuzz can touch annex, but I could not find a fixed external vector that pins annex bytes, P2MRSighash message bytes, sighash, PQC signature, and near-miss behavior.
Affected Branch / Ref
origin/0.1.xat31f6b39f10164db1e2162f95bfb3a033cdd01c06- Open PRs inspected on 2026-06-29: Reject non-P2MR raw funding outputs #37, Add independent CHECKDATASIGPQC vector coverage #38, Verify libbitcoinpqc tagged subtree imports #41, Add independent CHECKDATASIGADDPQC vector coverage #42, Add P2MR data-hash proof fixtures #43, Fix PQC data-hash counter accounting #46, Add independent P2MR commitment vectors #47
Affected Files
src/script/interpreter.cppsrc/test/script_p2mr_tests.cppsrc/test/fuzz/p2mr_script.cppsrc/test/data/p2mr_pqc_witness_vectors.jsontest/functional/feature_p2mr.pyand other P2MR functional tests
Evidence
SignatureHashP2MRuses theP2MRSighashtag. In the common schnorr/P2MR sighash path, annex presence changesspend_typeand appendsm_annex_hash.- P2MR witness validation removes a final annex item when the last witness element starts with
ANNEX_TAG, setsm_annex_present, and hashes the serialized annex before executing the P2MR leaf. - The existing fixed
single_key_default_sighashvector inp2mr_pqc_witness_vectors.jsonis no-annex only. Itsp2mrSigMsgis 212 bytes and has spend-type byte0x02at offset 170, not annex-present0x03. - The fixed vector test builds
ScriptExecutionDatawithm_annex_present = false. p2mr_annex_present_path_succeedsappends an annex to anOP_TRUEP2MR spend and checks acceptance only. It does not involveOP_CHECKSIGPQC, a fixed signature, or a pinned sighash transcript.src/test/fuzz/p2mr_script.cppmay append an annex and may sign viaCreatePQCSignature, but that is a production-helper mirror path, not an independent consensus oracle.- PR Add independent CHECKDATASIGPQC vector coverage #38 and Add independent CHECKDATASIGADDPQC vector coverage #42 add independent data-signature fixtures for
OP_CHECKDATASIGPQC/OP_CHECKDATASIGADDPQC, not annex-present transaction sighash vectors. - PR Add P2MR data-hash proof fixtures #43 adds pinned
signdatapqchash/verifydatapqchashproof coverage, notOP_CHECKSIGPQCtransaction sighash coverage. - PR Add independent P2MR commitment vectors #47 adds P2MR commitment vectors, not PQC transaction signature sighash vectors.
- PR Reject non-P2MR raw funding outputs #37, Verify libbitcoinpqc tagged subtree imports #41, and Fix PQC data-hash counter accounting #46 do not add annex-present P2MR sighash fixtures.
Impact
An implementation could omit the annex bit, hash the annex incorrectly, place the annex hash at the wrong transcript position, or accidentally reuse the no-annex transcript and still pass the current fixed vector coverage. The existing annex tests would not catch that if signing and verification share the same production helper behavior.
Why This Is Consensus-Relevant
OP_CHECKSIGPQC validation depends on the exact P2MRSighash digest. Annex presence is committed into that digest. A mismatch between implementations on annex-present transcript bytes can produce consensus disagreement for otherwise valid-looking P2MR spends.
Suggested Acceptance Criteria
- Add at least one independent annex-present
OP_CHECKSIGPQCP2MR vector. - Fixture pins: prevout, spend transaction, witness stack including annex bytes, leaf script, control block, scriptPubKey,
p2mrSigMsg,p2mrSighash, pubkey, and signature. - Test recomputes
SignatureHashP2MRand compares to fixture bytes/hash. - Test verifies the fixed signature against the fixed hash.
- Test verifies the full spend succeeds.
- Near misses fail for mutated signature, removed annex, mutated annex byte, wrong sighash domain or no-annex transcript signature, mutated committed leaf, and wrong pubkey leaf.
- Generator/provenance must not use qbit wallet/signing/sighash helpers for the transcript.
Test / Vector Plan
- Extend
p2mr_pqc_witness_vectors.jsonor add a new focused annex fixture file. - Generate a deterministic single-key P2MR
OP_CHECKSIGPQCspend with witness stack:[signature, leaf_script, control_block, annex]. - Independently serialize the P2MR sighash message with spend type
0x03and the serialized annex hash. - Hash with
TaggedHash("P2MRSighash"). - Sign that digest with libbitcoinpqc using deterministic test entropy.
- Add unit tests for valid spend plus the near misses above.
- Keep fuzz and functional coverage as supplemental, not as the fixed oracle.
Activity