Repository navigation
Description
Summary
Public RPC and descriptor paths can create arbitrary-root P2MR outputs through rawmr(...) and generic witness-v2/32 address handling. That includes outputs whose root commits only to a future even P2MR leaf version.
Current consensus and policy then split intentionally but sharply:
- mandatory P2MR rules verify the commitment and treat unknown even P2MR leaf versions as consensus-valid future upgrade stubs;
- standard policy rejects the reveal spend with the upgradable Taproot/P2MR version discourage flag;
- current wallet, PSBT, and data-signing paths only support P2MR v1 leaf version
0xc0.
This is a P3 review warning / hardening issue, not evidence that ordinary wallet P2MR receive/change flows are broken. mr(...) and wallet-native address generation remain pinned to P2MR v1 leaves. The concern is the explicit rawmr(...) / arbitrary-root creation boundary.
Current Status
Verified still present on 2026-06-26:
- Default branch:
main maincommit checked:4b7e1043ced39218757f9c103460ef05ea4b86d7- R11 finding:
R11-CARRYFORWARD-P2MR-01 - Scope ID:
r11-p2mr-future-leaf-footguns - Severity candidate:
P3 WARN
This is not the older rawmr(...) solvability issue. main already reports RawMRDescriptor::IsSolvable() == false.
Issue searches for rawmr, future leaf P2MR, and reserved leaf P2MR found no existing public issue or PR for this narrower creation/policy/signing boundary.
Related but not duplicate:
#20covers independent P2MR/PQC witness vector hardening.#21/#29cover independent P2MR/CTV commitment vector hardening.
Those improve oracle quality but do not directly decide whether rawmr(...) should remain an accepted expert escape hatch, receive a warning, or gain tighter creation-time policy on restricted-output chains.
Impact
A user, tool, pool, bridge, or integration can derive and fund a normal-looking P2MR address from rawmr(<32-byte-root>), where the root commits to a future even leaf version.
The resulting output is easy to create and allowed as witness-v2/32 P2MR output, but current standard relay and signing behavior do not provide a normal spend path for the reveal:
- The output is created as a P2MR witness-v2/32 program.
- The reveal witness commits to a future even P2MR leaf version.
- Mandatory consensus verification succeeds after the root/leaf commitment checks.
- Standard policy rejects the spend under the upgradable-version discourage flag.
- Current wallet/PSBT signer paths skip or refuse non-
0xc0P2MR leaves.
If this is intentional, it should be documented and tested as an expert-only escape hatch. If not, restricted-output chains should avoid making these outputs look like ordinary safe P2MR receive targets.
Evidence
Code refs on main:
src/script/solver.cpp:144classifies witness-v2/32 asTxoutType::WITNESS_V2_P2MR.src/consensus/restricted_outputs.h:18through:26allow witness-v2/32 as the restricted-output-mode P2MR class.src/policy/policy.cpp:156through:159reject reserved future outer witness outputs, but not witness-v2/32 P2MR outputs on the output side.src/script/descriptor.cpp:1904through:1920keeprawmr(<root>)as a public descriptor that expands to a witness-v2/32 P2MR scriptPubKey while reporting unsolvable.src/rpc/output_script.cpp:277through:279documentrawmr(<merkle root>)forderiveaddresses.src/script/interpreter.cpp:2389through:2406execute only leaf version0xc0; future P2MR leaf versions succeed by consensus unless the discourage flag is present.src/script/sign.cpp:503through:506keep transaction signing pinned toP2MR_LEAF_VERSION_V1.src/wallet/scriptpubkeyman.cpp:2346through:2349keeps P2MR data signing pinned toP2MR_LEAF_VERSION_V1.
Existing tests that pin parts of the behavior:
script_p2mr_tests/p2mr_reserved_leaf_versions_policy_flagscript_p2mr_tests/p2mr_future_even_leaf_version_uses_masked_control_bytedescriptor_p2mr_tests/parse_rawmr_roundtripdescriptor_p2mr_tests/rawmr_fixed_address_vectorpsbt_p2mr_tests/psbt_p2mr_signing_refuses_reserved_leaf_versionspsbt_p2mr_tests/psbt_p2mr_finalization_refuses_reserved_leaf_versionsfeature_p2mr.py::test_unknown_leaf_policy_rejection
Local verification after confirming the relevant source and tests are identical to main:
build/bin/test_qbit --run_test=script_p2mr_tests/p2mr_reserved_leaf_versions_policy_flag
build/bin/test_qbit --run_test=script_p2mr_tests/p2mr_future_even_leaf_version_uses_masked_control_byte
build/bin/test_qbit --run_test=descriptor_p2mr_tests/parse_rawmr_roundtrip
build/bin/test_qbit --run_test=descriptor_p2mr_tests/rawmr_fixed_address_vector
build/bin/test_qbit --run_test=psbt_p2mr_tests/psbt_p2mr_signing_refuses_reserved_leaf_versions
build/bin/test_qbit --run_test=psbt_p2mr_tests/psbt_p2mr_finalization_refuses_reserved_leaf_versionsAll six targeted checks passed.
Reproduction Gap
The current suite pins the individual source-level pieces, but it does not appear to include one end-to-end functional repro that:
- derives a P2MR address from
rawmr(<future-leaf-root>)via public RPC; - funds that address;
- attempts a future-leaf reveal spend;
- proves standard mempool rejection;
- proves mandatory/block validation behavior for the same reveal; and
- proves wallet/PSBT signer refusal or inability for the same output.
Suggested Fix
Human triage should choose one of these outcomes:
- Document
rawmr(...)as an expert-only arbitrary-root escape hatch and add an end-to-end regression test for future-leaf funding, standard-policy rejection, and signer refusal. - Add RPC or descriptor warnings for
rawmr(...)on restricted-output chains so users do not mistake arbitrary-root P2MR addresses for wallet-supported receive addresses. - Reject or require explicit opt-in for
rawmr(...)-derived receive/funding surfaces on restricted-output chains. - Keep current behavior as accepted risk, but explicitly record why Taproot-style future-leaf behavior is intended for P2MR despite qbit's restricted-output default.
Reverify Requirement
Reverify by adding or checking an end-to-end functional test that funds a rawmr(...) future-leaf P2MR address and demonstrates the three-way behavior in one scenario: consensus-valid future-leaf reveal, standard mempool rejection, and current signer/PSBT refusal for non-0xc0 leaves.
Activity