Repository navigation
Description
Problem Statement
signdatapqchash and verifydatapqchash exercise the QbitDataSigPQC data-signature domain, but current coverage mostly creates a proof through the wallet and verifies it through the RPC in the same run. That round-trip can miss regressions where wallet signing and verification drift together.
Add independent pinned regtest fixtures for P2MR data-signature proofs, including the full PQC signature, so the RPC/wallet proof format, data-signature domain, address commitment, leaf script, control block, and verification behavior are locked to known values.
Evidence From Code/Tests
signdatapqchashreturnsmessage_hash,datasig_hash,domain,algorithm,proof_mode,pubkey,signature,leaf_version,leaf_script,control_block, andp2mr_merkle_root:src/wallet/rpc/signmessage.cpp.- Wallet signing selects a P2MR v1 single-key
<pubkey> OP_CHECKSIGPQCleaf, validates the control block against the address Merkle root, and signsComputeQbitDataSigPQCHash(message_hash):src/wallet/scriptpubkeyman.cpp. verifydatapqchashindependently validates proof mode, address type, message/signature/pubkey sizes, leaf script shape, leaf version, control block shape/version, Merkle root commitment, and signature domain:src/rpc/signmessage.cpp.- The shared domain is
QbitDataSigPQC:src/script/interpreter.cpp. - Current functional coverage round-trips generated proofs and mutates several fields, but does not use pinned fixture values:
test/functional/feature_p2mr.py.
Proposed Acceptance Criteria
- Add a regtest fixture with pinned full
signature, not only a signature hash. - Fixture pins:
message_hash,datasig_hash,pubkey,signature,leaf_script,control_block,p2mr_merkle_root,address,leaf_version,proof_mode,domain, andalgorithm. - Add a valid-fixture test that passes the pinned proof directly to
verifydatapqchashand assertsvalid=trueplus returneddatasig_hash,p2mr_merkle_root,address,pubkey, andproof_mode. - Add a test for current extra-field behavior without changing behavior: if input proof includes contradictory informational fields such as wrong
datasig_hashor wrongp2mr_merkle_root,verifydatapqchashshould ignore those untrusted extras and return the recomputed verified values. - Add independent checks that
message_hash -> datasig_hash,leaf_script/control_block -> p2mr_merkle_root, andp2mr_merkle_root -> regtest addressmatch the fixture. - Keep the existing runtime wallet round-trip coverage.
Suggested Negative Cases
Wrong signature, wrong message hash, wrong leaf script/pubkey binding, wrong address/root, wrong control block, unsupported leaf_version, unsupported proof_mode, malformed message/signature/pubkey/control sizes, malformed leaf script, and control-block leaf-version mismatch.
Recommended Test Location
Use both:
src/test/data/p2mr_datapqchash_vectors.jsonfor the pinned fixture.- A C++ unit test for deterministic hash/proof/address checks.
- Functional RPC coverage in or near
test_data_pqc_hash_rpcintest/functional/feature_p2mr.pyforverifydatapqchashfixture acceptance and RPC error behavior.
Risks / Open Questions
- The full signature is large, but should be pinned because signature verification is the core behavior under test.
- Fixture schema should include an explicit version so future proof modes or leaf versions can be added cleanly.
- Regtest address encoding should be explicit in the fixture metadata.
Activity