BIP360: swap scriptPathControlBlocks[1] and [2] for three-leaf P2MR test vectors#2102
Conversation
… vectors In a tree structured as [leaf0, [leaf1, leaf2]], the control block for spending a leaf must contain the sibling hashes along the Merkle path, not the leaf's own hash. The current test vectors have the control blocks for leaf1 and leaf2 swapped, causing them to include the spending leaf's own hash as the first path element instead of its sibling's hash. Fix swapped scriptPathControlBlocks entries for: - p2mr_three_leaf_complex - p2mr_three_leaf_alternative
|
Given from the look of this, that a new PR by this author was authored by Openclaw, and from the general activity on this author’s profile, I assume that this PR is AI slop. It may be useful AI slop, which is why I asked for your opinion, but I tend to close this. Will close this in a couple weeks (on or after 2026-03-30), if I don’t hear more from @cryptoquick, or @EthanHeilman. |
|
Just noticing this Will direct my team to investigate |
|
We are still investigating this one, please hold this open for now |
|
The elements in the "scriptPathControlBlocks" are currently not intended to be in any particular order. I propose updating the test vectors (and corresponding BIP-360 Rust reference implementation) to order the elements in the "scriptPathControlBlocks" array and make that ordering explicit. This update can be found here |
Summary
Problem
In a tree structured as [leaf0, [leaf1, leaf2]],
the control block for spending
a leaf must contain the sibling
hashes along the Merkle path, not the leaf's
own hash. The current test vectors have the control blocks for leaf1 and leaf2
swapped, causing them to include the spending leaf's own hash as the first path
element instead of its sibling's hash.
Example:es 1 and 2 in the
three-lea
Intermediate leaf hashes (correct in the test vector):
Fix swapped
Fix
Swap1 and 2 in the
three-leaf P2MRand scriptPathControlBlocks[2]:
Verification of correctedontrolBlocks
The same issue exists in P2MR test vectors
p2mr_threeandis fixed identically.